Skip to content

bpf: refine retval for bpf_get_task_stack helper

Dave Marchevsky bpf 2 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. v2 Latest3 patches 1 replyApplied
  2. v13 patches 3 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3bpf: refine retval for bpf_get_task_stack helperkernel/bpf/verifier.c+1 -00 replies
2/3bpf/selftests: add bpf_get_task_stack retval bounds verifier testtools/testing/selftests/bpf/verifier/bpf_get_stack.c+43 -00 replies
3/3bpf/selftests: add bpf_get_task_stack retval bounds test_progtools/testing/selftests/bpf/prog_tests/bpf_iter.c tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c+28 -00 replies

Reviews trailers per patch

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

PatchSong Liu
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 v2 thread

Cover letter [PATCH bpf-next v2 0/3] bpf: refine retval for bpf_get_task_stack helper

Similarly to the bpf_get_stack helper, bpf_get_task_stack's return value can be more tightly bound by the verifier - it's the number of bytes written to a user-supplied buffer, or a negative error value. Currently the verifier believes bpf_task_get_stack's retval bounds to be unknown, requiring extraneous bounds checking to remedy.

Adding it to do_refine_retval_range fixes the issue, as evidenced by new selftests which fail to load if retval bounds are not refined.

v2: Addressed comment nit in patch 3

Dave Marchevsky (3):
bpf: refine retval for bpf_get_task_stack helper bpf/selftests: add bpf_get_task_stack retval bounds verifier test bpf/selftests: add bpf_get_task_stack retval bounds test_prog

 kernel/bpf/verifier.c                         |  1 +
 .../selftests/bpf/prog_tests/bpf_iter.c       |  1 +
 .../selftests/bpf/progs/bpf_iter_task_stack.c | 27 ++++++++++++
 .../selftests/bpf/verifier/bpf_get_stack.c    | 43 +++++++++++++++++++
 4 files changed, 72 insertions(+)
Signature · 1 line
2.30.2