Re: [PATCH] ptrace: restore smp_rmb() in __ptrace_may_access()
From: Peter Zijlstra
Date: Fri May 31 2019 - 05:16:33 EST
On Thu, May 30, 2019 at 02:05:31PM +0200, Oleg Nesterov wrote:
> > Anyway, looking at it, I think smp_acquire__after_ctrl_dep() doesn't
> > make sense here;
>
> Well I still _think_ it should work, it provides the LOAD-LOAD ordering
> and this is what we need.
So it hard relies on being part of a control dependency, note how the
comment says that architectures that do not do load speculation can
override the smp_rmb() default with barrier() (and we used have an
architecture that made use of that, although it's been since removed).
IOW, it is an error to use smp_acquire__after_ctrl_dep() without an
(immediate) preceding branch.