mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Kasatkin <d.kasatkin@samsung.com>
Cc: zohar@linux.vnet.ibm.com, linux-security-module@vger.kernel.org,
	linux-ima-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, jack@suse.cz,
	dmitry.kasatkin@gmail.com
Subject: Re: [PATCH 1/2] ima: check xattr value length in ima_inode_setxattr()
Date: Thu, 23 Oct 2014 17:40:07 +0200	[thread overview]
Message-ID: <20141023154007.GA21034@quack.suse.cz> (raw)
In-Reply-To: <5b1f234e8515c10c96a16868ff4341f29460f38f.1414071910.git.d.kasatkin@samsung.com>

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)?

								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

  reply	other threads:[~2014-10-23 15:40 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 [this message]
2014-10-23 15:59     ` Dmitry Kasatkin
2014-10-23 16:04       ` Jan Kara
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=20141023154007.GA21034@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