Thread (8 messages) 8 messages, 3 authors, 2023-07-29

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

From: Peter Zijlstra <peterz@infradead.org>
Date: 2023-07-26 19:55:08
Also in: lkml

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)" [off-list ref] wrote:
quoted
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help