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

From: Sami Tolvanen
Date: Mon May 16 2022 - 14:57:59 EST


On Sat, May 14, 2022 at 3:03 PM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> On Fri, May 13, 2022 at 01:21:58PM -0700, Sami Tolvanen wrote:
> > +#ifdef CONFIG_CFI_CLANG
> > +static void decode_cfi_insn(struct pt_regs *regs, unsigned long *target,
> > + unsigned long *type)
> > +{
> > + char buffer[MAX_INSN_SIZE];
> > + struct insn insn;
> > + int offset;
> > +
> > + *target = *type = 0;
>
> Should report_cfi_failure() have some additional hinting for the case
> where target/type are zero? Like, "hey, got an inexplicable CFI failure
> here, but preamble decode failed. Yikes!"

Good point, I'll add an error message here.

Sami