Re: [PATCH 05/15] x86_32: Provide consistent pt_regs

From: Peter Zijlstra
Date: Tue Jun 11 2019 - 04:19:27 EST


On Fri, Jun 07, 2019 at 03:32:15PM -0400, Josh Poimboeuf wrote:
> On Wed, Jun 05, 2019 at 03:07:58PM +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 various trampolines in ftrace and kprobes, the
> > stack unwinder, ptrace, kdump and kgdb.
> >
> > 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 | 77 +++++++++++++++------------
> > 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, 178 insertions(+), 191 deletions(-)
>
> I recall writing some of this code (some of the kernel_stack_pointer
> removal stuff) so please give me a shout-out ;-)

Absolutely, sorry for not doing that. I've added:

"Much thanks to Josh for help with the cleanups!"