Re: [PATCH v2 2/2] x86/kprobes: Prohibit probing on compiler generated CFI checking code

From: Google
Date: Wed Jul 26 2023 - 20:40:23 EST


On Wed, 26 Jul 2023 11:29:17 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Wed, Jul 26, 2023 at 12:23:17PM +0900, Masami Hiramatsu wrote:
> > On Tue, 11 Jul 2023 10:50:58 +0900
> > "Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote:
> >
> > > From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> > >
> > > Prohibit probing on the compiler generated CFI typeid checking code
> > > because it is used for decoding typeid when CFI error happens.
> > >
> > > The compiler generates the following instruction sequence for indirect
> > > call checks on x86;
> > >
> > >   movl -<id>, %r10d ; 6 bytes
> > > addl -4(%reg), %r10d ; 4 bytes
> > > je .Ltmp1 ; 2 bytes
> > > ud2 ; <- regs->ip
> > >
> > > And handle_cfi_failure() decodes these instructions (movl and addl)
> > > for the typeid and the target address. Thus if we put a kprobe on
> > > those instructions, the decode will fail and report a wrong typeid
> > > and target address.
> > >
> > >
> >
> > Hi Peter,
> >
> > Can I pick this to probes/fixes branch ?
>
> I'll stick them in tip/x86/core, that ok?

Yes, since it is for CFI change.

Thank you,

--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>