lsm.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * LSM functions
  4. */
  5. #ifndef _LSM_H_
  6. #define _LSM_H_
  7. #include <linux/printk.h>
  8. #include <linux/lsm_hooks.h>
  9. #include <linux/lsm_count.h>
  10. /* LSM debugging */
  11. extern bool lsm_debug;
  12. #define lsm_pr(...) pr_info(__VA_ARGS__)
  13. #define lsm_pr_cont(...) pr_cont(__VA_ARGS__)
  14. #define lsm_pr_dbg(...) \
  15. do { \
  16. if (lsm_debug) \
  17. pr_info(__VA_ARGS__); \
  18. } while (0)
  19. /* List of configured LSMs */
  20. extern unsigned int lsm_active_cnt;
  21. extern const struct lsm_id *lsm_idlist[];
  22. /* LSM blob configuration */
  23. extern struct lsm_blob_sizes blob_sizes;
  24. /* LSM blob caches */
  25. extern struct kmem_cache *lsm_file_cache;
  26. extern struct kmem_cache *lsm_inode_cache;
  27. /* LSM blob allocators */
  28. int lsm_cred_alloc(struct cred *cred, gfp_t gfp);
  29. int lsm_task_alloc(struct task_struct *task);
  30. /* LSM framework initializers */
  31. #ifdef CONFIG_SECURITYFS
  32. int securityfs_init(void);
  33. #else
  34. static inline int securityfs_init(void)
  35. {
  36. return 0;
  37. }
  38. #endif /* CONFIG_SECURITYFS */
  39. #endif /* _LSM_H_ */