aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/rcu_read_lock.c
diff options
context:
space:
mode:
authorYonghong Song <[email protected]>2022-12-13 01:22:24 +0000
committerDaniel Borkmann <[email protected]>2022-12-14 17:35:41 +0000
commitec9230b18b45853287298d70be23f8ec6bd44ff0 (patch)
treea2f7eda597197a8cb91909a34832c35c80b5f5e4 /tools/testing/selftests/bpf/progs/rcu_read_lock.c
parentdocs/bpf: Reword docs for BPF_MAP_TYPE_SK_STORAGE (diff)
downloadkernel-ec9230b18b45853287298d70be23f8ec6bd44ff0.tar.gz
kernel-ec9230b18b45853287298d70be23f8ec6bd44ff0.zip
selftests/bpf: Fix a selftest compilation error with CONFIG_SMP=n
Kernel test robot reported bpf selftest build failure when CONFIG_SMP is not set. The error message looks below: >> progs/rcu_read_lock.c:256:34: error: no member named 'last_wakee' in 'struct task_struct' last_wakee = task->real_parent->last_wakee; ~~~~~~~~~~~~~~~~~ ^ 1 error generated. When CONFIG_SMP is not set, the field 'last_wakee' is not available in struct 'task_struct'. Hence the above compilation failure. To fix the issue, let us choose another field 'group_leader' which is available regardless of CONFIG_SMP set or not. Fixes: fe147956fca4 ("bpf/selftests: Add selftests for new task kfuncs") Fixes: 48671232fcb8 ("selftests/bpf: Add tests for bpf_rcu_read_lock()") Reported-by: kernel test robot <[email protected]> Signed-off-by: David Vernet <[email protected]> Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: David Vernet <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/progs/rcu_read_lock.c')
-rw-r--r--tools/testing/selftests/bpf/progs/rcu_read_lock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/progs/rcu_read_lock.c b/tools/testing/selftests/bpf/progs/rcu_read_lock.c
index 125f908024d3..5cecbdbbb16e 100644
--- a/tools/testing/selftests/bpf/progs/rcu_read_lock.c
+++ b/tools/testing/selftests/bpf/progs/rcu_read_lock.c
@@ -288,13 +288,13 @@ out:
SEC("?fentry.s/" SYS_PREFIX "sys_getpgid")
int task_untrusted_non_rcuptr(void *ctx)
{
- struct task_struct *task, *last_wakee;
+ struct task_struct *task, *group_leader;
task = bpf_get_current_task_btf();
bpf_rcu_read_lock();
- /* the pointer last_wakee marked as untrusted */
- last_wakee = task->real_parent->last_wakee;
- (void)bpf_task_storage_get(&map_a, last_wakee, 0, 0);
+ /* the pointer group_leader marked as untrusted */
+ group_leader = task->real_parent->group_leader;
+ (void)bpf_task_storage_get(&map_a, group_leader, 0, 0);
bpf_rcu_read_unlock();
return 0;
}