summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_global_func7.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2020-01-10 17:20:07 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2020-01-10 17:20:19 +0100
commit7a2d070f91db83a1e08bf212e8f6a34d852efb7f (patch)
tree29f80d80eff2526f251e5def34a8b7eb870b0504 /tools/testing/selftests/bpf/progs/test_global_func7.c
parentf41aa387a7896c193b384c5fb531cd2cb9e00128 (diff)
parent360301a6c21be87fe881546bd5f22eccf7a165c5 (diff)
Merge branch 'bpf-global-funcs'
Alexei Starovoitov says: ==================== Introduce static vs global functions and function by function verification. This is another step toward dynamic re-linking (or replacement) of global functions. See patch 2 for details. v2->v3: - cleaned up a check spotted by Song. - rebased and dropped patch 2 that was trying to improve BTF based on ELF. - added one more unit test for scalar return value from global func. v1->v2: - addressed review comments from Song, Andrii, Yonghong - fixed memory leak in error path - added modified ctx check - added more tests in patch 7 ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_global_func7.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_global_func7.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_global_func7.c b/tools/testing/selftests/bpf/progs/test_global_func7.c
new file mode 100644
index 000000000000..ff98d93916fd
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/test_global_func7.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (c) 2020 Facebook */
+#include <stddef.h>
+#include <linux/bpf.h>
+#include "bpf_helpers.h"
+
+__attribute__ ((noinline))
+void foo(struct __sk_buff *skb)
+{
+ skb->tc_index = 0;
+}
+
+SEC("classifier/test")
+int test_cls(struct __sk_buff *skb)
+{
+ foo(skb);
+ return 0;
+}