Re: [RFC][PATCHSET] x86 uaccess cleanups

From: Linus Torvalds
Date: Mon Mar 23 2020 - 15:16:51 EST


On Mon, Mar 23, 2020 at 11:36 AM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Beginning of uaccess series; there's more already linearized, but
> I'll be posting that separately.

Ok, apart from my naming hang-up, I love how this gets rid of some of
my least favorite header file crud.

So big ack.

One thing to look out for: have you done profiling with stack frames
with this? That patch 1/22 looks obviously correct, but all those
magic rules for __copy_from_user_nmi() are the scary ones.

Simple test to run - just do this as root:

perf record -e cycles:pp -g -a sleep 100

while you're doing a kernel build or similar. That will do the
system-level profile of everything with stack trace code, which tends
to trigger a lot of special stuff.

Doing some basic ftrace tests might be good too.

Because that callchain code is the thing that really needs to work
from odd contexts, and also can't afford to have a stack frame because
you get into nasty recursive issues with tracing etc.

I think your patch is "obviously correct" in that you basically just
expand the crazy complex inline rules anyway, but I just want to make
sure it got some basic testing too..

Linus