diff options
author | Dmitry Kasatkin <dmitry.kasatkin@gmail.com> | 2014-10-01 14:43:08 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2014-10-07 14:32:53 -0400 |
commit | c2baec7ffaf6a2c15e03028ed9ef82a92cc49a94 (patch) | |
tree | a08f5716f4c0dd61f451e488a557d66a748c00da /security/integrity | |
parent | d16a8585d3715ef161cc9858b50ea5d3c8b6079b (diff) |
evm: skip replacing EVM signature with HMAC on read-only filesystem
If filesystem is mounted read-only or file is immutable, updating
xattr will fail. This is a usual case during early boot until
filesystem is remount read-write. This patch verifies conditions
to skip unnecessary attempt to calculate HMAC and set xattr.
Changes in v2:
* indention changed according to Lindent (requested by Mimi)
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity')
-rw-r--r-- | security/integrity/evm/evm_main.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index 9685af330de5..b392fe614738 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
@@ -162,9 +162,14 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, | |||
162 | (const char *)xattr_data, xattr_len, | 162 | (const char *)xattr_data, xattr_len, |
163 | calc.digest, sizeof(calc.digest)); | 163 | calc.digest, sizeof(calc.digest)); |
164 | if (!rc) { | 164 | if (!rc) { |
165 | /* we probably want to replace rsa with hmac here */ | 165 | /* Replace RSA with HMAC if not mounted readonly and |
166 | evm_update_evmxattr(dentry, xattr_name, xattr_value, | 166 | * not immutable |
167 | xattr_value_len); | 167 | */ |
168 | if (!IS_RDONLY(dentry->d_inode) && | ||
169 | !IS_IMMUTABLE(dentry->d_inode)) | ||
170 | evm_update_evmxattr(dentry, xattr_name, | ||
171 | xattr_value, | ||
172 | xattr_value_len); | ||
168 | } | 173 | } |
169 | break; | 174 | break; |
170 | default: | 175 | default: |