mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Dmitry Kasatkin <d.kasatkin@samsung.com>,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	linux-ima-devel <linux-ima-devel@lists.sourceforge.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] ima: check xattr value length in ima_inode_setxattr()
Date: Thu, 23 Oct 2014 18:04:05 +0200	[thread overview]
Message-ID: <20141023160405.GC21034@quack.suse.cz> (raw)
In-Reply-To: <CACE9dm9zB0h6CU+oHUowm3=Oy7Kpx9q4tp78pb-5myRCpTXLZA@mail.gmail.com>

On Thu 23-10-14 18:59:07, Dmitry Kasatkin wrote:
> On 23 October 2014 18:40, Jan Kara <jack@suse.cz> wrote:
> > On Thu 23-10-14 16:47:17, Dmitry Kasatkin wrote:
> >> ima_inode_setxattr() can be called with no value. Function does not
> >> check the length so that following command can be used to produce
> >> kernel oops: setfattr -n security.ima FOO. This patch fixes it.
> >>
> > ..
> >>
> >> Reported-by: Jan Kara <jack@suse.cz>
> >> Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
> >> ---
> >>  security/integrity/ima/ima_appraise.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
> >> index 5b845af..f07aacd 100644
> >> --- a/security/integrity/ima/ima_appraise.c
> >> +++ b/security/integrity/ima/ima_appraise.c
> >> @@ -378,6 +378,8 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
> >>       result = ima_protect_xattr(dentry, xattr_name, xattr_value,
> >>                                  xattr_value_len);
> >>       if (result == 1) {
> >> +             if (!xattr_value_len)
> >> +                     return -EINVAL;
> >   Wouldn't it be safer to return EINVAL whenever xattr_value_len !=
> > sizeof(evm_ima_xattr_data)?
> 
> In this function we only use first byte to identify attribute type.
> sizeof(evm_ima_xattr_data) is SHA1_DIGEST_SIZE + 1.
> But IMA may use any other algorithm where digest size is different.
  I see. Thanks for explanation.

								Honza

> >>               ima_reset_appraise_flags(dentry->d_inode,
> >>                        (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0);
> >>               result = 0;
> >> --
> >> 1.9.1
> >>
> > --
> > Jan Kara <jack@suse.cz>
> > SUSE Labs, CR
> 
> 
> 
> -- 
> Thanks,
> Dmitry
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2014-10-23 16:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 13:47 [PATCH 0/2] integrity fixes Dmitry Kasatkin
2014-10-23 13:47 ` [PATCH 1/2] ima: check xattr value length in ima_inode_setxattr() Dmitry Kasatkin
2014-10-23 15:40   ` Jan Kara
2014-10-23 15:59     ` Dmitry Kasatkin
2014-10-23 16:04       ` Jan Kara [this message]
2014-10-24  2:55   ` James Morris
2014-10-24  3:48     ` Mimi Zohar
2014-10-23 13:47 ` [PATCH 2/2] evm: check xattr value length in evm_inode_setxattr() Dmitry Kasatkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141023160405.GC21034@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=d.kasatkin@samsung.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-ima-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome