aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2023-08-22 12:52:48 -0700
committerAlexei Starovoitov <ast@kernel.org>2023-08-22 12:52:48 -0700
commit87680ac7979177a34ca39b5a35a2ed94209cd20f (patch)
tree646d352f0565c43db72aeba106b44ac474d604b2 /tools
parentselftests/bpf: Add a failure test for bpf_kptr_xchg() with local kptr (diff)
parentselftests/bpf: Add test for bpf_obj_drop with bad reg->off (diff)
downloadlinux-rng-87680ac7979177a34ca39b5a35a2ed94209cd20f.tar.xz
linux-rng-87680ac7979177a34ca39b5a35a2ed94209cd20f.zip
Merge branch 'fix-for-check_func_arg_reg_off'
Kumar Kartikeya Dwivedi says: ==================== Fix for check_func_arg_reg_off Remove a leftover hunk in check_func_arg_reg_off that incorrectly bypasses reg->off == 0 requirement for release kfuncs and helpers. ==================== Link: https://lore.kernel.org/r/20230822175140.1317749-1-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/progs/local_kptr_stash_fail.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/local_kptr_stash_fail.c b/tools/testing/selftests/bpf/progs/local_kptr_stash_fail.c
index 5484d1e9801d..fcf7a7567da2 100644
--- a/tools/testing/selftests/bpf/progs/local_kptr_stash_fail.c
+++ b/tools/testing/selftests/bpf/progs/local_kptr_stash_fail.c
@@ -62,4 +62,24 @@ long stash_rb_nodes(void *ctx)
return 0;
}
+SEC("tc")
+__failure __msg("R1 must have zero offset when passed to release func")
+long drop_rb_node_off(void *ctx)
+{
+ struct map_value *mapval;
+ struct node_data *res;
+ int idx = 0;
+
+ mapval = bpf_map_lookup_elem(&some_nodes, &idx);
+ if (!mapval)
+ return 1;
+
+ res = bpf_obj_new(typeof(*res));
+ if (!res)
+ return 1;
+ /* Try releasing with graph node offset */
+ bpf_obj_drop(&res->node);
+ return 0;
+}
+
char _license[] SEC("license") = "GPL";