From: Stefan Berger <stefanb@linux.ibm.com>
To: Roberto Sassu <roberto.sassu@huaweicloud.com>,
zohar@linux.ibm.com, dmitry.kasatkin@gmail.com
Cc: linux-integrity@vger.kernel.org, vt@altlinux.org, pvorel@suse.cz,
paul@paul-moore.com, casey@schaufler-ca.com,
Roberto Sassu <roberto.sassu@huawei.com>
Subject: Re: [PATCH v3 ima-evm-utils 2/4] Restore correct HMAC calculation for directories
Date: Mon, 19 Jun 2023 11:54:35 -0400 [thread overview]
Message-ID: <3afdbf3f-a08f-bf00-5583-140eb786dcb3@linux.ibm.com> (raw)
In-Reply-To: <20230616192358.314906-3-roberto.sassu@huaweicloud.com>
On 6/16/23 15:23, Roberto Sassu wrote:
> From: Roberto Sassu <roberto.sassu@huawei.com>
>
> Commit 6ecb88352886 ("evmctl: Remove left-over check S_ISDIR() for
> directory signing") removes fetching the inode generation for directories.
>
> While directories might not be signed, EVM currently calculates the HMAC on
> them, including the inode generation.
>
> To keep user space and kernel space aligned, reenable fetching the inode
> generation for directories, and add again the comment that the inode
> generation cannot be obtained for special files.
The user wouldn't notice anything, right?
>
> Fixes: Commit 6ecb88352886 ("evmctl: Remove left-over check S_ISDIR() for directory signing")
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> ---
> src/evmctl.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/evmctl.c b/src/evmctl.c
> index c24261cf0e6..7a3ffd7c823 100644
> --- a/src/evmctl.c
> +++ b/src/evmctl.c
> @@ -1229,7 +1229,11 @@ static int calc_evm_hmac(const char *file, const char *keyfile, unsigned char *s
> goto out;
> }
>
> - if (S_ISREG(st.st_mode)) {
> + if (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode)) {
> + /*
> + * We cannot at the moment get generation of special files..
> + * kernel API does not support it.
> + */
> int fd = open(file, 0);
>
> if (fd < 0) {
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
next prev parent reply other threads:[~2023-06-19 15:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 19:23 [PATCH v3 ima-evm-utils 0/4] Simple EVM HMAC calculation tests Roberto Sassu
2023-06-16 19:23 ` [PATCH v3 ima-evm-utils 1/4] Include the filesystem UUID in HMAC calculation Roberto Sassu
2023-06-19 15:51 ` Stefan Berger
2023-06-16 19:23 ` [PATCH v3 ima-evm-utils 2/4] Restore correct HMAC calculation for directories Roberto Sassu
2023-06-19 15:54 ` Stefan Berger [this message]
2023-06-19 15:59 ` Roberto Sassu
2023-06-16 19:23 ` [PATCH v3 ima-evm-utils 3/4] Add --hmackey option for evmctl Roberto Sassu
2023-06-19 15:59 ` Stefan Berger
2023-06-16 19:23 ` [PATCH v3 ima-evm-utils 4/4] Add simple tests to check EVM HMAC calculation Roberto Sassu
2023-06-23 11:42 ` Mimi Zohar
2023-06-23 11:45 ` Roberto Sassu
2023-06-23 14:30 ` Mimi Zohar
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=3afdbf3f-a08f-bf00-5583-140eb786dcb3@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=casey@schaufler-ca.com \
--cc=dmitry.kasatkin@gmail.com \
--cc=linux-integrity@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=pvorel@suse.cz \
--cc=roberto.sassu@huawei.com \
--cc=roberto.sassu@huaweicloud.com \
--cc=vt@altlinux.org \
--cc=zohar@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.