* Re: [PATCH 1/4] evm: skip replacing EVM signature with HMAC on read-only filesystem [not found] ` <aa21c2c52e3cd17825be21aa29ca88019296a712.1411560295.git.d.kasatkin@samsung.com> @ 2014-09-29 16:14 ` Mimi Zohar 2014-09-29 16:23 ` Greg KH 0 siblings, 1 reply; 3+ messages in thread From: Mimi Zohar @ 2014-09-29 16:14 UTC (permalink / raw) To: Andrew Morton Cc: linux-ima-devel, dmitry.kasatkin, linux-kernel, Joe Perches, Andy Whitcroft, Greg KH On Wed, 2014-09-24 at 15:07 +0300, Dmitry Kasatkin wrote: > 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 <d.kasatkin@samsung.com> > --- > security/integrity/evm/evm_main.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c > index 9685af3..a30be77 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, > (const char *)xattr_data, xattr_len, > calc.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 > + evm_update_evmxattr(dentry, xattr_name, > + xattr_value, > + xattr_value_len); > } > break; > default: ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/4] evm: skip replacing EVM signature with HMAC on read-only filesystem 2014-09-29 16:14 ` [PATCH 1/4] evm: skip replacing EVM signature with HMAC on read-only filesystem Mimi Zohar @ 2014-09-29 16:23 ` Greg KH 2014-09-29 16:35 ` Mimi Zohar 0 siblings, 1 reply; 3+ messages in thread From: Greg KH @ 2014-09-29 16:23 UTC (permalink / raw) To: Mimi Zohar Cc: Andrew Morton, linux-ima-devel, dmitry.kasatkin, linux-kernel, Joe Perches, Andy Whitcroft On Mon, Sep 29, 2014 at 12:14:31PM -0400, Mimi Zohar wrote: > On Wed, 2014-09-24 at 15:07 +0300, Dmitry Kasatkin wrote: > > 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 <d.kasatkin@samsung.com> > > --- > > security/integrity/evm/evm_main.c | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c > > index 9685af3..a30be77 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, > > (const char *)xattr_data, xattr_len, > > calc.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? 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/4] evm: skip replacing EVM signature with HMAC on read-only filesystem 2014-09-29 16:23 ` Greg KH @ 2014-09-29 16:35 ` Mimi Zohar 0 siblings, 0 replies; 3+ messages in thread From: Mimi Zohar @ 2014-09-29 16:35 UTC (permalink / raw) To: Greg KH Cc: Andrew Morton, linux-ima-devel, dmitry.kasatkin, linux-kernel, Joe Perches, Andy Whitcroft On Mon, 2014-09-29 at 12:23 -0400, Greg KH wrote: > On Mon, Sep 29, 2014 at 12:14:31PM -0400, Mimi Zohar wrote: > > On Wed, 2014-09-24 at 15:07 +0300, Dmitry Kasatkin wrote: > > > 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 <d.kasatkin@samsung.com> > > > --- > > > security/integrity/evm/evm_main.c | 11 ++++++++--- > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c > > > index 9685af3..a30be77 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, > > > (const char *)xattr_data, xattr_len, > > > calc.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? > > 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-29 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1411560295.git.d.kasatkin@samsung.com>
[not found] ` <aa21c2c52e3cd17825be21aa29ca88019296a712.1411560295.git.d.kasatkin@samsung.com>
2014-09-29 16:14 ` [PATCH 1/4] evm: skip replacing EVM signature with HMAC on read-only filesystem Mimi Zohar
2014-09-29 16:23 ` Greg KH
2014-09-29 16:35 ` Mimi Zohar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox