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

From: Kees Cook
Date: Mon Feb 24 2025 - 14:00:34 EST


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.

> 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>

--
Kees Cook