0001
0002
0003
0004 #include "vmlinux.h"
0005 #include <bpf/bpf_helpers.h>
0006 #include <bpf/bpf_tracing.h>
0007
0008 extern const int bpf_prog_active __ksym;
0009
0010 SEC("fentry/security_inode_getattr")
0011 int BPF_PROG(d_path_check_rdonly_mem, struct path *path, struct kstat *stat,
0012 __u32 request_mask, unsigned int query_flags)
0013 {
0014 void *active;
0015 __u32 cpu;
0016
0017 cpu = bpf_get_smp_processor_id();
0018 active = (void *)bpf_per_cpu_ptr(&bpf_prog_active, cpu);
0019 if (active) {
0020
0021
0022
0023 bpf_d_path(path, active, sizeof(int));
0024 }
0025 return 0;
0026 }
0027
0028 char _license[] SEC("license") = "GPL";