summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/linked_funcs2.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2022-04-26 15:41:47 -0700
committerAlexei Starovoitov <ast@kernel.org>2022-04-26 15:41:47 -0700
commitd54d06a4c4bc5d76815d02e4b041b31d9dbb3fef (patch)
treeeca090cff5cfac9246469b566e722fe81932e4f9 /tools/testing/selftests/bpf/progs/linked_funcs2.c
parentc317ab71facc2cd0a94145973318a4c914e11acc (diff)
parentea4128eb43eb3fe856831eaa9f747fab350ed5f3 (diff)
Merge branch 'Teach libbpf to "fix up" BPF verifier log'
Andrii Nakryiko says: ==================== This patch set teaches libbpf to enhance BPF verifier log with human-readable and relevant information about failed CO-RE relocation. Patch #9 is the main one with the new logic. See relevant commit messages for some more details. All the other patches are either fixing various bugs detected while working on this feature, most prominently a bug with libbpf not handling CO-RE relocations for SEC("?...") programs, or are refactoring libbpf internals to allow for easier reuse of CO-RE relo lookup and formatting logic. ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/linked_funcs2.c')
-rw-r--r--tools/testing/selftests/bpf/progs/linked_funcs2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/progs/linked_funcs2.c b/tools/testing/selftests/bpf/progs/linked_funcs2.c
index db195872f4eb..ee7e3848ee4f 100644
--- a/tools/testing/selftests/bpf/progs/linked_funcs2.c
+++ b/tools/testing/selftests/bpf/progs/linked_funcs2.c
@@ -61,12 +61,17 @@ extern int set_output_val1(int x);
/* here we'll force set_output_ctx1() to be __hidden in the final obj file */
__hidden extern void set_output_ctx1(__u64 *ctx);
-SEC("raw_tp/sys_enter")
+SEC("?raw_tp/sys_enter")
int BPF_PROG(handler2, struct pt_regs *regs, long id)
{
+ static volatile int whatever;
+
if (my_tid != (u32)bpf_get_current_pid_tgid() || id != syscall_id)
return 0;
+ /* make sure we have CO-RE relocations in main program */
+ whatever = bpf_core_type_size(struct task_struct);
+
set_output_val1(2000);
set_output_ctx1(ctx); /* ctx definition is hidden in BPF_PROG macro */