tools/testing/selftests/bpf/progs/kprobe_multi_session.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/kprobe_multi_session.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/progs/kprobe_multi_session.c
Extension
.c
Size
1986 bytes
Lines
89
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (kfuncs[i] == (void *) addr) {
			kprobe_session_result[i]++;
			break;
		}
	}

	/*
	 * Force probes for function bpf_fentry_test[5-8] not to
	 * install and execute the return probe
	 */
	if (((const void *) addr == &bpf_fentry_test5) ||
	    ((const void *) addr == &bpf_fentry_test6) ||
	    ((const void *) addr == &bpf_fentry_test7) ||
	    ((const void *) addr == &bpf_fentry_test8))
		return 1;

	return 0;
}

/*
 * No tests in here, just to trigger 'bpf_fentry_test*'
 * through tracing test_run
 */
SEC("fentry/bpf_modify_return_test")
int BPF_PROG(trigger)
{
	return 0;
}

SEC("kprobe.session/bpf_fentry_test*")
int test_kprobe(struct pt_regs *ctx)
{
	return session_check(ctx);
}

/*
 * Exact function name (no wildcards) - exercises the fast syms[] path
 * in bpf_program__attach_kprobe_multi_opts() which bypasses kallsyms parsing.
 */
SEC("kprobe.session/bpf_fentry_test1")
int test_kprobe_syms(struct pt_regs *ctx)
{
	return session_check(ctx);
}

Annotation

Implementation Notes