Skip to content

bpf: fix accesses to uninit stack slots

Andrei Matei bpf 4 versions – Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 2 repliesApplied 3/3
  2. v43 patches 3 repliesSuperseded
  3. v33 patches 8 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v22 patches11 repliesSuperseded

Changes in v5 from the cover letter

- target bpf-next (Alexei)

Patches in v5 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: add some comments to stack representationinclude/linux/bpf_verifier.h+14 -01 replyApplied
2/3bpf: fix accesses to uninit stack slotskernel/bpf/verifier.c tools/testing/selftests/bpf/progs/iters.c tools/testing/selftests/bpf/progs/test_global_func16.c +6 more+92 -720 repliesApplied
3/3bpf: minor cleanup around stack boundskernel/bpf/verifier.c+9 -21 replyApplied

Reviews trailers per patch

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

PatchAndrii NakryikoEduard Zingerman
1/3A-b
2/3A-b
3/3A-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/3] bpf: fix accesses to uninit stack slots

Fix two related issues issues around verifying stack accesses:
1. accesses to uninitialized stack memory was allowed inconsistently
2. the maximum stack depth needed for a program was not always maintained correctly

The two issues are fixed together in one commit because the code for one affects the other.

V4 to V5:
- target bpf-next (Alexei)

V3 to V4:
- minor fixup to comment in patch 1 (Eduard)
- C89-style in patch 3 (Andrii)

V2 to V3:
- address review comments from Andrii and Eduard
- drop new verifier tests in favor of editing existing tests to check for stack depth
- append a patch with a bit of cleanup coming out of the previous review

Andrei Matei (3):
bpf: add some comments to stack representation
bpf: fix accesses to uninit stack slots
bpf: minor cleanup around stack bounds

 include/linux/bpf_verifier.h                  | 14 ++++
 kernel/bpf/verifier.c                         | 76 +++++++++----------
 tools/testing/selftests/bpf/progs/iters.c     |  2 +-
 .../selftests/bpf/progs/test_global_func16.c  |  2 +-
 .../bpf/progs/verifier_basic_stack.c          |  8 +-
 .../selftests/bpf/progs/verifier_int_ptr.c    |  5 +-
 .../selftests/bpf/progs/verifier_raw_stack.c  |  5 +-
 .../selftests/bpf/progs/verifier_var_off.c    | 62 ++++++++++++---
 .../selftests/bpf/verifier/atomic_cmpxchg.c   | 11 ---
 tools/testing/selftests/bpf/verifier/calls.c  |  4 +-
 10 files changed, 115 insertions(+), 74 deletions(-)
Signature · 1 line
2.40.1