Skip to content

Support kCFI + BPF on arm64

Sami Tolvanen bpf linux-arm-kernel lkml 7 versions – Applied

Status from this message: This series was applied to bpf/bpf.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v14 Latest3 patches 0 repliesApplied 3/3
  2. v133 patches 2 repliesSuperseded
  3. v123 patches 3 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v113 patches1 replySuperseded
v103 patches4 repliesSuperseded
v92 patches4 repliesSuperseded
v82 patches4 repliesSuperseded

Changes in v14 from the cover letter

- Rebased to fix a merge conflict.

Patches in v14 All 3 applied

#Subject and filesSizeRepliesApplied
1/3cfi: add C CFI type macroarch/riscv/kernel/cfi.c arch/x86/kernel/alternative.c include/linux/cfi_types.h+29 -600 repliesApplied
2/3cfi: Move BPF CFI types and helpers to generic codearch/riscv/include/asm/cfi.h arch/riscv/kernel/cfi.c arch/x86/include/asm/cfi.h +3 more+56 -680 repliesApplied
3/3arm64/cfi,bpf: Support kCFI + BPF on arm64arch/arm64/include/asm/cfi.h arch/arm64/net/bpf_jit_comp.c+34 -30 repliesApplied

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchDao HuangWill Deacon
1/3T-b A-b
2/3
3/3T-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v14 thread

Cover letter [PATCH bpf-next v14 0/3] Support kCFI + BPF on arm64

Hi folks,

These patches add KCFI types to arm64 BPF JIT output. Puranjay and Maxwell have been working on this for some time now, but I haven't seen any progress since June 2024, so I decided to pick up the latest version[1] posted by Maxwell and fix the few remaining issues I noticed. I confirmed that with these patches applied, I no longer see CFI failures in jitted code when running BPF self-tests on arm64.

[1] https://lore.kernel.org/linux-arm-kernel/ptrugmna4xb5o5lo4xislf4rlz7avdmd4pfho5fjwtjj7v422u@iqrwfrbwuxrq/

Sami

---
v14:
- Rebased to fix a merge conflict.

v13: https://lore.kernel.org/bpf/[email protected]/
- Added emit_u32_data to fix type hashes on big-endian systems based on Xu's suggestion.

v12: https://lore.kernel.org/bpf/[email protected]/
- Fixed sparse warnings and 32-bit ARM build errors.

v11: https://lore.kernel.org/bpf/[email protected]/
- Moved cfi_get_func_hash to a static inline with an ifdef guard.
- Picked by Will's Acked-by tags.

v10: https://lore.kernel.org/bpf/[email protected]/
- Rebased to bpf-next/master again.
- Added a patch to moved duplicate type hash variables and helper functions to common CFI code.

v9: https://lore.kernel.org/bpf/[email protected]/
- Rebased to bpf-next/master to fix merge x86 merge conflicts.
- Fixed checkpatch warnings about Co-developed-by tags and including <asm/cfi.h>.
- Picked up Tested-by tags.

v8: https://lore.kernel.org/bpf/[email protected]/
- Changed DEFINE_CFI_TYPE to use .4byte to match __CFI_TYPE.
- Changed cfi_get_func_hash() to again use get_kernel_nofault().
- Fixed a panic in bpf_jit_free() by resetting prog->bpf_func before calling bpf_jit_binary_pack_hdr().

---
Mark Rutland (1):
cfi: add C CFI type macro

Puranjay Mohan (1):
arm64/cfi,bpf: Support kCFI + BPF on arm64

Sami Tolvanen (1):
cfi: Move BPF CFI types and helpers to generic code

 arch/arm64/include/asm/cfi.h  |  7 +++++
 arch/arm64/net/bpf_jit_comp.c | 30 ++++++++++++++++++--
 arch/riscv/include/asm/cfi.h  | 16 -----------
 arch/riscv/kernel/cfi.c       | 53 -----------------------------------
 arch/x86/include/asm/cfi.h    | 10 ++-----
 arch/x86/kernel/alternative.c | 37 ------------------------
 include/linux/cfi.h           | 47 +++++++++++++++++++++++++------
 include/linux/cfi_types.h     | 23 +++++++++++++++
 kernel/cfi.c                  | 15 ++++++++++
 9 files changed, 113 insertions(+), 125 deletions(-)
 create mode 100644 arch/arm64/include/asm/cfi.h

base-commit: e8d780dcd957d80725ad5dd00bab53b856429bc0

Signature · 1 line
2.50.1.565.gc32cd1483b-goog