Re: [RFC PATCH 21/21] x86: Add support for CONFIG_CFI_CLANG

From: Sami Tolvanen
Date: Mon May 02 2022 - 11:21:19 EST


On Sat, Apr 30, 2022 at 2:24 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Fri, Apr 29, 2022 at 01:36:44PM -0700, Sami Tolvanen wrote:
> > - if (report_bug(regs->ip, regs) == BUG_TRAP_TYPE_WARN) {
> > + if (report_bug(regs->ip, regs) == BUG_TRAP_TYPE_WARN ||
> > + report_cfi(regs->ip, regs) == BUG_TRAP_TYPE_WARN) {
>
> This way you'll first get a BUG splat and then tack on the CFI thing.

The CFI ud2 isn't in the bug table, which means find_bug returns
BUG_TRAP_TYPE_NONE and report_bug bails out before printing out
anything.

Sami