public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] x86/cfi,bpf: Fix CFI vs eBPF
@ 2023-12-15  9:12 Peter Zijlstra
  2023-12-15  9:12 ` [PATCH v3 1/7] cfi: Flip headers Peter Zijlstra
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Peter Zijlstra @ 2023-12-15  9:12 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: paul.walmsley, palmer, aou, tglx, mingo, bp, dave.hansen, x86,
	hpa, davem, dsahern, daniel, andrii, martin.lau, song,
	yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
	Arnd Bergmann, samitolvanen, keescook, nathan, ndesaulniers,
	linux-riscv, linux-kernel, netdev, bpf, linux-arch, llvm,
	jpoimboe, joao, mark.rutland, peterz

Hi!

What started with the simple observation that bpf_dispatcher_*_func() was
broken for calling CFI functions with a __nocfi calling context for FineIBT
ended up with a complete BPF wide CFI fixup.

With these changes on the BPF selftest suite passes without crashing -- there's
still a few failures, but Alexei has graciously offered to look into those.

(Alexei, I have presumed your SoB on the very last patch, please update
as you see fit)

Changes since v2 are numerous but include:
 - cfi_get_offset() -- as a means to communicate the offset (ast)
 - 5 new patches fixing various BPF internals to be CFI clean

Note: it *might* be possible to merge the
bpf_bpf_tcp_ca.c:unsupported_ops[] thing into the CFI stubs, as is
get_info will have a NULL stub, unlike the others.

---
 arch/riscv/include/asm/cfi.h   |   3 +-
 arch/riscv/kernel/cfi.c        |   2 +-
 arch/x86/include/asm/cfi.h     | 126 +++++++++++++++++++++++++++++++++++++-
 arch/x86/kernel/alternative.c  |  87 +++++++++++++++++++++++---
 arch/x86/kernel/cfi.c          |   4 +-
 arch/x86/net/bpf_jit_comp.c    | 134 +++++++++++++++++++++++++++++++++++------
 include/asm-generic/Kbuild     |   1 +
 include/linux/bpf.h            |  27 ++++++++-
 include/linux/cfi.h            |  12 ++++
 kernel/bpf/bpf_struct_ops.c    |  16 ++---
 kernel/bpf/core.c              |  25 ++++++++
 kernel/bpf/cpumask.c           |   8 ++-
 kernel/bpf/helpers.c           |  18 +++++-
 net/bpf/bpf_dummy_struct_ops.c |  31 +++++++++-
 net/bpf/test_run.c             |  15 ++++-
 net/ipv4/bpf_tcp_ca.c          |  69 +++++++++++++++++++++
 16 files changed, 528 insertions(+), 50 deletions(-)


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

end of thread, other threads:[~2023-12-16  0:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-15  9:12 [PATCH v3 0/7] x86/cfi,bpf: Fix CFI vs eBPF Peter Zijlstra
2023-12-15  9:12 ` [PATCH v3 1/7] cfi: Flip headers Peter Zijlstra
2023-12-15  9:12 ` [PATCH v3 2/7] x86/cfi,bpf: Fix BPF JIT call Peter Zijlstra
2023-12-15  9:12 ` [PATCH v3 3/7] x86/cfi,bpf: Fix bpf_callback_t CFI Peter Zijlstra
2023-12-15  9:12 ` [PATCH v3 4/7] x86/cfi,bpf: Fix bpf_struct_ops CFI Peter Zijlstra
2023-12-15  9:12 ` [PATCH v3 5/7] cfi: Add CFI_NOSEAL() Peter Zijlstra
2023-12-15  9:12 ` [PATCH v3 6/7] bpf: Fix dtor CFI Peter Zijlstra
2023-12-15  9:12 ` [PATCH v3 7/7] x86/cfi,bpf: Fix bpf_exception_cb() signature Peter Zijlstra
2023-12-16  0:50 ` [PATCH v3 0/7] x86/cfi,bpf: Fix CFI vs eBPF patchwork-bot+netdevbpf
2023-12-16  0:53 ` Alexei Starovoitov

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