blob: 575a9b7910c8c5c4599b9d05f41fcec992c85c27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// SPDX-License-Identifier: GPL-2.0
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL";
__u32 monitored_tid;
int sig_keyring_serial;
int sig_keyring_type;
int sig_verdict;
int seen;
SEC("lsm/bpf_prog_load")
int BPF_PROG(inspect_prog_load, struct bpf_prog *prog, union bpf_attr *attr,
struct bpf_token *token, bool kernel)
{
__u32 tid = bpf_get_current_pid_tgid() & 0xffffffff;
if (!monitored_tid || tid != monitored_tid)
return 0;
seen++;
sig_keyring_serial = prog->aux->sig.keyring_serial;
sig_keyring_type = prog->aux->sig.keyring_type;
sig_verdict = prog->aux->sig.verdict;
return 0;
}
|