brintos

brintos / linux-shallow public Read only

0
0
Text · 476 B · 00a4be9 Raw
22 lines · c
1// SPDX-License-Identifier: GPL-2.02#include <linux/bpf.h>3#include <bpf/bpf_helpers.h>4#include <bpf/bpf_tracing.h>5 6int val = 0;7 8SEC("fentry/test_1")9int BPF_PROG(fentry_test_1, __u64 *st_ops_ctx)10{11	__u64 state;12 13	/* Read the traced st_ops arg1 which is a pointer */14	bpf_probe_read_kernel(&state, sizeof(__u64), (void *)st_ops_ctx);15	/* Read state->val */16	bpf_probe_read_kernel(&val, sizeof(__u32), (void *)state);17 18	return 0;19}20 21char _license[] SEC("license") = "GPL";22