Re: [RFC][PATCH 4/4] x86_32: Provide consistent pt_regs

From: Ingo Molnar
Date: Wed May 08 2019 - 08:47:52 EST



* Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:

> On Wed, May 08, 2019 at 09:49:05AM +0200, Peter Zijlstra wrote:
> > Currently pt_regs on x86_32 has an oddity in that kernel regs
> > (!user_mode(regs)) are short two entries (esp/ss). This means that any
> > code trying to use them (typically: regs->sp) needs to jump through
> > some unfortunate hoops.
> >
> > Change the entry code to fix this up and create a full pt_regs frame.
> >
> > This then simplifies:
> >
> > - ftrace
> > - kprobes
> > - stack unwinder
> > - ptrace
> > - kdump
> > - kgdb
> >
> > Hated-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > ---
> > arch/x86/entry/entry_32.S | 105 ++++++++++++++++++++++++++++++++++----
> > arch/x86/include/asm/kexec.h | 17 ------
> > arch/x86/include/asm/ptrace.h | 17 ------
> > arch/x86/include/asm/stacktrace.h | 2
> > arch/x86/kernel/crash.c | 8 --
> > arch/x86/kernel/ftrace_32.S | 81 ++++++++++++++++-------------
> > arch/x86/kernel/kgdb.c | 8 --
> > arch/x86/kernel/kprobes/common.h | 4 -
> > arch/x86/kernel/kprobes/core.c | 29 ++++------
> > arch/x86/kernel/kprobes/opt.c | 20 ++++---
> > arch/x86/kernel/process_32.c | 16 +----
> > arch/x86/kernel/ptrace.c | 29 ----------
> > arch/x86/kernel/time.c | 3 -
> > arch/x86/kernel/unwind_frame.c | 32 +----------
> > arch/x86/kernel/unwind_orc.c | 2
> > 15 files changed, 181 insertions(+), 192 deletions(-)
>
> Very nice diffstat. This moves all the pain to the 32-bit entry code
> where it belongs.

Yes, that's very convincing and looks like a nice simplification of
32-bit x86 entry concepts overall.

Assuming it's correct, the question is whether Linus still hates it? :-)

Thanks,

Ingo