Skip to content

Misc bug fixes - part 5

Kumar Kartikeya Dwivedi bpf 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. v7 Latest10 patches 0 repliesApplied 10/10
  2. v610 patches 0 repliesSuperseded
  3. v510 patches 3 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v411 patches8 repliesSuperseded
v37 patches10 repliesSuperseded
v27 patches8 repliesSuperseded
v18 patches2 repliesSuperseded

Changes in v7 from the cover letter

v6: https://lore.kernel.org/bpf/[email protected]

* Correct the trailing ldimm64 rationale and exercise the early guard with CO-RE metadata. (BPF CI)
* Keep the relocation-ordering regression causal after target hardening. (BPF CI)
* Document the raw BTF access-string offset and PTR_TO_INSN map pointer. (BPF CI)

Patches in v7 All 10 applied

#Subject and filesSizeRepliesApplied
1/10bpf: Make post-verification instruction rewrites killablekernel/bpf/core.c kernel/bpf/fixups.c+39 -60 repliesApplied
2/10bpf: Preserve packet pointer class displacement in regsafe()kernel/bpf/states.c+3 -00 repliesApplied
3/10selftests/bpf: Test packet pointer class displacement pruningtools/testing/selftests/bpf/progs/verifier_xdp_direct_packet_access.c+35 -00 repliesApplied
4/10bpf: Apply CO-RE relocations before subprogram validationinclude/linux/bpf_verifier.h kernel/bpf/check_btf.c kernel/bpf/verifier.c+17 -90 repliesApplied
5/10selftests/bpf: Test early in-kernel CO-RE relocationtools/testing/selftests/bpf/prog_tests/core_reloc_raw.c+133 -00 repliesApplied
6/10bpf: Restrict CO-RE poisoning to relocatable instructionstools/lib/bpf/relo_core.c+31 -270 repliesApplied
7/10selftests/bpf: Test CO-RE instruction poisoning restrictionstools/testing/selftests/bpf/prog_tests/core_reloc_raw.c+60 -10 repliesApplied
8/10bpf: Assign lock identity to callback map valuesinclude/linux/bpf_verifier.h kernel/bpf/states.c kernel/bpf/verifier.c+26 -180 repliesApplied
9/10selftests/bpf: Check callback map value lock identitytools/testing/selftests/bpf/prog_tests/cb_refs.c tools/testing/selftests/bpf/prog_tests/spin_lock.c tools/testing/selftests/bpf/progs/test_spin_lock_fail.c+68 -30 repliesApplied
10/10libbpf: Reject truncated ldimm64 CO-RE relocationstools/lib/bpf/libbpf.c+7 -00 repliesApplied

Reviews trailers per patch

7 of 10 patches have a Reviewed-by or Acked-by.

PatchEduard Zingerman
1/10A-b
2/10A-b
3/10
4/10A-b
5/10A-b
6/10A-b
7/10A-b
8/10A-b
9/10
10/10

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

Read the v7 thread

Cover letter [PATCH bpf v7 00/10] Misc bug fixes - part 5

A set of miscellaneous fixes for bugs reported by Nicholas. See commit logs for details.

Changelog:
----------
v6 -> v7
v6: https://lore.kernel.org/bpf/[email protected]

* Correct the trailing ldimm64 rationale and exercise the early guard with CO-RE metadata. (BPF CI)
* Keep the relocation-ordering regression causal after target hardening. (BPF CI)
* Document the raw BTF access-string offset and PTR_TO_INSN map pointer. (BPF CI)

v5 -> v6
v5: https://lore.kernel.org/bpf/[email protected]

* Rebase on bpf/master.

v4 -> v5
v4: https://lore.kernel.org/bpf/[email protected]

* Reject a terminal ldimm64 before in-kernel CO-RE relocation and add focused verifier coverage. (Eduard)
* Bound truncated ldimm64 relocations in libbpf's relocation loop and retain resolved and unresolved regression coverage. (Eduard, BPF CI)
* Encode the early CO-RE test BTF with the BTF_* helpers and fold the standalone follow-up into its owning patch. (Eduard)
* Use one fixed instruction stream for CO-RE poison tests without a conditional program length. (Eduard)
* Drop final selftest commit.
* Trim callback lock identity selftests to the mismatched-value cases. (Eduard)

