On Sat, Feb 10, 2024, at 01:15, Kees Cook wrote: > On Thu, Feb 08, 2024 at 03:47:52PM +0000, Alice Ryhl wrote: >> unsigned long res = n; >> might_fault(); >> if (!should_fail_usercopy() && likely(access_ok(from, n))) { >> + /* >> + * Ensure that bad access_ok() speculation will not >> + * lead to nasty side effects *after* the copy is >> + * finished: >> + */ >> + barrier_nospec(); > > This means all callers just gained this barrier. That's a behavioral > change -- is it intentional here? I don't see it mentioned in the commit > log. My bad, I probably should have explained it when I did the patch as this is very subtle: The barrier_nospec() definition is a nop on everything other than x86 and powerpc, but those two were using the out-of-line version that did in fact use it. After this patch, the out-of-line function calls the inline function, so it needs to be added here to keep the behavior unchanged on the architectures that need it. For the rest, this change has no effect. Arnd