Skip to content

bpf: bound rdonly/rdwr_buf_size kfunc return size

Nicholas Dudar bpf sashiko-reviews 1 version 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

  1. v2 Latest2 patches 5 repliesApplied 2/2

Changes in v2 from the cover letter

* Split the fix and selftest into separate patches.
* Target bpf-next instead of bpf.

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: reject rdonly/rdwr_buf_size kfunc arguments that exceed u32 maxkernel/bpf/verifier.c+5 -04 repliesApplied
2/2selftests/bpf: add test for oversized rdonly/rdwr_buf_size kfunc argumenttools/testing/selftests/bpf/prog_tests/kfunc_call.c tools/testing/selftests/bpf/progs/kfunc_call_fail.c+34 -01 replyApplied

Reviews trailers per patch

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

PatchEduard Zingerman
1/2A-b
2/2A-b

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

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/2] bpf: bound rdonly/rdwr_buf_size kfunc return size

check_kfunc_args() stores a kfunc's rdonly_buf_size/rdwr_buf_size argument into a u64 that check_kfunc_call() later narrows into the returned register's u32 mem_size, so a value above U32_MAX truncates instead of being rejected. Fix it and add a selftest for coverage.

Changelog:
----------
v1 -> v2 (v1 was a private report to [email protected])

* Split the fix and selftest into separate patches.
* Target bpf-next instead of bpf.

Nicholas Dudar (2):
bpf: reject rdonly/rdwr_buf_size kfunc arguments that exceed u32 max selftests/bpf: add test for oversized rdonly/rdwr_buf_size kfunc
argument

 kernel/bpf/verifier.c                         |  5 +++
 .../selftests/bpf/prog_tests/kfunc_call.c     |  1 +
 .../selftests/bpf/progs/kfunc_call_fail.c     | 33 +++++++++++++++++++
 3 files changed, 39 insertions(+)

base-commit: 36ffa86c42f91c8a57071e024afc4ffb51a8958f

Signature · 1 line
2.34.1