Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * LSM functions
4 */
5
6#ifndef _LSM_H_
7#define _LSM_H_
8
9#include <linux/printk.h>
10#include <linux/lsm_hooks.h>
11#include <linux/lsm_count.h>
12
13/* LSM debugging */
14extern bool lsm_debug;
15#define lsm_pr(...) pr_info(__VA_ARGS__)
16#define lsm_pr_cont(...) pr_cont(__VA_ARGS__)
17#define lsm_pr_dbg(...) \
18 do { \
19 if (lsm_debug) \
20 pr_info(__VA_ARGS__); \
21 } while (0)
22
23/* List of configured LSMs */
24extern unsigned int lsm_active_cnt;
25extern const struct lsm_id *lsm_idlist[];
26
27/* LSM blob configuration */
28extern struct lsm_blob_sizes blob_sizes;
29
30/* LSM blob caches */
31extern struct kmem_cache *lsm_file_cache;
32extern struct kmem_cache *lsm_inode_cache;
33
34/* LSM blob allocators */
35int lsm_cred_alloc(struct cred *cred, gfp_t gfp);
36int lsm_task_alloc(struct task_struct *task);
37
38/* LSM framework initializers */
39
40#ifdef CONFIG_MMU
41int min_addr_init(void);
42#else
43static inline int min_addr_init(void)
44{
45 return 0;
46}
47#endif /* CONFIG_MMU */
48
49#ifdef CONFIG_SECURITYFS
50int securityfs_init(void);
51#else
52static inline int securityfs_init(void)
53{
54 return 0;
55}
56#endif /* CONFIG_SECURITYFS */
57
58#endif /* _LSM_H_ */