On Fri, May 31, 2019 at 3:35 PM Oleg Nesterov <o...@redhat.com> wrote: > On 05/31, Jann Horn wrote: > > > > So I guess I should make a v2 that still adds the smp_rmb() in > > __ptrace_may_access(), but gets rid of the smp_wmb() in > > commit_creds()? (With a comment above the rcu_assign_pointer() that > > explains the ordering?) > > I am fine either way, whatever you like more. > > If you prefer v1 (this patch), feel free to add > > Acked-by: Oleg Nesterov <o...@redhat.com>
Thanks! I think I actually like the current version more, since this way, we have a nice simple pairing of smp_rmb() and smp_wmb(). Otherwise we end up mixing smp_rmb() with smp_store_release(), which I find kind of weird. And to me, semantically, it also seems slightly weird to use rcu_assign_pointer() as a barrier for previous writes that are not pointed to by the pointer being assigned. Maybe I'm just not familiar enough with the details of how memory ordering works to feel comfortable with it...