summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/get_func_ip_uprobe_test.c
blob: 052f8a4345a81147fc023a88214844819e4d2c3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// SPDX-License-Identifier: GPL-2.0
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>

char _license[] SEC("license") = "GPL";

unsigned long uprobe_trigger_body;

__u64 test1_result = 0;
SEC("uprobe//proc/self/exe:uprobe_trigger_body+1")
int BPF_UPROBE(test1)
{
	__u64 addr = bpf_get_func_ip(ctx);

	test1_result = (const void *) addr == (const void *) uprobe_trigger_body + 1;
	return 0;
}