1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright 2020 Google LLC.
9 #include <bpf/bpf_helpers.h>
10 #include <bpf/bpf_tracing.h>
12 long ima_hash_ret
= -1;
14 u32 monitored_pid
= 0;
16 char _license
[] SEC("license") = "GPL";
18 SEC("lsm.s/bprm_committed_creds")
19 int BPF_PROG(ima
, struct linux_binprm
*bprm
)
21 u32 pid
= bpf_get_current_pid_tgid() >> 32;
23 if (pid
== monitored_pid
)
24 ima_hash_ret
= bpf_ima_inode_hash(bprm
->file
->f_inode
,
25 &ima_hash
, sizeof(ima_hash
));