Commit | Line | Data |
---|---|---|
9d3fdea7 KS |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | ||
3 | /* | |
4 | * Copyright (C) 2020 Google LLC. | |
5 | */ | |
6 | ||
7 | #ifndef _LINUX_BPF_LSM_H | |
8 | #define _LINUX_BPF_LSM_H | |
9 | ||
10 | #include <linux/bpf.h> | |
11 | #include <linux/lsm_hooks.h> | |
12 | ||
13 | #ifdef CONFIG_BPF_LSM | |
14 | ||
15 | #define LSM_HOOK(RET, DEFAULT, NAME, ...) \ | |
16 | RET bpf_lsm_##NAME(__VA_ARGS__); | |
17 | #include <linux/lsm_hook_defs.h> | |
18 | #undef LSM_HOOK | |
19 | ||
9e4e01df KS |
20 | int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog, |
21 | const struct bpf_prog *prog); | |
22 | ||
23 | #else /* !CONFIG_BPF_LSM */ | |
24 | ||
25 | static inline int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog, | |
26 | const struct bpf_prog *prog) | |
27 | { | |
28 | return -EOPNOTSUPP; | |
29 | } | |
30 | ||
9d3fdea7 KS |
31 | #endif /* CONFIG_BPF_LSM */ |
32 | ||
33 | #endif /* _LINUX_BPF_LSM_H */ |