linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Roberto Sassu <roberto.sassu@huawei.com>,
	paul@paul-moore.com, stephen.smalley.work@gmail.com,
	casey@schaufler-ca.com, stefanb@linux.ibm.com
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, selinux@vger.kernel.org
Subject: Re: [PATCH] evm: Check xattr size misalignment between kernel and user
Date: Mon, 21 Jun 2021 08:22:17 -0400	[thread overview]
Message-ID: <073e829709dcbfb19244b1b1df2c39461297f337.camel@linux.ibm.com> (raw)
In-Reply-To: <20210621093923.1456675-1-roberto.sassu@huawei.com>

On Mon, 2021-06-21 at 11:39 +0200, Roberto Sassu wrote:
> The kernel and the user obtain an xattr value in two different ways:
> 
> kernel (EVM): uses vfs_getxattr_alloc() which obtains the xattr value from
>               the filesystem handler (raw value);
> 
> user (ima-evm-utils): uses vfs_getxattr() which obtains the xattr value
>                       from the LSMs (normalized value).
> 
> Normally, this does not have an impact unless security.selinux is set with
> setfattr, with a value not terminated by '\0' (this is not the recommended
> way, security.selinux should be set with the appropriate tools such as
> chcon and restorecon).
> 
> In this case, the kernel and the user see two different xattr values: the
> former sees the xattr value without '\0' (raw value), the latter sees the
> value with '\0' (value normalized by SELinux).
> 
> This could result in two different verification outcomes from EVM and
> ima-evm-utils, if a signature was calculated with a security.selinux value
> terminated by '\0' and the value set in the filesystem is not terminated by
> '\0'. The former would report verification failure due to the missing '\0',
> while the latter would report verification success (because it gets the
> normalized value with '\0').
> 
> This patch mitigates this issue by comparing in evm_calc_hmac_or_hash() the
> size of the xattr returned by the two xattr functions and by warning the
> user if there is a misalignment.

Instead of "misalignment" how about using the word "discrepancy" here
and in the Subject line?

> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Suggested-by: Mimi Zohar <zohar@linux.ibm.com>

Otherwise, 
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>


      reply	other threads:[~2021-06-21 12:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  9:39 [PATCH] evm: Check xattr size misalignment between kernel and user Roberto Sassu
2021-06-21 12:22 ` Mimi Zohar [this message]

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=073e829709dcbfb19244b1b1df2c39461297f337.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=casey@schaufler-ca.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=roberto.sassu@huawei.com \
    --cc=selinux@vger.kernel.org \
    --cc=stefanb@linux.ibm.com \
    --cc=stephen.smalley.work@gmail.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;
as well as URLs for NNTP newsgroup(s).