On Wed, 2 Dec 2026 11:53:43 -0500 James Houghton <[email protected]> wrote:
> On Wed, Dec 2, 2026 at 7:36 AM David Laight > <[email protected]> wrote: > > > > On Wed, 2 Dec 2026 02:39:18 +0000 > > James Houghton <[email protected]> wrote: > > > > > With masked user access (x86-64 and powerpc), mask_user_address() and > > > masked_user_*_access_begin() take the place of access_ok(), so the > > > NULL current->mm check that the previous patch added to access_ok() > > > doesn't cover these paths. > > > > Ugg... > > This adds a conditional branch to hot code paths that are pretty much > > carefully arranged to not contain one. > > > > The WARN_ON_ONCE() also add inline bloat (more so on some architectures > > than others). > > (The same is true for the previous patch.) > > > > Adding tests to the unusual call paths is one thing, but not to the > > normal paths which always run in the context of a system call for a > > normal user process. > > Thanks David, yeah I think I'll put the checks back into the copying > routines and leave them out of access_ok() and the masking routines. > Christophe and Dave had similar concerns[1]. > > The WARN_ON_ONCE() bloat is real but doesn't seem that high; I > measured it[2]. Let me know if those results concern you. Try one of the architectures where it ends up being a real call. IIRC x86 manages to use an undefined instruction and then do all the work out of line in the trap handler. The issue with a real call is that it reduces the number of registers the compiler has for the enclosing function. David > > Thanks for the feedback! > > [1] > https://lore.kernel.org/kvm/[email protected]/ > [2] > https://lore.kernel.org/kvm/cadrl8hwve7zj+kfezbrf16nmmdoonwpobz7l0kbid4-acys...@mail.gmail.com/
