Re: [PATCH 0/3] x86/dumpstack: Inline copy_from_user_nmi()

From: Kees Cook
Date: Mon Sep 19 2022 - 15:26:32 EST


On Mon, Sep 19, 2022 at 04:46:39PM +0200, Peter Zijlstra wrote:
> On Fri, Sep 16, 2022 at 12:57:23PM -0700, Andrew Morton wrote:
> > Why is this so complicated.
> >
> > There's virtually zero value in running all those debug checks from within
> > copy_from_user_nmi().
> >
> > --- a/arch/x86/lib/usercopy.c~a
> > +++ a/arch/x86/lib/usercopy.c
> > @@ -44,7 +44,7 @@ copy_from_user_nmi(void *to, const void
> > * called from other contexts.
> > */
> > pagefault_disable();
> > - ret = __copy_from_user_inatomic(to, from, n);
> > + ret = raw_copy_from_user(to, from, n);
> > pagefault_enable();
> >
> > return ret;
>
> I'm with Andrew here; this looks a *LOT* saner than all the other stuff.

Yeah, I'd agree -- it's a special case of a special case. I'll send a
new patch.

Thanks!

--
Kees Cook