Skip to content

bpf: fix NULL dereference during extable search

Krister Johansen bpf linux-kselftest lkml 4 versions – Applied

Status from this message: Applied. Thanks

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 1 replyApplied
  2. v42 patches 1 replySuperseded
  3. v32 patches 8 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v22 patches7 repliesSuperseded

Changes in v5 from the cover letter

- Ensure that num_exentries is copied to prog->aux from func[0] (Feedback from Ilya Leoshkevich)

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/2bpf: ensure main program has an extablekernel/bpf/verifier.c+5 -21 reply
2/2selftests/bpf: add a test for subprogram extablestools/testing/selftests/bpf/prog_tests/subprogs_extable.c tools/testing/selftests/bpf/progs/test_subprogs_extable.c+80 -00 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchYonghong SongIlya Leoshkevich
1/2A-b A-b T-b
2/2A-b

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

Read the v5 thread

Cover letter [PATCH bpf v5 0/2] bpf: fix NULL dereference during extable search

Hi,
Enclosed are a pair of patches for an oops that can occur if an exception is generated while a bpf subprogram is running. One of the bpf_prog_aux entries for the subprograms are missing an extable. This can lead to an exception that would otherwise be handled turning into a NULL pointer bug.

These changes were tested via the verifier and progs selftests and no regressions were observed.

Changes from v4:
- Ensure that num_exentries is copied to prog->aux from func[0] (Feedback from Ilya Leoshkevich)

Changes from v3:
- Selftest style fixups (Feedback from Yonghong Song)
- Selftest needs to assert that test bpf program executed (Feedback from Yonghong Song)
- Selftest should combine open and load using open_and_load (Feedback from Yonghong Song)

Changes from v2:
- Insert only the main program's kallsyms (Feedback from Yonghong Song and Alexei Starovoitov)
- Selftest should use ASSERT instead of CHECK (Feedback from Yonghong Song)
- Selftest needs some cleanup (Feedback from Yonghong Song)
- Switch patch order (Feedback from Alexei Starovoitov)

Changes from v1:
- Add a selftest (Feedback From Alexei Starovoitov)
- Move to a 1-line verifier change instead of searching multiple extables

Krister Johansen (2):
bpf: ensure main program has an extable selftests/bpf: add a test for subprogram extables

 kernel/bpf/verifier.c                         |  7 ++-
 .../bpf/prog_tests/subprogs_extable.c         | 29 +++++++++++
 .../bpf/progs/test_subprogs_extable.c         | 51 +++++++++++++++++++
 3 files changed, 85 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/subprogs_extable.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_subprogs_extable.c
Signature · 1 line
2.25.1