On Tue, May 5, 2020 at 7:15 AM Thomas Gleixner <[email protected]> wrote: > > From: Thomas Gleixner <[email protected]> > > Prepare for using IDTENTRY to define the C exception/trap entry points. It > would be possible to glue this into the existing macro maze, but it's > simpler and better to read at the end to just make them distinct. Provide > a trivial inline helper to read the trap address. > > The existing macros will be removed once all instances are converted. > > Signed-off-by: Thomas Gleixner <[email protected]> > Reviewed-by: Alexandre Chartre <[email protected]> > > --- > arch/x86/kernel/traps.c | 5 +++++ > 1 file changed, 5 insertions(+) > > --- a/arch/x86/kernel/traps.c > +++ b/arch/x86/kernel/traps.c > @@ -205,6 +205,11 @@ static void do_error_trap(struct pt_regs > } > } > > +static __always_inline void __user *error_get_trap_addr(struct pt_regs *regs) > +{ > + return (void __user *)uprobe_get_trap_addr(regs); > +}
My mind boggles. WTF is this? Perhaps this should have a comment like: /* * Returns the address from which a user trap originated. This would be the same as regs->ip, * except for frhgnieawfn nvlrkvklsrvs and mfkealwf, and this lets the thingummy pass a * modified value to the signal frame, but only for #DE and #UD, because #*!&@&#@. */ except with the blanks filled in. After reading a bit of uprobe code, I assume this is a fixup for when we're running code that got moved out of line because it got replaced by a breakpoint. I'm still mystified by why it only seems to apply to #DE and #UD.

