~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/bpf_lsm.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/bpf_lsm.h (Version linux-6.12-rc7) and /include/linux/bpf_lsm.h (Version linux-5.12.19)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2                                                     2 
  3 /*                                                  3 /*
  4  * Copyright (C) 2020 Google LLC.                   4  * Copyright (C) 2020 Google LLC.
  5  */                                                 5  */
  6                                                     6 
  7 #ifndef _LINUX_BPF_LSM_H                            7 #ifndef _LINUX_BPF_LSM_H
  8 #define _LINUX_BPF_LSM_H                            8 #define _LINUX_BPF_LSM_H
  9                                                     9 
 10 #include <linux/sched.h>                           10 #include <linux/sched.h>
 11 #include <linux/bpf.h>                             11 #include <linux/bpf.h>
 12 #include <linux/bpf_verifier.h>                << 
 13 #include <linux/lsm_hooks.h>                       12 #include <linux/lsm_hooks.h>
 14                                                    13 
 15 #ifdef CONFIG_BPF_LSM                              14 #ifdef CONFIG_BPF_LSM
 16                                                    15 
 17 #define LSM_HOOK(RET, DEFAULT, NAME, ...) \        16 #define LSM_HOOK(RET, DEFAULT, NAME, ...) \
 18         RET bpf_lsm_##NAME(__VA_ARGS__);           17         RET bpf_lsm_##NAME(__VA_ARGS__);
 19 #include <linux/lsm_hook_defs.h>                   18 #include <linux/lsm_hook_defs.h>
 20 #undef LSM_HOOK                                    19 #undef LSM_HOOK
 21                                                    20 
 22 struct bpf_storage_blob {                          21 struct bpf_storage_blob {
 23         struct bpf_local_storage __rcu *storag     22         struct bpf_local_storage __rcu *storage;
 24 };                                                 23 };
 25                                                    24 
 26 extern struct lsm_blob_sizes bpf_lsm_blob_size     25 extern struct lsm_blob_sizes bpf_lsm_blob_sizes;
 27                                                    26 
 28 int bpf_lsm_verify_prog(struct bpf_verifier_lo     27 int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
 29                         const struct bpf_prog      28                         const struct bpf_prog *prog);
 30                                                    29 
 31 bool bpf_lsm_is_sleepable_hook(u32 btf_id);        30 bool bpf_lsm_is_sleepable_hook(u32 btf_id);
 32 bool bpf_lsm_is_trusted(const struct bpf_prog  << 
 33                                                    31 
 34 static inline struct bpf_storage_blob *bpf_ino     32 static inline struct bpf_storage_blob *bpf_inode(
 35         const struct inode *inode)                 33         const struct inode *inode)
 36 {                                                  34 {
 37         if (unlikely(!inode->i_security))          35         if (unlikely(!inode->i_security))
 38                 return NULL;                       36                 return NULL;
 39                                                    37 
 40         return inode->i_security + bpf_lsm_blo     38         return inode->i_security + bpf_lsm_blob_sizes.lbs_inode;
 41 }                                                  39 }
 42                                                    40 
                                                   >>  41 static inline struct bpf_storage_blob *bpf_task(
                                                   >>  42         const struct task_struct *task)
                                                   >>  43 {
                                                   >>  44         if (unlikely(!task->security))
                                                   >>  45                 return NULL;
                                                   >>  46 
                                                   >>  47         return task->security + bpf_lsm_blob_sizes.lbs_task;
                                                   >>  48 }
                                                   >>  49 
 43 extern const struct bpf_func_proto bpf_inode_s     50 extern const struct bpf_func_proto bpf_inode_storage_get_proto;
 44 extern const struct bpf_func_proto bpf_inode_s     51 extern const struct bpf_func_proto bpf_inode_storage_delete_proto;
                                                   >>  52 extern const struct bpf_func_proto bpf_task_storage_get_proto;
                                                   >>  53 extern const struct bpf_func_proto bpf_task_storage_delete_proto;
 45 void bpf_inode_storage_free(struct inode *inod     54 void bpf_inode_storage_free(struct inode *inode);
                                                   >>  55 void bpf_task_storage_free(struct task_struct *task);
 46                                                    56 
 47 void bpf_lsm_find_cgroup_shim(const struct bpf << 
 48                                                << 
 49 int bpf_lsm_get_retval_range(const struct bpf_ << 
 50                              struct bpf_retval << 
 51 #else /* !CONFIG_BPF_LSM */                        57 #else /* !CONFIG_BPF_LSM */
 52                                                    58 
 53 static inline bool bpf_lsm_is_sleepable_hook(u     59 static inline bool bpf_lsm_is_sleepable_hook(u32 btf_id)
 54 {                                                  60 {
 55         return false;                              61         return false;
 56 }                                                  62 }
 57                                                    63 
 58 static inline bool bpf_lsm_is_trusted(const st << 
 59 {                                              << 
 60         return false;                          << 
 61 }                                              << 
 62                                                << 
 63 static inline int bpf_lsm_verify_prog(struct b     64 static inline int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
 64                                       const st     65                                       const struct bpf_prog *prog)
 65 {                                                  66 {
 66         return -EOPNOTSUPP;                        67         return -EOPNOTSUPP;
 67 }                                                  68 }
 68                                                    69 
 69 static inline struct bpf_storage_blob *bpf_ino     70 static inline struct bpf_storage_blob *bpf_inode(
 70         const struct inode *inode)                 71         const struct inode *inode)
 71 {                                                  72 {
 72         return NULL;                               73         return NULL;
 73 }                                                  74 }
 74                                                    75 
 75 static inline void bpf_inode_storage_free(stru !!  76 static inline struct bpf_storage_blob *bpf_task(
                                                   >>  77         const struct task_struct *task)
 76 {                                                  78 {
                                                   >>  79         return NULL;
 77 }                                                  80 }
 78                                                    81 
 79 static inline void bpf_lsm_find_cgroup_shim(co !!  82 static inline void bpf_inode_storage_free(struct inode *inode)
 80                                            bpf << 
 81 {                                                  83 {
 82 }                                                  84 }
 83                                                    85 
 84 static inline int bpf_lsm_get_retval_range(con !!  86 static inline void bpf_task_storage_free(struct task_struct *task)
 85                                            str << 
 86 {                                                  87 {
 87         return -EOPNOTSUPP;                    << 
 88 }                                                  88 }
                                                   >>  89 
 89 #endif /* CONFIG_BPF_LSM */                        90 #endif /* CONFIG_BPF_LSM */
 90                                                    91 
 91 #endif /* _LINUX_BPF_LSM_H */                      92 #endif /* _LINUX_BPF_LSM_H */
 92                                                    93 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php