diff options
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 40560f41e3d5..7ce53ae1266b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/capability.h> | 26 | #include <linux/capability.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/string.h> | ||
29 | 30 | ||
30 | struct linux_binprm; | 31 | struct linux_binprm; |
31 | struct cred; | 32 | struct cred; |
@@ -60,6 +61,9 @@ struct mm_struct; | |||
60 | #define SECURITY_CAP_NOAUDIT 0 | 61 | #define SECURITY_CAP_NOAUDIT 0 |
61 | #define SECURITY_CAP_AUDIT 1 | 62 | #define SECURITY_CAP_AUDIT 1 |
62 | 63 | ||
64 | /* LSM Agnostic defines for sb_set_mnt_opts */ | ||
65 | #define SECURITY_LSM_NATIVE_LABELS 1 | ||
66 | |||
63 | struct ctl_table; | 67 | struct ctl_table; |
64 | struct audit_krule; | 68 | struct audit_krule; |
65 | struct user_namespace; | 69 | struct user_namespace; |
@@ -306,6 +310,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
306 | * Parse a string of security data filling in the opts structure | 310 | * Parse a string of security data filling in the opts structure |
307 | * @options string containing all mount options known by the LSM | 311 | * @options string containing all mount options known by the LSM |
308 | * @opts binary data structure usable by the LSM | 312 | * @opts binary data structure usable by the LSM |
313 | * @dentry_init_security: | ||
314 | * Compute a context for a dentry as the inode is not yet available | ||
315 | * since NFSv4 has no label backed by an EA anyway. | ||
316 | * @dentry dentry to use in calculating the context. | ||
317 | * @mode mode used to determine resource type. | ||
318 | * @name name of the last path component used to create file | ||
319 | * @ctx pointer to place the pointer to the resulting context in. | ||
320 | * @ctxlen point to place the length of the resulting context. | ||
321 | * | ||
309 | * | 322 | * |
310 | * Security hooks for inode operations. | 323 | * Security hooks for inode operations. |
311 | * | 324 | * |
@@ -1313,6 +1326,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1313 | * @pages contains the number of pages. | 1326 | * @pages contains the number of pages. |
1314 | * Return 0 if permission is granted. | 1327 | * Return 0 if permission is granted. |
1315 | * | 1328 | * |
1329 | * @ismaclabel: | ||
1330 | * Check if the extended attribute specified by @name | ||
1331 | * represents a MAC label. Returns 1 if name is a MAC | ||
1332 | * attribute otherwise returns 0. | ||
1333 | * @name full extended attribute name to check against | ||
1334 | * LSM as a MAC label. | ||
1335 | * | ||
1316 | * @secid_to_secctx: | 1336 | * @secid_to_secctx: |
1317 | * Convert secid to security context. If secdata is NULL the length of | 1337 | * Convert secid to security context. If secdata is NULL the length of |
1318 | * the result will be returned in seclen, but no secdata will be returned. | 1338 | * the result will be returned in seclen, but no secdata will be returned. |
@@ -1440,10 +1460,16 @@ struct security_operations { | |||
1440 | int (*sb_pivotroot) (struct path *old_path, | 1460 | int (*sb_pivotroot) (struct path *old_path, |
1441 | struct path *new_path); | 1461 | struct path *new_path); |
1442 | int (*sb_set_mnt_opts) (struct super_block *sb, | 1462 | int (*sb_set_mnt_opts) (struct super_block *sb, |
1443 | struct security_mnt_opts *opts); | 1463 | struct security_mnt_opts *opts, |
1464 | unsigned long kern_flags, | ||
1465 | unsigned long *set_kern_flags); | ||
1444 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, | 1466 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, |
1445 | struct super_block *newsb); | 1467 | struct super_block *newsb); |
1446 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); | 1468 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); |
1469 | int (*dentry_init_security) (struct dentry *dentry, int mode, | ||
1470 | struct qstr *name, void **ctx, | ||
1471 | u32 *ctxlen); | ||
1472 | |||
1447 | 1473 | ||
1448 | #ifdef CONFIG_SECURITY_PATH | 1474 | #ifdef CONFIG_SECURITY_PATH |
1449 | int (*path_unlink) (struct path *dir, struct dentry *dentry); | 1475 | int (*path_unlink) (struct path *dir, struct dentry *dentry); |
@@ -1591,6 +1617,7 @@ struct security_operations { | |||
1591 | 1617 | ||
1592 | int (*getprocattr) (struct task_struct *p, char *name, char **value); | 1618 | int (*getprocattr) (struct task_struct *p, char *name, char **value); |
1593 | int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); | 1619 | int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); |
1620 | int (*ismaclabel) (const char *name); | ||
1594 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); | 1621 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); |
1595 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); | 1622 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); |
1596 | void (*release_secctx) (char *secdata, u32 seclen); | 1623 | void (*release_secctx) (char *secdata, u32 seclen); |
@@ -1726,10 +1753,16 @@ int security_sb_mount(const char *dev_name, struct path *path, | |||
1726 | const char *type, unsigned long flags, void *data); | 1753 | const char *type, unsigned long flags, void *data); |
1727 | int security_sb_umount(struct vfsmount *mnt, int flags); | 1754 | int security_sb_umount(struct vfsmount *mnt, int flags); |
1728 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); | 1755 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); |
1729 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); | 1756 | int security_sb_set_mnt_opts(struct super_block *sb, |
1757 | struct security_mnt_opts *opts, | ||
1758 | unsigned long kern_flags, | ||
1759 | unsigned long *set_kern_flags); | ||
1730 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, | 1760 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, |
1731 | struct super_block *newsb); | 1761 | struct super_block *newsb); |
1732 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); | 1762 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); |
1763 | int security_dentry_init_security(struct dentry *dentry, int mode, | ||
1764 | struct qstr *name, void **ctx, | ||
1765 | u32 *ctxlen); | ||
1733 | 1766 | ||
1734 | int security_inode_alloc(struct inode *inode); | 1767 | int security_inode_alloc(struct inode *inode); |
1735 | void security_inode_free(struct inode *inode); | 1768 | void security_inode_free(struct inode *inode); |
@@ -1841,6 +1874,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode); | |||
1841 | int security_getprocattr(struct task_struct *p, char *name, char **value); | 1874 | int security_getprocattr(struct task_struct *p, char *name, char **value); |
1842 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); | 1875 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); |
1843 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); | 1876 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); |
1877 | int security_ismaclabel(const char *name); | ||
1844 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | 1878 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); |
1845 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); | 1879 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
1846 | void security_release_secctx(char *secdata, u32 seclen); | 1880 | void security_release_secctx(char *secdata, u32 seclen); |
@@ -2012,7 +2046,9 @@ static inline int security_sb_pivotroot(struct path *old_path, | |||
2012 | } | 2046 | } |
2013 | 2047 | ||
2014 | static inline int security_sb_set_mnt_opts(struct super_block *sb, | 2048 | static inline int security_sb_set_mnt_opts(struct super_block *sb, |
2015 | struct security_mnt_opts *opts) | 2049 | struct security_mnt_opts *opts, |
2050 | unsigned long kern_flags, | ||
2051 | unsigned long *set_kern_flags) | ||
2016 | { | 2052 | { |
2017 | return 0; | 2053 | return 0; |
2018 | } | 2054 | } |
@@ -2036,6 +2072,16 @@ static inline int security_inode_alloc(struct inode *inode) | |||
2036 | static inline void security_inode_free(struct inode *inode) | 2072 | static inline void security_inode_free(struct inode *inode) |
2037 | { } | 2073 | { } |
2038 | 2074 | ||
2075 | static inline int security_dentry_init_security(struct dentry *dentry, | ||
2076 | int mode, | ||
2077 | struct qstr *name, | ||
2078 | void **ctx, | ||
2079 | u32 *ctxlen) | ||
2080 | { | ||
2081 | return -EOPNOTSUPP; | ||
2082 | } | ||
2083 | |||
2084 | |||
2039 | static inline int security_inode_init_security(struct inode *inode, | 2085 | static inline int security_inode_init_security(struct inode *inode, |
2040 | struct inode *dir, | 2086 | struct inode *dir, |
2041 | const struct qstr *qstr, | 2087 | const struct qstr *qstr, |
@@ -2521,6 +2567,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb) | |||
2521 | return cap_netlink_send(sk, skb); | 2567 | return cap_netlink_send(sk, skb); |
2522 | } | 2568 | } |
2523 | 2569 | ||
2570 | static inline int security_ismaclabel(const char *name) | ||
2571 | { | ||
2572 | return 0; | ||
2573 | } | ||
2574 | |||
2524 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | 2575 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) |
2525 | { | 2576 | { |
2526 | return -EOPNOTSUPP; | 2577 | return -EOPNOTSUPP; |