Add a test case to verify the fix for "prog->aux->dst_trampoline and tgt_prog is NULL" branch in bpf_tracing_prog_attach. The sequence of events: 1. load rawtp program 2. load fentry program with rawtp as target_fd 3. create tracing link for fentry program with target_fd = 0 4. repeat 3 Acked-by: Jiri Olsa <olsajiri@gmail.com> Acked-by: Song Liu <song@kernel.org> Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com> Link: https://lore.kernel.org/r/20240103190559.14750-5-9erthalion6@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
25 lines
578 B
C
25 lines
578 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Copyright (c) 2023 Red Hat, Inc. */
|
|
#include <linux/bpf.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
#include <bpf/bpf_tracing.h>
|
|
|
|
char _license[] SEC("license") = "GPL";
|
|
|
|
/* Dummy fentry bpf prog for testing fentry attachment chains. It's going to be
|
|
* a start of the chain.
|
|
*/
|
|
SEC("fentry/bpf_testmod_fentry_test1")
|
|
int BPF_PROG(test1, int a)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/* Dummy bpf prog for testing attach_btf presence when attaching an fentry
|
|
* program.
|
|
*/
|
|
SEC("raw_tp/sys_enter")
|
|
int BPF_PROG(fentry_target, struct pt_regs *regs, long id)
|
|
{
|
|
return 0;
|
|
}
|