diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 22:13:15 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 22:13:15 -0500 |
| commit | 5807fcaa9bf7dd87241df739161c119cf78a6bc4 (patch) | |
| tree | 4ed1e647a0ae0f315db3b9066c9235020c439649 /include/linux | |
| parent | 2d663b55816e5c1d211a77fff90687053fe78aac (diff) | |
| parent | acb2cfdb316ddc3fac8183c0f71edd1680713b10 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris:
- EVM gains support for loading an x509 cert from the kernel
(EVM_LOAD_X509), into the EVM trusted kernel keyring.
- Smack implements 'file receive' process-based permission checking for
sockets, rather than just depending on inode checks.
- Misc enhancments for TPM & TPM2.
- Cleanups and bugfixes for SELinux, Keys, and IMA.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (41 commits)
selinux: Inode label revalidation performance fix
KEYS: refcount bug fix
ima: ima_write_policy() limit locking
IMA: policy can be updated zero times
selinux: rate-limit netlink message warnings in selinux_nlmsg_perm()
selinux: export validatetrans decisions
gfs2: Invalid security labels of inodes when they go invalid
selinux: Revalidate invalid inode security labels
security: Add hook to invalidate inode security labels
selinux: Add accessor functions for inode->i_security
security: Make inode argument of inode_getsecid non-const
security: Make inode argument of inode_getsecurity non-const
selinux: Remove unused variable in selinux_inode_init_security
keys, trusted: seal with a TPM2 authorization policy
keys, trusted: select hash algorithm for TPM2 chips
keys, trusted: fix: *do not* allow duplicate key options
tpm_ibmvtpm: properly handle interrupted packet receptions
tpm_tis: Tighten IRQ auto-probing
tpm_tis: Refactor the interrupt setup
tpm_tis: Get rid of the duplicate IRQ probing code
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/audit.h | 8 | ||||
| -rw-r--r-- | include/linux/capability.h | 22 | ||||
| -rw-r--r-- | include/linux/evm.h | 7 | ||||
| -rw-r--r-- | include/linux/key.h | 1 | ||||
| -rw-r--r-- | include/linux/lsm_hooks.h | 10 | ||||
| -rw-r--r-- | include/linux/security.h | 13 |
6 files changed, 37 insertions, 24 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 476bc1237ec2..b40ed5df5542 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -238,7 +238,7 @@ extern void __audit_getname(struct filename *name); | |||
| 238 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, | 238 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, |
| 239 | unsigned int flags); | 239 | unsigned int flags); |
| 240 | extern void __audit_file(const struct file *); | 240 | extern void __audit_file(const struct file *); |
| 241 | extern void __audit_inode_child(const struct inode *parent, | 241 | extern void __audit_inode_child(struct inode *parent, |
| 242 | const struct dentry *dentry, | 242 | const struct dentry *dentry, |
| 243 | const unsigned char type); | 243 | const unsigned char type); |
| 244 | extern void __audit_seccomp(unsigned long syscall, long signr, int code); | 244 | extern void __audit_seccomp(unsigned long syscall, long signr, int code); |
| @@ -303,7 +303,7 @@ static inline void audit_inode_parent_hidden(struct filename *name, | |||
| 303 | __audit_inode(name, dentry, | 303 | __audit_inode(name, dentry, |
| 304 | AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN); | 304 | AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN); |
| 305 | } | 305 | } |
| 306 | static inline void audit_inode_child(const struct inode *parent, | 306 | static inline void audit_inode_child(struct inode *parent, |
| 307 | const struct dentry *dentry, | 307 | const struct dentry *dentry, |
| 308 | const unsigned char type) { | 308 | const unsigned char type) { |
| 309 | if (unlikely(!audit_dummy_context())) | 309 | if (unlikely(!audit_dummy_context())) |
| @@ -463,7 +463,7 @@ static inline void __audit_inode(struct filename *name, | |||
| 463 | const struct dentry *dentry, | 463 | const struct dentry *dentry, |
| 464 | unsigned int flags) | 464 | unsigned int flags) |
| 465 | { } | 465 | { } |
| 466 | static inline void __audit_inode_child(const struct inode *parent, | 466 | static inline void __audit_inode_child(struct inode *parent, |
| 467 | const struct dentry *dentry, | 467 | const struct dentry *dentry, |
| 468 | const unsigned char type) | 468 | const unsigned char type) |
| 469 | { } | 469 | { } |
| @@ -477,7 +477,7 @@ static inline void audit_file(struct file *file) | |||
| 477 | static inline void audit_inode_parent_hidden(struct filename *name, | 477 | static inline void audit_inode_parent_hidden(struct filename *name, |
| 478 | const struct dentry *dentry) | 478 | const struct dentry *dentry) |
| 479 | { } | 479 | { } |
| 480 | static inline void audit_inode_child(const struct inode *parent, | 480 | static inline void audit_inode_child(struct inode *parent, |
| 481 | const struct dentry *dentry, | 481 | const struct dentry *dentry, |
| 482 | const unsigned char type) | 482 | const unsigned char type) |
| 483 | { } | 483 | { } |
diff --git a/include/linux/capability.h b/include/linux/capability.h index af9f0b9e80e6..f314275d4e3f 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
| @@ -145,24 +145,24 @@ static inline kernel_cap_t cap_invert(const kernel_cap_t c) | |||
| 145 | return dest; | 145 | return dest; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static inline int cap_isclear(const kernel_cap_t a) | 148 | static inline bool cap_isclear(const kernel_cap_t a) |
| 149 | { | 149 | { |
| 150 | unsigned __capi; | 150 | unsigned __capi; |
| 151 | CAP_FOR_EACH_U32(__capi) { | 151 | CAP_FOR_EACH_U32(__capi) { |
| 152 | if (a.cap[__capi] != 0) | 152 | if (a.cap[__capi] != 0) |
| 153 | return 0; | 153 | return false; |
| 154 | } | 154 | } |
| 155 | return 1; | 155 | return true; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | /* | 158 | /* |
| 159 | * Check if "a" is a subset of "set". | 159 | * Check if "a" is a subset of "set". |
| 160 | * return 1 if ALL of the capabilities in "a" are also in "set" | 160 | * return true if ALL of the capabilities in "a" are also in "set" |
| 161 | * cap_issubset(0101, 1111) will return 1 | 161 | * cap_issubset(0101, 1111) will return true |
| 162 | * return 0 if ANY of the capabilities in "a" are not in "set" | 162 | * return false if ANY of the capabilities in "a" are not in "set" |
| 163 | * cap_issubset(1111, 0101) will return 0 | 163 | * cap_issubset(1111, 0101) will return false |
| 164 | */ | 164 | */ |
| 165 | static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set) | 165 | static inline bool cap_issubset(const kernel_cap_t a, const kernel_cap_t set) |
| 166 | { | 166 | { |
| 167 | kernel_cap_t dest; | 167 | kernel_cap_t dest; |
| 168 | dest = cap_drop(a, set); | 168 | dest = cap_drop(a, set); |
| @@ -171,12 +171,6 @@ static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set) | |||
| 171 | 171 | ||
| 172 | /* Used to decide between falling back on the old suser() or fsuser(). */ | 172 | /* Used to decide between falling back on the old suser() or fsuser(). */ |
| 173 | 173 | ||
| 174 | static inline int cap_is_fs_cap(int cap) | ||
| 175 | { | ||
| 176 | const kernel_cap_t __cap_fs_set = CAP_FS_SET; | ||
| 177 | return !!(CAP_TO_MASK(cap) & __cap_fs_set.cap[CAP_TO_INDEX(cap)]); | ||
| 178 | } | ||
| 179 | |||
| 180 | static inline kernel_cap_t cap_drop_fs_set(const kernel_cap_t a) | 174 | static inline kernel_cap_t cap_drop_fs_set(const kernel_cap_t a) |
| 181 | { | 175 | { |
| 182 | const kernel_cap_t __cap_fs_set = CAP_FS_SET; | 176 | const kernel_cap_t __cap_fs_set = CAP_FS_SET; |
diff --git a/include/linux/evm.h b/include/linux/evm.h index 1fcb88ca88de..35ed9a8a403a 100644 --- a/include/linux/evm.h +++ b/include/linux/evm.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | struct integrity_iint_cache; | 14 | struct integrity_iint_cache; |
| 15 | 15 | ||
| 16 | #ifdef CONFIG_EVM | 16 | #ifdef CONFIG_EVM |
| 17 | extern int evm_set_key(void *key, size_t keylen); | ||
| 17 | extern enum integrity_status evm_verifyxattr(struct dentry *dentry, | 18 | extern enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 18 | const char *xattr_name, | 19 | const char *xattr_name, |
| 19 | void *xattr_value, | 20 | void *xattr_value, |
| @@ -42,6 +43,12 @@ static inline int posix_xattr_acl(const char *xattrname) | |||
| 42 | } | 43 | } |
| 43 | #endif | 44 | #endif |
| 44 | #else | 45 | #else |
| 46 | |||
| 47 | static inline int evm_set_key(void *key, size_t keylen) | ||
| 48 | { | ||
| 49 | return -EOPNOTSUPP; | ||
| 50 | } | ||
| 51 | |||
| 45 | #ifdef CONFIG_INTEGRITY | 52 | #ifdef CONFIG_INTEGRITY |
| 46 | static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, | 53 | static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 47 | const char *xattr_name, | 54 | const char *xattr_name, |
diff --git a/include/linux/key.h b/include/linux/key.h index 66f705243985..7321ab8ef949 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
| @@ -177,6 +177,7 @@ struct key { | |||
| 177 | #define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */ | 177 | #define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */ |
| 178 | #define KEY_FLAG_BUILTIN 10 /* set if key is builtin */ | 178 | #define KEY_FLAG_BUILTIN 10 /* set if key is builtin */ |
| 179 | #define KEY_FLAG_ROOT_CAN_INVAL 11 /* set if key can be invalidated by root without permission */ | 179 | #define KEY_FLAG_ROOT_CAN_INVAL 11 /* set if key can be invalidated by root without permission */ |
| 180 | #define KEY_FLAG_KEEP 12 /* set if key should not be removed */ | ||
| 180 | 181 | ||
| 181 | /* the key type and key description string | 182 | /* the key type and key description string |
| 182 | * - the desc is used to match a key against search criteria | 183 | * - the desc is used to match a key against search criteria |
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index ec3a6bab29de..71969de4058c 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h | |||
| @@ -1261,6 +1261,10 @@ | |||
| 1261 | * audit_rule_init. | 1261 | * audit_rule_init. |
| 1262 | * @rule contains the allocated rule | 1262 | * @rule contains the allocated rule |
| 1263 | * | 1263 | * |
| 1264 | * @inode_invalidate_secctx: | ||
| 1265 | * Notify the security module that it must revalidate the security context | ||
| 1266 | * of an inode. | ||
| 1267 | * | ||
| 1264 | * @inode_notifysecctx: | 1268 | * @inode_notifysecctx: |
| 1265 | * Notify the security module of what the security context of an inode | 1269 | * Notify the security module of what the security context of an inode |
| 1266 | * should be. Initializes the incore security context managed by the | 1270 | * should be. Initializes the incore security context managed by the |
| @@ -1413,14 +1417,14 @@ union security_list_options { | |||
| 1413 | int (*inode_removexattr)(struct dentry *dentry, const char *name); | 1417 | int (*inode_removexattr)(struct dentry *dentry, const char *name); |
| 1414 | int (*inode_need_killpriv)(struct dentry *dentry); | 1418 | int (*inode_need_killpriv)(struct dentry *dentry); |
| 1415 | int (*inode_killpriv)(struct dentry *dentry); | 1419 | int (*inode_killpriv)(struct dentry *dentry); |
| 1416 | int (*inode_getsecurity)(const struct inode *inode, const char *name, | 1420 | int (*inode_getsecurity)(struct inode *inode, const char *name, |
| 1417 | void **buffer, bool alloc); | 1421 | void **buffer, bool alloc); |
| 1418 | int (*inode_setsecurity)(struct inode *inode, const char *name, | 1422 | int (*inode_setsecurity)(struct inode *inode, const char *name, |
| 1419 | const void *value, size_t size, | 1423 | const void *value, size_t size, |
| 1420 | int flags); | 1424 | int flags); |
| 1421 | int (*inode_listsecurity)(struct inode *inode, char *buffer, | 1425 | int (*inode_listsecurity)(struct inode *inode, char *buffer, |
| 1422 | size_t buffer_size); | 1426 | size_t buffer_size); |
| 1423 | void (*inode_getsecid)(const struct inode *inode, u32 *secid); | 1427 | void (*inode_getsecid)(struct inode *inode, u32 *secid); |
| 1424 | 1428 | ||
| 1425 | int (*file_permission)(struct file *file, int mask); | 1429 | int (*file_permission)(struct file *file, int mask); |
| 1426 | int (*file_alloc_security)(struct file *file); | 1430 | int (*file_alloc_security)(struct file *file); |
| @@ -1516,6 +1520,7 @@ union security_list_options { | |||
| 1516 | int (*secctx_to_secid)(const char *secdata, u32 seclen, u32 *secid); | 1520 | int (*secctx_to_secid)(const char *secdata, u32 seclen, u32 *secid); |
| 1517 | void (*release_secctx)(char *secdata, u32 seclen); | 1521 | void (*release_secctx)(char *secdata, u32 seclen); |
| 1518 | 1522 | ||
| 1523 | void (*inode_invalidate_secctx)(struct inode *inode); | ||
| 1519 | int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen); | 1524 | int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen); |
| 1520 | int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen); | 1525 | int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen); |
| 1521 | int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); | 1526 | int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); |
| @@ -1757,6 +1762,7 @@ struct security_hook_heads { | |||
| 1757 | struct list_head secid_to_secctx; | 1762 | struct list_head secid_to_secctx; |
| 1758 | struct list_head secctx_to_secid; | 1763 | struct list_head secctx_to_secid; |
| 1759 | struct list_head release_secctx; | 1764 | struct list_head release_secctx; |
| 1765 | struct list_head inode_invalidate_secctx; | ||
| 1760 | struct list_head inode_notifysecctx; | 1766 | struct list_head inode_notifysecctx; |
| 1761 | struct list_head inode_setsecctx; | 1767 | struct list_head inode_setsecctx; |
| 1762 | struct list_head inode_getsecctx; | 1768 | struct list_head inode_getsecctx; |
diff --git a/include/linux/security.h b/include/linux/security.h index 2f4c1f7aa7db..4824a4ccaf1c 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -270,10 +270,10 @@ int security_inode_listxattr(struct dentry *dentry); | |||
| 270 | int security_inode_removexattr(struct dentry *dentry, const char *name); | 270 | int security_inode_removexattr(struct dentry *dentry, const char *name); |
| 271 | int security_inode_need_killpriv(struct dentry *dentry); | 271 | int security_inode_need_killpriv(struct dentry *dentry); |
| 272 | int security_inode_killpriv(struct dentry *dentry); | 272 | int security_inode_killpriv(struct dentry *dentry); |
| 273 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); | 273 | int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc); |
| 274 | int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); | 274 | int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); |
| 275 | int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); | 275 | int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); |
| 276 | void security_inode_getsecid(const struct inode *inode, u32 *secid); | 276 | void security_inode_getsecid(struct inode *inode, u32 *secid); |
| 277 | int security_file_permission(struct file *file, int mask); | 277 | int security_file_permission(struct file *file, int mask); |
| 278 | int security_file_alloc(struct file *file); | 278 | int security_file_alloc(struct file *file); |
| 279 | void security_file_free(struct file *file); | 279 | void security_file_free(struct file *file); |
| @@ -353,6 +353,7 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | |||
| 353 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); | 353 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
| 354 | void security_release_secctx(char *secdata, u32 seclen); | 354 | void security_release_secctx(char *secdata, u32 seclen); |
| 355 | 355 | ||
| 356 | void security_inode_invalidate_secctx(struct inode *inode); | ||
| 356 | int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen); | 357 | int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen); |
| 357 | int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen); | 358 | int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen); |
| 358 | int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); | 359 | int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); |
| @@ -719,7 +720,7 @@ static inline int security_inode_killpriv(struct dentry *dentry) | |||
| 719 | return cap_inode_killpriv(dentry); | 720 | return cap_inode_killpriv(dentry); |
| 720 | } | 721 | } |
| 721 | 722 | ||
| 722 | static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc) | 723 | static inline int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc) |
| 723 | { | 724 | { |
| 724 | return -EOPNOTSUPP; | 725 | return -EOPNOTSUPP; |
| 725 | } | 726 | } |
| @@ -734,7 +735,7 @@ static inline int security_inode_listsecurity(struct inode *inode, char *buffer, | |||
| 734 | return 0; | 735 | return 0; |
| 735 | } | 736 | } |
| 736 | 737 | ||
| 737 | static inline void security_inode_getsecid(const struct inode *inode, u32 *secid) | 738 | static inline void security_inode_getsecid(struct inode *inode, u32 *secid) |
| 738 | { | 739 | { |
| 739 | *secid = 0; | 740 | *secid = 0; |
| 740 | } | 741 | } |
| @@ -1093,6 +1094,10 @@ static inline void security_release_secctx(char *secdata, u32 seclen) | |||
| 1093 | { | 1094 | { |
| 1094 | } | 1095 | } |
| 1095 | 1096 | ||
| 1097 | static inline void security_inode_invalidate_secctx(struct inode *inode) | ||
| 1098 | { | ||
| 1099 | } | ||
| 1100 | |||
| 1096 | static inline int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) | 1101 | static inline int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) |
| 1097 | { | 1102 | { |
| 1098 | return -EOPNOTSUPP; | 1103 | return -EOPNOTSUPP; |
