Re: [PATCH v4 04/10] x86/traps: Allow custom fixups in handle_bug()

From: Peter Zijlstra
Date: Tue Feb 25 2025 - 03:56:01 EST


On Mon, Feb 24, 2025 at 10:59:21AM -0800, Kees Cook wrote:
> On Mon, Feb 24, 2025 at 01:37:07PM +0100, Peter Zijlstra wrote:
> > The normal fixup in handle_bug() is simply continuing at the next
> > instruction. However upcomming patches make this the wrong thing, so
> > allow handlers (specifically handle_cfi_failure()) to over-ride
> > regs->ip.
> >
> > The callchain is such that the fixup needs to be done before it is
> > determined if the exception is fatal, as such, revert any changes in
> > that case.
> >
> > Additinoally, have handle_cfi_failure() remember the regs->ip value it
>
> typo above, if you want to tweak that in your tree.

Typing is forever hard :-)

> > starts with for reporting.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
>
> Thanks for the added comment, my future brain will appreciate it. :)
>
> Reviewed-by: Kees Cook <kees@xxxxxxxxxx>

Thanks!