blob: 3b3bbb28603ee48222f40a933a57de29c82beb11 [file] [log] [blame]
KP Singhfc611f42020-03-29 01:43:49 +01001// SPDX-License-Identifier: GPL-2.0
2
3/*
4 * Copyright (C) 2020 Google LLC.
5 */
6
7#include <linux/filter.h>
8#include <linux/bpf.h>
9#include <linux/btf.h>
KP Singh9d3fdea2020-03-29 01:43:51 +010010#include <linux/lsm_hooks.h>
11#include <linux/bpf_lsm.h>
12
13/* For every LSM hook that allows attachment of BPF programs, declare a nop
14 * function where a BPF program can be attached.
15 */
16#define LSM_HOOK(RET, DEFAULT, NAME, ...) \
17noinline RET bpf_lsm_##NAME(__VA_ARGS__) \
18{ \
19 return DEFAULT; \
20}
21
22#include <linux/lsm_hook_defs.h>
23#undef LSM_HOOK
KP Singhfc611f42020-03-29 01:43:49 +010024
25const struct bpf_prog_ops lsm_prog_ops = {
26};
27
28const struct bpf_verifier_ops lsm_verifier_ops = {
29 .get_func_proto = bpf_tracing_func_proto,
30 .is_valid_access = btf_ctx_access,
31};