diff options
author | James Morris <james.l.morris@oracle.com> | 2016-11-22 17:52:11 -0500 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2016-11-22 17:52:11 -0500 |
commit | b075361e91684f8b9d4a85ad2e6f62f94d6698e3 (patch) | |
tree | 6f0c9717988ff9f9ad4878d00ae27c123091391e | |
parent | 636e4625adb5a53ee7f6b019fa2e68f36cf96d93 (diff) | |
parent | b4bfec7f4a86424b114f94f41c4e1841ec102df3 (diff) |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity into next
-rw-r--r-- | Documentation/security/keys-trusted-encrypted.txt | 2 | ||||
-rw-r--r-- | security/integrity/digsig.c | 2 | ||||
-rw-r--r-- | security/integrity/evm/evm_main.c | 4 | ||||
-rw-r--r-- | security/integrity/ima/ima_appraise.c | 13 | ||||
-rw-r--r-- | security/integrity/ima/ima_fs.c | 2 | ||||
-rw-r--r-- | security/integrity/ima/ima_init.c | 3 |
6 files changed, 14 insertions, 12 deletions
diff --git a/Documentation/security/keys-trusted-encrypted.txt b/Documentation/security/keys-trusted-encrypted.txt index 324ddf5223b3..b20a993a32af 100644 --- a/Documentation/security/keys-trusted-encrypted.txt +++ b/Documentation/security/keys-trusted-encrypted.txt | |||
@@ -32,8 +32,6 @@ Usage: | |||
32 | (40 ascii zeros) | 32 | (40 ascii zeros) |
33 | blobauth= ascii hex auth for sealed data default 0x00... | 33 | blobauth= ascii hex auth for sealed data default 0x00... |
34 | (40 ascii zeros) | 34 | (40 ascii zeros) |
35 | blobauth= ascii hex auth for sealed data default 0x00... | ||
36 | (40 ascii zeros) | ||
37 | pcrinfo= ascii hex of PCR_INFO or PCR_INFO_LONG (no default) | 35 | pcrinfo= ascii hex of PCR_INFO or PCR_INFO_LONG (no default) |
38 | pcrlock= pcr number to be extended to "lock" blob | 36 | pcrlock= pcr number to be extended to "lock" blob |
39 | migratable= 0|1 indicating permission to reseal to new PCR values, | 37 | migratable= 0|1 indicating permission to reseal to new PCR values, |
diff --git a/security/integrity/digsig.c b/security/integrity/digsig.c index 4304372b323f..106e855e2d9d 100644 --- a/security/integrity/digsig.c +++ b/security/integrity/digsig.c | |||
@@ -51,7 +51,7 @@ static bool init_keyring __initdata; | |||
51 | int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen, | 51 | int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen, |
52 | const char *digest, int digestlen) | 52 | const char *digest, int digestlen) |
53 | { | 53 | { |
54 | if (id >= INTEGRITY_KEYRING_MAX) | 54 | if (id >= INTEGRITY_KEYRING_MAX || siglen < 2) |
55 | return -EINVAL; | 55 | return -EINVAL; |
56 | 56 | ||
57 | if (!keyring[id]) { | 57 | if (!keyring[id]) { |
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index ba8615576d4d..e2ed498c0f5f 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
@@ -145,6 +145,10 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, | |||
145 | /* check value type */ | 145 | /* check value type */ |
146 | switch (xattr_data->type) { | 146 | switch (xattr_data->type) { |
147 | case EVM_XATTR_HMAC: | 147 | case EVM_XATTR_HMAC: |
148 | if (xattr_len != sizeof(struct evm_ima_xattr_data)) { | ||
149 | evm_status = INTEGRITY_FAIL; | ||
150 | goto out; | ||
151 | } | ||
148 | rc = evm_calc_hmac(dentry, xattr_name, xattr_value, | 152 | rc = evm_calc_hmac(dentry, xattr_name, xattr_value, |
149 | xattr_value_len, calc.digest); | 153 | xattr_value_len, calc.digest); |
150 | if (rc) | 154 | if (rc) |
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 389325ac6067..1fd9539a969d 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
@@ -130,6 +130,7 @@ enum hash_algo ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value, | |||
130 | int xattr_len) | 130 | int xattr_len) |
131 | { | 131 | { |
132 | struct signature_v2_hdr *sig; | 132 | struct signature_v2_hdr *sig; |
133 | enum hash_algo ret; | ||
133 | 134 | ||
134 | if (!xattr_value || xattr_len < 2) | 135 | if (!xattr_value || xattr_len < 2) |
135 | /* return default hash algo */ | 136 | /* return default hash algo */ |
@@ -143,7 +144,9 @@ enum hash_algo ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value, | |||
143 | return sig->hash_algo; | 144 | return sig->hash_algo; |
144 | break; | 145 | break; |
145 | case IMA_XATTR_DIGEST_NG: | 146 | case IMA_XATTR_DIGEST_NG: |
146 | return xattr_value->digest[0]; | 147 | ret = xattr_value->digest[0]; |
148 | if (ret < HASH_ALGO__LAST) | ||
149 | return ret; | ||
147 | break; | 150 | break; |
148 | case IMA_XATTR_DIGEST: | 151 | case IMA_XATTR_DIGEST: |
149 | /* this is for backward compatibility */ | 152 | /* this is for backward compatibility */ |
@@ -384,14 +387,10 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, | |||
384 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, | 387 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, |
385 | xattr_value_len); | 388 | xattr_value_len); |
386 | if (result == 1) { | 389 | if (result == 1) { |
387 | bool digsig; | ||
388 | |||
389 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) | 390 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) |
390 | return -EINVAL; | 391 | return -EINVAL; |
391 | digsig = (xvalue->type == EVM_IMA_XATTR_DIGSIG); | 392 | ima_reset_appraise_flags(d_backing_inode(dentry), |
392 | if (!digsig && (ima_appraise & IMA_APPRAISE_ENFORCE)) | 393 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); |
393 | return -EPERM; | ||
394 | ima_reset_appraise_flags(d_backing_inode(dentry), digsig); | ||
395 | result = 0; | 394 | result = 0; |
396 | } | 395 | } |
397 | return result; | 396 | return result; |
diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c index c07a3844ea0a..3df46906492d 100644 --- a/security/integrity/ima/ima_fs.c +++ b/security/integrity/ima/ima_fs.c | |||
@@ -401,7 +401,7 @@ static int ima_release_policy(struct inode *inode, struct file *file) | |||
401 | const char *cause = valid_policy ? "completed" : "failed"; | 401 | const char *cause = valid_policy ? "completed" : "failed"; |
402 | 402 | ||
403 | if ((file->f_flags & O_ACCMODE) == O_RDONLY) | 403 | if ((file->f_flags & O_ACCMODE) == O_RDONLY) |
404 | return 0; | 404 | return seq_release(inode, file); |
405 | 405 | ||
406 | if (valid_policy && ima_check_policy() < 0) { | 406 | if (valid_policy && ima_check_policy() < 0) { |
407 | cause = "failed"; | 407 | cause = "failed"; |
diff --git a/security/integrity/ima/ima_init.c b/security/integrity/ima/ima_init.c index 32912bd54ead..2ac1f41db5c0 100644 --- a/security/integrity/ima/ima_init.c +++ b/security/integrity/ima/ima_init.c | |||
@@ -115,7 +115,8 @@ int __init ima_init(void) | |||
115 | ima_used_chip = 1; | 115 | ima_used_chip = 1; |
116 | 116 | ||
117 | if (!ima_used_chip) | 117 | if (!ima_used_chip) |
118 | pr_info("No TPM chip found, activating TPM-bypass!\n"); | 118 | pr_info("No TPM chip found, activating TPM-bypass! (rc=%d)\n", |
119 | rc); | ||
119 | 120 | ||
120 | rc = integrity_init_keyring(INTEGRITY_KEYRING_IMA); | 121 | rc = integrity_init_keyring(INTEGRITY_KEYRING_IMA); |
121 | if (rc) | 122 | if (rc) |