evm: skip replacing EVM signature with HMAC on read-only filesystem
Quoted 16 lines · Dmitry Kasatkin
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.
Signed-off-by Dmitry Kasatkin <[email protected]>--- security/integrity/evm/evm_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)security/integrity/evm/evm_main.c +0
-0@@ -162,9 +162,14 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, (const char *)xattr_data, xattr_len,
security/integrity/evm/evm_main.c static enum integrity_status evm_verify_hmac(struct dentry *dentry, · line 169
Quoted 10 lines
security/integrity/evm/evm_main.c +5
-3calc.digest, sizeof(calc.digest));if (!rc) { -/* we probably want to replace rsa with hmac here */ -evm_update_evmxattr (dentry, xattr_name, xattr_value, - xattr_value_len); +/* Replace RSA with HMAC if not mounted readonly and +* not immutable +*/ +if (!IS_RDONLY (dentry->d_inode) && + !IS_IMMUTABLE (dentry->d_inode))
Previously patches conformed to Lindent, unless there was a valid reason not to use it, like conflicting with checkpatch.pl. Joe Perches submitted a patch to remove it from the Documentation/CodingStyle a while ago - https://lkml.org/lkml/2013/2/11/390 and recommends using "checkpatch.pl --fix" instead.
Andrew, Greg, what is the current best practice?
thanks,
Mimi
Quoted 6 lines
security/integrity/evm/evm_main.c +3
-0+evm_update_evmxattr (dentry, xattr_name, + xattr_value, + xattr_value_len); }break ;default :
Quoted 34 lines · Mimi Zohar
Quoted 16 lines · Dmitry Kasatkin
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.
Signed-off-by Dmitry Kasatkin <[email protected]>--- security/integrity/evm/evm_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)security/integrity/evm/evm_main.c +0
-0@@ -162,9 +162,14 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, (const char *)xattr_data, xattr_len,security/integrity/evm/evm_main.c static enum integrity_status evm_verify_hmac(struct dentry *dentry, · line 169
Quoted 10 lines
security/integrity/evm/evm_main.c +5
-3calc.digest, sizeof(calc.digest));if (!rc) { -/* we probably want to replace rsa with hmac here */ -evm_update_evmxattr (dentry, xattr_name, xattr_value, - xattr_value_len); +/* Replace RSA with HMAC if not mounted readonly and +* not immutable +*/ +if (!IS_RDONLY (dentry->d_inode) && + !IS_IMMUTABLE (dentry->d_inode))Previously patches conformed to Lindent, unless there was a valid reason not to use it, like conflicting with checkpatch.pl. Joe Perches submitted a patch to remove it from the
Documentation/CodingStylea while ago - https://lkml.org/lkml/2013/2/11/390 and recommends using "checkpatch.pl --fix" instead.
Quoted 1 line
Andrew, Greg, what is the current best practice?
I don't understand, what is wrong with the formatting of this patch? It looks ok to me. If you want to indent the second line of the if to the left some more, that's fine, but just minor nits, nothing major at all.
thanks,
greg k-h
Quoted 35 lines · Greg KH
Quoted 34 lines · Mimi Zohar
Quoted 16 lines · Dmitry Kasatkin
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.
Signed-off-by Dmitry Kasatkin <[email protected]>--- security/integrity/evm/evm_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)security/integrity/evm/evm_main.c +0
-0@@ -162,9 +162,14 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, (const char *)xattr_data, xattr_len,security/integrity/evm/evm_main.c static enum integrity_status evm_verify_hmac(struct dentry *dentry, · line 169
Quoted 10 lines
security/integrity/evm/evm_main.c +5
-3calc.digest, sizeof(calc.digest));if (!rc) { -/* we probably want to replace rsa with hmac here */ -evm_update_evmxattr (dentry, xattr_name, xattr_value, - xattr_value_len); +/* Replace RSA with HMAC if not mounted readonly and +* not immutable +*/ +if (!IS_RDONLY (dentry->d_inode) && + !IS_IMMUTABLE (dentry->d_inode))Previously patches conformed to Lindent, unless there was a valid reason not to use it, like conflicting with checkpatch.pl. Joe Perches submitted a patch to remove it from the
Documentation/CodingStylea while ago - https://lkml.org/lkml/2013/2/11/390 and recommends using "checkpatch.pl --fix" instead.
Quoted 5 lines
Quoted 1 line
Andrew, Greg, what is the current best practice?
I don't understand, what is wrong with the formatting of this patch? It looks ok to me. If you want to indent the second line of the if to the left some more, that's fine, but just minor nits, nothing major at all.
Right, scripts/Lindent is only about formatting, nothing major.
Mimi