Re: [PATCH v2 00/13] objtool: Detect and warn about indirect calls in __nocfi functions
From: Sean Christopherson
Date: Thu May 01 2025 - 14:30:28 EST
On Thu, May 01, 2025, Peter Zijlstra wrote:
> On Thu, May 01, 2025 at 12:30:38PM +0200, Peter Zijlstra wrote:
> > On Wed, Apr 30, 2025 at 09:06:00PM +0200, Peter Zijlstra wrote:
> > > On Wed, Apr 30, 2025 at 07:24:15AM -0700, H. Peter Anvin wrote:
> > >
> > > > >KVM has another; the VMX interrupt injection stuff calls the IDT handler
> > > > >directly. Is there an alternative? Can we keep a table of Linux functions
> > > > >slighly higher up the call stack (asm_\cfunc ?) and add CFI to those?
> > >
> > > > We do have a table of handlers higher up in the stack in the form of
> > > > the dispatch tables for FRED. They don't in general even need the
> > > > assembly entry stubs, either.
> > >
> > > Oh, right. I'll go have a look at those.
> >
> > Right, so perhaps the easiest way around this is to setup the FRED entry
> > tables unconditionally, have VMX mandate CONFIG_FRED and then have it
> > always use the FRED entry points.
> >
> > Let me see how ugly that gets.
>
> Something like so... except this is broken. Its reporting spurious
> interrupts on vector 0x00, so something is buggered passing that vector
> along.
Uh, aren't you making this way more complex than it needs to be? IIUC, KVM never
uses the FRED hardware entry points, i.e. the FRED entry tables don't need to be
in place because they'll never be used. The only bits of code KVM needs is the
__fred_entry_from_kvm() glue.
Lightly tested, but this combo works for IRQs and NMIs on non-FRED hardware.
--