diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-07-12 06:34:42 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-07-12 06:34:42 -0400 |
commit | f2006e27396f55276f24434f56e208d86e7f9908 (patch) | |
tree | 71896db916d33888b4286f80117d3cac0da40e6d /include/linux/security.h | |
parent | e399eb56a6110e13f97e644658648602e2b08de7 (diff) | |
parent | 9903883f1dd6e86f286b7bfa6e4b423f98c1cd9e (diff) |
Merge branch 'linus' into timers/urgent
Get upstream changes so we can apply fixes against them
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 4686491852a7..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. |
@@ -1392,7 +1412,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1392 | * @ctxlen contains the length of @ctx. | 1412 | * @ctxlen contains the length of @ctx. |
1393 | * | 1413 | * |
1394 | * @inode_getsecctx: | 1414 | * @inode_getsecctx: |
1395 | * Returns a string containing all relevant security context information | 1415 | * On success, returns 0 and fills out @ctx and @ctxlen with the security |
1416 | * context for the given @inode. | ||
1396 | * | 1417 | * |
1397 | * @inode we wish to get the security context of. | 1418 | * @inode we wish to get the security context of. |
1398 | * @ctx is a pointer in which to place the allocated security context. | 1419 | * @ctx is a pointer in which to place the allocated security context. |
@@ -1439,10 +1460,16 @@ struct security_operations { | |||
1439 | int (*sb_pivotroot) (struct path *old_path, | 1460 | int (*sb_pivotroot) (struct path *old_path, |
1440 | struct path *new_path); | 1461 | struct path *new_path); |
1441 | int (*sb_set_mnt_opts) (struct super_block *sb, | 1462 | int (*sb_set_mnt_opts) (struct super_block *sb, |
1442 | struct security_mnt_opts *opts); | 1463 | struct security_mnt_opts *opts, |
1464 | unsigned long kern_flags, | ||
1465 | unsigned long *set_kern_flags); | ||
1443 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, | 1466 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, |
1444 | struct super_block *newsb); | 1467 | struct super_block *newsb); |
1445 | 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 | |||
1446 | 1473 | ||
1447 | #ifdef CONFIG_SECURITY_PATH | 1474 | #ifdef CONFIG_SECURITY_PATH |
1448 | int (*path_unlink) (struct path *dir, struct dentry *dentry); | 1475 | int (*path_unlink) (struct path *dir, struct dentry *dentry); |
@@ -1590,6 +1617,7 @@ struct security_operations { | |||
1590 | 1617 | ||
1591 | int (*getprocattr) (struct task_struct *p, char *name, char **value); | 1618 | int (*getprocattr) (struct task_struct *p, char *name, char **value); |
1592 | 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); | ||
1593 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); | 1621 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); |
1594 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); | 1622 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); |
1595 | void (*release_secctx) (char *secdata, u32 seclen); | 1623 | void (*release_secctx) (char *secdata, u32 seclen); |
@@ -1725,10 +1753,16 @@ int security_sb_mount(const char *dev_name, struct path *path, | |||
1725 | const char *type, unsigned long flags, void *data); | 1753 | const char *type, unsigned long flags, void *data); |
1726 | int security_sb_umount(struct vfsmount *mnt, int flags); | 1754 | int security_sb_umount(struct vfsmount *mnt, int flags); |
1727 | 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); |
1728 | 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); | ||
1729 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, | 1760 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, |
1730 | struct super_block *newsb); | 1761 | struct super_block *newsb); |
1731 | 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); | ||
1732 | 1766 | ||
1733 | int security_inode_alloc(struct inode *inode); | 1767 | int security_inode_alloc(struct inode *inode); |
1734 | void security_inode_free(struct inode *inode); | 1768 | void security_inode_free(struct inode *inode); |
@@ -1840,6 +1874,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode); | |||
1840 | int security_getprocattr(struct task_struct *p, char *name, char **value); | 1874 | int security_getprocattr(struct task_struct *p, char *name, char **value); |
1841 | 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); |
1842 | 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); | ||
1843 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | 1878 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); |
1844 | 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); |
1845 | void security_release_secctx(char *secdata, u32 seclen); | 1880 | void security_release_secctx(char *secdata, u32 seclen); |
@@ -2011,7 +2046,9 @@ static inline int security_sb_pivotroot(struct path *old_path, | |||
2011 | } | 2046 | } |
2012 | 2047 | ||
2013 | 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, |
2014 | struct security_mnt_opts *opts) | 2049 | struct security_mnt_opts *opts, |
2050 | unsigned long kern_flags, | ||
2051 | unsigned long *set_kern_flags) | ||
2015 | { | 2052 | { |
2016 | return 0; | 2053 | return 0; |
2017 | } | 2054 | } |
@@ -2035,6 +2072,16 @@ static inline int security_inode_alloc(struct inode *inode) | |||
2035 | static inline void security_inode_free(struct inode *inode) | 2072 | static inline void security_inode_free(struct inode *inode) |
2036 | { } | 2073 | { } |
2037 | 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 | |||
2038 | static inline int security_inode_init_security(struct inode *inode, | 2085 | static inline int security_inode_init_security(struct inode *inode, |
2039 | struct inode *dir, | 2086 | struct inode *dir, |
2040 | const struct qstr *qstr, | 2087 | const struct qstr *qstr, |
@@ -2520,6 +2567,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb) | |||
2520 | return cap_netlink_send(sk, skb); | 2567 | return cap_netlink_send(sk, skb); |
2521 | } | 2568 | } |
2522 | 2569 | ||
2570 | static inline int security_ismaclabel(const char *name) | ||
2571 | { | ||
2572 | return 0; | ||
2573 | } | ||
2574 | |||
2523 | 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) |
2524 | { | 2576 | { |
2525 | return -EOPNOTSUPP; | 2577 | return -EOPNOTSUPP; |