Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/bpf.h>
0003 #include <bpf/bpf_helpers.h>
0004 #include <bpf/bpf_tracing.h>
0005 
0006 int val = 0;
0007 
0008 SEC("fentry/test_1")
0009 int BPF_PROG(fentry_test_1, __u64 *st_ops_ctx)
0010 {
0011     __u64 state;
0012 
0013     /* Read the traced st_ops arg1 which is a pointer */
0014     bpf_probe_read_kernel(&state, sizeof(__u64), (void *)st_ops_ctx);
0015     /* Read state->val */
0016     bpf_probe_read_kernel(&val, sizeof(__u32), (void *)state);
0017 
0018     return 0;
0019 }
0020 
0021 char _license[] SEC("license") = "GPL";