Re: [PATCH v2 07/39] x86/cet: Add user control-protection fault handler

From: Edgecombe, Rick P
Date: Mon Oct 03 2022 - 14:12:38 EST


On Mon, 2022-10-03 at 17:01 +0300, Kirill A . Shutemov wrote:
> On Thu, Sep 29, 2022 at 03:29:04PM -0700, Rick Edgecombe wrote:
> > +#else
> > +static void do_user_control_protection_fault(struct pt_regs *regs,
> > + unsigned long
> > error_code)
> > +{
> > + WARN_ONCE(1, "User-mode control protection fault with shadow
> > support disabled\n");
>
> Why is this a warning, but runtime check for !X86_FEATURE_IBT and
> !X86_FEATURE_SHSTK below is fatal?

It was a BUG() in the original KERNEL_IBT focused handler IIRC. There
seems to be some renewed effort to stop doing those:

https://lore.kernel.org/all/20220923113426.52871-2-david@xxxxxxxxxx/T/#u

...so I'll change it to a WARN for this. In the kernel specific portion
of the handler, it also does a BUG on endbranch violation. I'll leave
that one for this change.