On Fri, Dec 11, 2020 at 04:04:17PM +0900, Masami Hiramatsu wrote:
> Fix optprobe to detect padding int3 correctly.
>
> Since commit 7705dc855797 ("x86/vmlinux: Use INT3 instead of NOP
> for linker fill bytes") changed the padding bytes between functions
> from nop to int3, when optprobe decodes a target function it finds
> int3 and gives up the jump optimization.
>
> Instead of giving up any int3 detection, this checks whether the
> rest of bytes to the end of the function are int3 or not. If all
> of those are int3, those come from the linker. In that case,
> optprobe continues jump optimization.
>
> Fixes: 7705dc855797 ("x86/vmlinux: Use INT3 instead of NOP for linker fill
> bytes")
> Cc: [email protected]
> Reported-by: Adam Zabrocki <[email protected]>
> Signed-off-by: Masami Hiramatsu <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
--
Kees Cook