All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/3] bpf: refine retval for bpf_get_task_stack helper
@ 2021-04-16 20:47 Dave Marchevsky
  2021-04-16 20:47 ` [PATCH bpf-next v2 1/3] " Dave Marchevsky
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dave Marchevsky @ 2021-04-16 20:47 UTC (permalink / raw)
  To: bpf
  Cc: kernel-team, Alexei Starovoitov, Daniel Borkmann, Song Liu,
	Yonghong Song, Dave Marchevsky

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(+)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-20  2:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 20:47 [PATCH bpf-next v2 0/3] bpf: refine retval for bpf_get_task_stack helper Dave Marchevsky
2021-04-16 20:47 ` [PATCH bpf-next v2 1/3] " Dave Marchevsky
2021-04-16 20:47 ` [PATCH bpf-next v2 2/3] bpf/selftests: add bpf_get_task_stack retval bounds verifier test Dave Marchevsky
2021-04-16 20:47 ` [PATCH bpf-next v2 3/3] bpf/selftests: add bpf_get_task_stack retval bounds test_prog Dave Marchevsky
2021-04-20  2:20 ` [PATCH bpf-next v2 0/3] bpf: refine retval for bpf_get_task_stack helper Alexei Starovoitov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.