summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Marchevsky <davemarchevsky@fb.com>2021-04-16 13:47:02 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-04-19 18:23:33 -0700
commitfd0b88f73f5372c08ceff5cc7ddd8ceac502679c (patch)
tree292c4dd9e447473e3308fc67627992a41978320a
parent137733d08f4ab14a354dacaa9a8fc35217747605 (diff)
downloadlinux-fd0b88f73f5372c08ceff5cc7ddd8ceac502679c.tar.bz2
bpf: Refine retval for bpf_get_task_stack helper
Verifier can constrain the min/max bounds of bpf_get_task_stack's return value more tightly than the default tnum_unknown. Like bpf_get_stack, return value is num bytes written into a caller-supplied buf, or error, so do_refine_retval_range will work. Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20210416204704.2816874-2-davemarchevsky@fb.com
-rw-r--r--kernel/bpf/verifier.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 994ef36c5f60..58730872f7e5 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -5808,6 +5808,7 @@ static void do_refine_retval_range(struct bpf_reg_state *regs, int ret_type,
if (ret_type != RET_INTEGER ||
(func_id != BPF_FUNC_get_stack &&
+ func_id != BPF_FUNC_get_task_stack &&
func_id != BPF_FUNC_probe_read_str &&
func_id != BPF_FUNC_probe_read_kernel_str &&
func_id != BPF_FUNC_probe_read_user_str))