> Date: Mon, 7 Jul 2014 13:46:03 -0700 > From: Matthew Dempsky <matt...@dempsky.org> > > p_sigmask is only modified by the owning thread from process context > (e.g., sys_sigprocmask(), sys_sigreturn(), userret(), or postsig()), > but it can be accessed anywhere (e.g., interrupts or threads on other > CPUs). Currently sys_sigprocmask() protects p_sigmask with splhigh(), > but that's not MP-safe. > > The simpler solution is to take advantage of our atomics APIs. > Unfortunately for implementing SIG_SETMASK, we don't have an > atomic_store_int() function, and I can't bring myself to abuse > "volatile" for this purpose, so I've resorted to atomic_swap_uint().
Sory, but I think that's wrong. You need volatile to make sure the mask is read from memory when you're checking bits. Or you need to insert the proper memory barriers I think.