public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v4 0/4] emit ENDBR/BTI instructions for indirect jump targets
@ 2026-01-14  9:39 Xu Kuohai
  2026-01-14  9:39 ` [PATCH bpf-next v4 1/4] bpf: Fix an off-by-one error in check_indirect_jump Xu Kuohai
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Xu Kuohai @ 2026-01-14  9:39 UTC (permalink / raw)
  To: bpf, linux-kernel, linux-arm-kernel
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Eduard Zingerman, Yonghong Song, Puranjay Mohan,
	Anton Protopopov

From: Xu Kuohai <xukuohai@huawei.com>

On x86 CPUs with CET/IBT and arm64 CPUs with BTI, missing landing pad instructions
at indirect jump targets triggers kernel panic. So emit ENDBR instructions for
indirect jump targets on x86 and BTI on arm64. Indirect jump targets are identified
based on the insn_aux_data created by the verifier.

Patch 1 fixes an off-by-one error that causes the last ENDBR/BTI instruction to be
omitted.

Patch 2 introduces a helper to determine whether an instruction is indirect jump target.

Patches 3 and 4 emit ENDBR and BTI instructions for indirect jump targets on x86 and
arm64, respectively.

v4:
- Switch to the approach proposed by Eduard, using insn_aux_data to indentify indirect
  jump targets, and emit ENDBR on x86

v3: https://lore.kernel.org/bpf/20251227081033.240336-1-xukuohai@huaweicloud.com/
- Get rid of unnecessary enum definition (Yonghong Song, Anton Protopopov)

v2: https://lore.kernel.org/bpf/20251223085447.139301-1-xukuohai@huaweicloud.com/
- Exclude instruction arrays not used for indirect jumps (Anton Protopopov)

v1: https://lore.kernel.org/bpf/20251127140318.3944249-1-xukuohai@huaweicloud.com/

Xu Kuohai (4):
  bpf: Fix an off-by-one error in check_indirect_jump
  bpf: Add helper to detect indirect jump targets
  bpf, x86: Emit ENDBR for indirect jump targets
  bpf, arm64: Emit BTI for indirect jump target

 arch/arm64/net/bpf_jit_comp.c |  3 ++
 arch/x86/net/bpf_jit_comp.c   | 15 ++++++----
 include/linux/bpf.h           |  2 ++
 include/linux/bpf_verifier.h  | 10 ++++---
 kernel/bpf/core.c             | 51 ++++++++++++++++++++++++++++++---
 kernel/bpf/verifier.c         | 53 +++++++++++++++++++++++++++++++++--
 6 files changed, 119 insertions(+), 15 deletions(-)

-- 
2.47.3



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-01-19  2:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-14  9:39 [PATCH bpf-next v4 0/4] emit ENDBR/BTI instructions for indirect jump targets Xu Kuohai
2026-01-14  9:39 ` [PATCH bpf-next v4 1/4] bpf: Fix an off-by-one error in check_indirect_jump Xu Kuohai
2026-01-14 10:29   ` Anton Protopopov
2026-01-15  7:31     ` Xu Kuohai
2026-01-14  9:39 ` [PATCH bpf-next v4 2/4] bpf: Add helper to detect indirect jump targets Xu Kuohai
2026-01-14 11:00   ` Anton Protopopov
2026-01-15  7:37     ` Xu Kuohai
2026-01-14 20:46   ` Eduard Zingerman
2026-01-15  7:47     ` Xu Kuohai
2026-01-18 17:20       ` Alexei Starovoitov
2026-01-18 23:22         ` Kumar Kartikeya Dwivedi
2026-01-19  2:35         ` Xu Kuohai
2026-01-14  9:39 ` [PATCH bpf-next v4 3/4] bpf, x86: Emit ENDBR for " Xu Kuohai
2026-01-14 16:46   ` kernel test robot
2026-01-14  9:39 ` [PATCH bpf-next v4 4/4] bpf, arm64: Emit BTI for indirect jump target Xu Kuohai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox