aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2017-07-24 20:44:18 -0400
committerJames Morris <james.l.morris@oracle.com>2017-07-24 20:44:18 -0400
commit53a2ebaaabc1eb8458796fec3bc1e0e80746b642 (patch)
tree9d1f9227b49392cdd2edcc01057517da4f4b09c2 /security
parent3cf29931453215536916d0c4da953fce1911ced3 (diff)
parent520eccdfe187591a51ea9ab4c1a024ae4d0f68d9 (diff)
sync to Linus v4.13-rc2 for subsystem developers to work against
Diffstat (limited to 'security')
-rw-r--r--security/Kconfig7
-rw-r--r--security/apparmor/match.c2
-rw-r--r--security/apparmor/policy_unpack.c2
-rw-r--r--security/integrity/evm/evm_crypto.c2
-rw-r--r--security/integrity/ima/ima_policy.c12
-rw-r--r--security/keys/Kconfig6
-rw-r--r--security/keys/compat_dh.c2
-rw-r--r--security/keys/dh.c305
-rw-r--r--security/keys/encrypted-keys/encrypted.c206
-rw-r--r--security/keys/encrypted-keys/masterkey_trusted.c2
-rw-r--r--security/keys/gc.c4
-rw-r--r--security/keys/internal.h3
-rw-r--r--security/keys/key.c16
-rw-r--r--security/keys/keyctl.c16
-rw-r--r--security/keys/keyring.c12
-rw-r--r--security/keys/process_keys.c7
-rw-r--r--security/keys/request_key.c2
-rw-r--r--security/keys/request_key_auth.c2
-rw-r--r--security/keys/trusted.c52
-rw-r--r--security/keys/user_defined.c16
-rw-r--r--security/selinux/hooks.c5
-rw-r--r--security/selinux/nlmsgtab.c3
-rw-r--r--security/selinux/selinuxfs.c12
-rw-r--r--security/yama/Kconfig3
24 files changed, 365 insertions, 334 deletions
diff --git a/security/Kconfig b/security/Kconfig
index d540bfe73190..e8e449444e65 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -163,6 +163,13 @@ config HARDENED_USERCOPY_PAGESPAN
163 been removed. This config is intended to be used only while 163 been removed. This config is intended to be used only while
164 trying to find such users. 164 trying to find such users.
165 165
166config FORTIFY_SOURCE
167 bool "Harden common str/mem functions against buffer overflows"
168 depends on ARCH_HAS_FORTIFY_SOURCE
169 help
170 Detect overflows of buffers in common string and memory functions
171 where the compiler can determine and validate the buffer sizes.
172
166config STATIC_USERMODEHELPER 173config STATIC_USERMODEHELPER
167 bool "Force all usermode helper calls through a single binary" 174 bool "Force all usermode helper calls through a single binary"
168 help 175 help
diff --git a/security/apparmor/match.c b/security/apparmor/match.c
index 960c913381e2..72c604350e80 100644
--- a/security/apparmor/match.c
+++ b/security/apparmor/match.c
@@ -226,7 +226,7 @@ void aa_dfa_free_kref(struct kref *kref)
226 * @flags: flags controlling what type of accept tables are acceptable 226 * @flags: flags controlling what type of accept tables are acceptable
227 * 227 *
228 * Unpack a dfa that has been serialized. To find information on the dfa 228 * Unpack a dfa that has been serialized. To find information on the dfa
229 * format look in Documentation/security/apparmor.txt 229 * format look in Documentation/admin-guide/LSM/apparmor.rst
230 * Assumes the dfa @blob stream has been aligned on a 8 byte boundary 230 * Assumes the dfa @blob stream has been aligned on a 8 byte boundary
231 * 231 *
232 * Returns: an unpacked dfa ready for matching or ERR_PTR on failure 232 * Returns: an unpacked dfa ready for matching or ERR_PTR on failure
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 6e6f8c1a10a9..c600f4dd1783 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -13,7 +13,7 @@
13 * License. 13 * License.
14 * 14 *
15 * AppArmor uses a serialized binary format for loading policy. To find 15 * AppArmor uses a serialized binary format for loading policy. To find
16 * policy format documentation look in Documentation/security/apparmor.txt 16 * policy format documentation see Documentation/admin-guide/LSM/apparmor.rst
17 * All policy is validated before it is used. 17 * All policy is validated before it is used.
18 */ 18 */
19 19
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index d7f282d75cc1..1d32cd20009a 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
164 hmac_misc.mode = inode->i_mode; 164 hmac_misc.mode = inode->i_mode;
165 crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc)); 165 crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
166 if (evm_hmac_attrs & EVM_ATTR_FSUUID) 166 if (evm_hmac_attrs & EVM_ATTR_FSUUID)
167 crypto_shash_update(desc, inode->i_sb->s_uuid, 167 crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
168 sizeof(inode->i_sb->s_uuid)); 168 sizeof(inode->i_sb->s_uuid));
169 crypto_shash_final(desc, digest); 169 crypto_shash_final(desc, digest);
170} 170}
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index f4436626ccb7..95209a5f8595 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -61,7 +61,7 @@ struct ima_rule_entry {
61 enum ima_hooks func; 61 enum ima_hooks func;
62 int mask; 62 int mask;
63 unsigned long fsmagic; 63 unsigned long fsmagic;
64 u8 fsuuid[16]; 64 uuid_t fsuuid;
65 kuid_t uid; 65 kuid_t uid;
66 kuid_t fowner; 66 kuid_t fowner;
67 bool (*uid_op)(kuid_t, kuid_t); /* Handlers for operators */ 67 bool (*uid_op)(kuid_t, kuid_t); /* Handlers for operators */
@@ -266,7 +266,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
266 && rule->fsmagic != inode->i_sb->s_magic) 266 && rule->fsmagic != inode->i_sb->s_magic)
267 return false; 267 return false;
268 if ((rule->flags & IMA_FSUUID) && 268 if ((rule->flags & IMA_FSUUID) &&
269 memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid))) 269 !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
270 return false; 270 return false;
271 if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid)) 271 if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
272 return false; 272 return false;
@@ -743,14 +743,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
743 case Opt_fsuuid: 743 case Opt_fsuuid:
744 ima_log_string(ab, "fsuuid", args[0].from); 744 ima_log_string(ab, "fsuuid", args[0].from);
745 745
746 if (memchr_inv(entry->fsuuid, 0x00, 746 if (uuid_is_null(&entry->fsuuid)) {
747 sizeof(entry->fsuuid))) {
748 result = -EINVAL; 747 result = -EINVAL;
749 break; 748 break;
750 } 749 }
751 750
752 result = blk_part_pack_uuid(args[0].from, 751 result = uuid_parse(args[0].from, &entry->fsuuid);
753 entry->fsuuid);
754 if (!result) 752 if (!result)
755 entry->flags |= IMA_FSUUID; 753 entry->flags |= IMA_FSUUID;
756 break; 754 break;
@@ -1073,7 +1071,7 @@ int ima_policy_show(struct seq_file *m, void *v)
1073 } 1071 }
1074 1072
1075 if (entry->flags & IMA_FSUUID) { 1073 if (entry->flags & IMA_FSUUID) {
1076 seq_printf(m, "fsuuid=%pU", entry->fsuuid); 1074 seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
1077 seq_puts(m, " "); 1075 seq_puts(m, " ");
1078 } 1076 }
1079 1077
diff --git a/security/keys/Kconfig b/security/keys/Kconfig
index 6fd95f76bfae..a7a23b5541f8 100644
--- a/security/keys/Kconfig
+++ b/security/keys/Kconfig
@@ -20,6 +20,10 @@ config KEYS
20 20
21 If you are unsure as to whether this is required, answer N. 21 If you are unsure as to whether this is required, answer N.
22 22
23config KEYS_COMPAT
24 def_bool y
25 depends on COMPAT && KEYS
26
23config PERSISTENT_KEYRINGS 27config PERSISTENT_KEYRINGS
24 bool "Enable register of persistent per-UID keyrings" 28 bool "Enable register of persistent per-UID keyrings"
25 depends on KEYS 29 depends on KEYS
@@ -89,9 +93,9 @@ config ENCRYPTED_KEYS
89config KEY_DH_OPERATIONS 93config KEY_DH_OPERATIONS
90 bool "Diffie-Hellman operations on retained keys" 94 bool "Diffie-Hellman operations on retained keys"
91 depends on KEYS 95 depends on KEYS
92 select MPILIB
93 select CRYPTO 96 select CRYPTO
94 select CRYPTO_HASH 97 select CRYPTO_HASH
98 select CRYPTO_DH
95 help 99 help
96 This option provides support for calculating Diffie-Hellman 100 This option provides support for calculating Diffie-Hellman
97 public keys and shared secrets using values stored as keys 101 public keys and shared secrets using values stored as keys
diff --git a/security/keys/compat_dh.c b/security/keys/compat_dh.c
index a6a659b6bcb6..aa6b34cafe5f 100644
--- a/security/keys/compat_dh.c
+++ b/security/keys/compat_dh.c
@@ -33,6 +33,8 @@ long compat_keyctl_dh_compute(struct keyctl_dh_params __user *params,
33 kdfcopy.hashname = compat_ptr(compat_kdfcopy.hashname); 33 kdfcopy.hashname = compat_ptr(compat_kdfcopy.hashname);
34 kdfcopy.otherinfo = compat_ptr(compat_kdfcopy.otherinfo); 34 kdfcopy.otherinfo = compat_ptr(compat_kdfcopy.otherinfo);
35 kdfcopy.otherinfolen = compat_kdfcopy.otherinfolen; 35 kdfcopy.otherinfolen = compat_kdfcopy.otherinfolen;
36 memcpy(kdfcopy.__spare, compat_kdfcopy.__spare,
37 sizeof(kdfcopy.__spare));
36 38
37 return __keyctl_dh_compute(params, buffer, buflen, &kdfcopy); 39 return __keyctl_dh_compute(params, buffer, buflen, &kdfcopy);
38} 40}
diff --git a/security/keys/dh.c b/security/keys/dh.c
index e603bd912e4c..d1ea9f325f94 100644
--- a/security/keys/dh.c
+++ b/