From: Leon Hwang <leon.hwang@linux.dev>
To: xukuohai@huaweicloud.com
Cc: a.s.protopopov@gmail.com, alexis.lothore@bootlin.com,
andrii@kernel.org, ast@kernel.org, bjorn@kernel.org,
bpf@vger.kernel.org, chleroy@kernel.org, daniel@iogearbox.net,
davem@davemloft.net, eddyz87@gmail.com, gor@linux.ibm.com,
hbathini@linux.ibm.com, hca@linux.ibm.com, hengqi.chen@gmail.com,
iii@linux.ibm.com, johan.almbladh@anyfinetworks.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux@armlinux.org.uk,
list+bpf@vahedi.org, luke.r.nels@gmail.com, martin.lau@linux.dev,
naveen@kernel.org, paulburton@kernel.org, pulehui@huawei.com,
puranjay@kernel.org, udknight@gmail.com, xi.wang@gmail.com,
yangtiezhu@loongson.cn, yonghong.song@linux.dev,
Leon Hwang <leon.hwang@linux.dev>
Subject: Re: [PATCH bpf-next v10 4/5] bpf, x86: Emit ENDBR for indirect jump targets
Date: Wed, 25 Mar 2026 18:13:03 +0800 [thread overview]
Message-ID: <20260325101303.232060-1-leon.hwang@linux.dev> (raw)
In-Reply-To: <20260324122052.342751-5-xukuohai@huaweicloud.com>
On Tue, Mar 24, 2026 at 08:20:51PM +0800, Xu Kuohai wrote:
>From: Xu Kuohai <xukuohai@huawei.com>
>
>On CPUs that support CET/IBT, the indirect jump selftest triggers
>a kernel panic because the indirect jump targets lack ENDBR
>instructions.
>
>To fix it, emit an ENDBR instruction to each indirect jump target. Since
>the ENDBR instruction shifts the position of original jited instructions,
>fix the instruction address calculation wherever the addresses are used.
>
>For reference, below is a sample panic log.
>
> Missing ENDBR: bpf_prog_2e5f1c71c13ac3e0_big_jump_table+0x97/0xe1
> ------------[ cut here ]------------
> kernel BUG at arch/x86/kernel/cet.c:133!
> Oops: invalid opcode: 0000 [#1] SMP NOPTI
>
> ...
>
> ? 0xffffffffc00fb258
> ? bpf_prog_2e5f1c71c13ac3e0_big_jump_table+0x97/0xe1
> bpf_prog_test_run_syscall+0x110/0x2f0
> ? fdget+0xba/0xe0
> __sys_bpf+0xe4b/0x2590
> ? __kmalloc_node_track_caller_noprof+0x1c7/0x680
> ? bpf_prog_test_run_syscall+0x215/0x2f0
> __x64_sys_bpf+0x21/0x30
> do_syscall_64+0x85/0x620
> ? bpf_prog_test_run_syscall+0x1e2/0x2f0
>
>Fixes: 493d9e0d6083 ("bpf, x86: add support for indirect jumps")
>Reviewed-by: Anton Protopopov <a.s.protopopov@gmail.com>
>Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
[...]
next prev parent reply other threads:[~2026-03-25 10:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 12:20 [PATCH bpf-next v10 0/5] emit ENDBR/BTI instructions for indirect jump targets Xu Kuohai
2026-03-24 12:20 ` [PATCH bpf-next v10 1/5] bpf: Move constants blinding out of arch-specific JITs Xu Kuohai
2026-03-24 12:46 ` bot+bpf-ci
2026-03-25 7:47 ` Xu Kuohai
2026-03-25 15:12 ` Alexei Starovoitov
2026-03-24 12:20 ` [PATCH bpf-next v10 2/5] bpf: Pass bpf_verifier_env to JIT Xu Kuohai
2026-03-24 12:20 ` [PATCH bpf-next v10 3/5] bpf: Add helper to detect indirect jump targets Xu Kuohai
2026-03-24 12:20 ` [PATCH bpf-next v10 4/5] bpf, x86: Emit ENDBR for " Xu Kuohai
2026-03-25 10:13 ` Leon Hwang [this message]
2026-03-24 12:20 ` [PATCH bpf-next v10 5/5] bpf, arm64: Emit BTI for indirect jump target Xu Kuohai
2026-03-25 10:14 ` Leon Hwang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260325101303.232060-1-leon.hwang@linux.dev \
--to=leon.hwang@linux.dev \
--cc=a.s.protopopov@gmail.com \
--cc=alexis.lothore@bootlin.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chleroy@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=gor@linux.ibm.com \
--cc=hbathini@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hengqi.chen@gmail.com \
--cc=iii@linux.ibm.com \
--cc=johan.almbladh@anyfinetworks.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=list+bpf@vahedi.org \
--cc=luke.r.nels@gmail.com \
--cc=martin.lau@linux.dev \
--cc=naveen@kernel.org \
--cc=paulburton@kernel.org \
--cc=pulehui@huawei.com \
--cc=puranjay@kernel.org \
--cc=udknight@gmail.com \
--cc=xi.wang@gmail.com \
--cc=xukuohai@huaweicloud.com \
--cc=yangtiezhu@loongson.cn \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox