Messages in this thread | | | Date | Wed, 7 Sep 2022 14:59:41 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH 1/2] x86/kprobes: Fix kprobes instruction boudary check with CONFIG_RETHUNK |
| |
On Wed, Sep 07, 2022 at 09:55:21AM +0900, Masami Hiramatsu (Google) wrote: > From: Masami Hiramatsu (Google) <mhiramat@kernel.org> > > Since the CONFIG_RETHUNK and CONFIG_SLS will use INT3 for padding after > RET instruction, kprobes always failes to check the probed instruction > boundary by decoding the function body if the probed address is after > such paddings (Note that some conditional code blocks will be placed > after RET instruction, if compiler decides it is not on the hot path.) > This is because kprobes expects someone (e.g. kgdb) puts the INT3 as > a software breakpoint and it will replace the original instruction. > But There are INT3 just for padding in the function, it doesn't need > to recover the original instruction. > > To avoid this issue, if kprobe finds an INT3, it gets the address of > next non-INT3 byte, and search a branch which jumps to the address. > If there is the branch, these INT3 will be for padding, so it can be > skipped. > > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> > Suggested-by: Peter Zijlstra <peterz@infradead.org> > Fixes: 15e67227c49a ("x86: Undo return-thunk damage")
I take objection with this Fixes tag.. if anything it should be the SLS commit that predates this.
e463a09af2f0 ("x86: Add straight-line-speculation mitigation")
| |