[<prev] [next>] [day] [month] [year] [list]
Date: Mon, 12 Dec 2022 17:53:44 -0600
From: David Vernet <void@...ifault.com>
To: bpf@...r.kernel.org
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, song@...nel.org, yhs@...a.com,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...gle.com,
haoluo@...gle.com, jolsa@...nel.org, linux-kernel@...r.kernel.org,
kernel-team@...a.com, kernel test robot <lkp@...el.com>
Subject: [PATCH bpf-next] bpf/selftests: Use parent instead of last_wakee in task kfunc test
Commit fe147956fca4 ("bpf/selftests: Add selftests for new task kfuncs")
added a negative selftest called task_kfunc_acquire_trusted_walked which
ensures that a BPF program that gets a struct task_struct * pointer from
walking a struct is properly rejected by the verifier if it tries to
pass that pointer to a task kfunc. In order to do this, it uses
task->last_wakee, but unfortunately that's not defined on UP builds.
Just use task->parent instead.
Reported-by: kernel test robot <lkp@...el.com>
Fixes: fe147956fca4 ("bpf/selftests: Add selftests for new task kfuncs")
Signed-off-by: David Vernet <void@...ifault.com>
---
tools/testing/selftests/bpf/progs/task_kfunc_failure.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c
index 87fa1db9d9b5..60508c20041f 100644
--- a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c
+++ b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c
@@ -73,7 +73,7 @@ int BPF_PROG(task_kfunc_acquire_trusted_walked, struct task_struct *task, u64 cl
struct task_struct *acquired;
/* Can't invoke bpf_task_acquire() on a trusted pointer obtained from walking a struct. */
- acquired = bpf_task_acquire(task->last_wakee);
+ acquired = bpf_task_acquire(task->parent);
bpf_task_release(acquired);
return 0;
--
2.38.1
Powered by blists - more mailing lists