Re: [PATCH 09/14] x86/ibt: Implement IBT+
From: Alexei Starovoitov
Date: Sun Sep 29 2024 - 13:39:21 EST
On Fri, Sep 27, 2024 at 12:50 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> --- a/arch/x86/net/bpf_jit_comp.c
> +++ b/arch/x86/net/bpf_jit_comp.c
> @@ -555,6 +555,8 @@ static int emit_patch(u8 **pprog, void *
>
> static int emit_call(u8 **pprog, void *func, void *ip)
> {
> + if (is_endbr(func))
> + func += ENDBR_INSN_SIZE;
> return emit_patch(pprog, func, ip, 0xE8);
> }
>
> @@ -562,11 +564,13 @@ static int emit_rsb_call(u8 **pprog, voi
> {
> OPTIMIZER_HIDE_VAR(func);
> ip += x86_call_depth_emit_accounting(pprog, func, ip);
> - return emit_patch(pprog, func, ip, 0xE8);
> + return emit_call(pprog, func, ip);
> }
>
> static int emit_jump(u8 **pprog, void *func, void *ip)
> {
> + if (is_endbr(func))
> + func += ENDBR_INSN_SIZE;
> return emit_patch(pprog, func, ip, 0xE9);
> }
Makes sense, but it feels like it's fixing the existing bug
that we somehow didn't notice earlier?