v3 -> v4
v3: https://lore.kernel.org/bpf/[email protected]

* Return interrupted main-program JIT compilation through ERR_PTR() instead of an output parameter. (Eduard)
* Apply in-kernel CO-RE relocations before subprogram discovery and validation, while keeping func_info and line_info validation after layout discovery. (Andrii, Alexei)
* Keep relocation-target hardening as a separate patch and diagnose invalid register-source ALU targets. (Alexei, Eduard, BPF CI)
* Extract CO-RE poisoning into a returning helper so validated instruction cases can propagate its status directly. (Andrii)
* Restore the existing inner-map UID comment wording. (Eduard)
* Add bounds checking and selftests for truncated ldimm64 CO-RE relocations. (Sashiko)

v2 -> v3
v2: https://lore.kernel.org/bpf/[email protected]

* Propagate cancellation from constant blinding through both JIT fallback paths instead of rechecking fatal signals in bpf_check(). (Eduard)
* Preserve packet-pointer displacement by comparing range bases, without extending the generic ID map. Veristat showed identical verdicts and successful-program instruction/state counts across 2773 loads. (Eduard, Alexei)
* Reduce the packet pruning regression to 20 instructions and force state checkpoints. (Alexei, BPF CI)
* Reject unsupported CO-RE poisoning targets in the shared relocation code instead of adding a CFG fall-through check. (Alexei)
* Cover unsupported poison targets and supported relocations in dead code, including both halves of ldimm64.
* Assign callback value IDs unconditionally and compare inner-map lookup IDs through check_ids(); explain the bug with a small program. (Eduard)
* Move map_uid beside the other IDs and shrink frameno to preserve the register state size, keeping the existing memcmp() ranges.
* Consolidate callback tests into the existing spinlock tests and reuse their map fixtures. Retain one-element and nested locking controls, and check nonzero IDs in timer, workqueue, and task-work callbacks. Clarify the inner-map lookup test description. (BPF CI)

v1 -> v2
v1: https://lore.kernel.org/bpf/[email protected]

* Address inner map corner case for callback map value patch.
* Drop patch 2 since the test can be flaky.

Kumar Kartikeya Dwivedi (10):
bpf: Make post-verification instruction rewrites killable
bpf: Preserve packet pointer class displacement in regsafe() selftests/bpf: Test packet pointer class displacement pruning
bpf: Apply CO-RE relocations before subprogram validation selftests/bpf: Test early in-kernel CO-RE relocation
bpf: Restrict CO-RE poisoning to relocatable instructions selftests/bpf: Test CO-RE instruction poisoning restrictions
bpf: Assign lock identity to callback map values selftests/bpf: Check callback map value lock identity
libbpf: Reject truncated ldimm64 CO-RE relocations

 include/linux/bpf_verifier.h                  |  27 +--
 kernel/bpf/check_btf.c                        |  12 +-
 kernel/bpf/core.c                             |  21 +-
 kernel/bpf/fixups.c                           |  24 ++-
 kernel/bpf/states.c                           |   9 +-
 kernel/bpf/verifier.c                         |  25 ++-
 tools/lib/bpf/libbpf.c                        |   7 +
 tools/lib/bpf/relo_core.c                     |  58 +++---
 .../selftests/bpf/prog_tests/cb_refs.c        |   2 +-
 .../selftests/bpf/prog_tests/core_reloc_raw.c | 192 ++++++++++++++++++
 .../selftests/bpf/prog_tests/spin_lock.c      |   2 +
 .../selftests/bpf/progs/test_spin_lock_fail.c |  67 +++++-
 .../progs/verifier_xdp_direct_packet_access.c |  35 ++++
 13 files changed, 418 insertions(+), 63 deletions(-)

base-commit: 8d9eae69170e6d780da07408fc6471f877cf65e5

Signature · 1 line
2.53.0