[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3b997266-067c-975c-911a-da146fe9033a@digikod.net>
Date: Mon, 7 Nov 2022 14:12:13 +0100
From: Mickaël Salaün <mic@...ikod.net>
To: Thomas Weißschuh <linux@...ssschuh.net>,
David Howells <dhowells@...hat.com>,
David Woodhouse <dwmw2@...radead.org>,
Jarkko Sakkinen <jarkko@...nel.org>
Cc: keyrings@...r.kernel.org, linux-kernel@...r.kernel.org,
Mark Pearson <markpearson@...ovo.com>,
Eric Snowberg <eric.snowberg@...cle.com>,
linux-integrity@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [PATCH] certs: Prevent spurious errors on repeated blacklisting
This is a follow-up of
https://lore.kernel.org/r/c8c65713-5cda-43ad-8018-20f2e32e4432@t-8ch.de
Added Jarkko, Mark Pearson, Eric Snowberg and more ML in Cc.
On 04/11/2022 02:47, Thomas Weißschuh wrote:
> When the blacklist keyring was changed to allow updates from the root
> user it gained an ->update() function that disallows all updates.
> When the a hash is blacklisted multiple times from the builtin or
> firmware-provided blacklist this spams prominent logs during boot:
>
> [ 0.890814] blacklist: Problem blacklisting hash (-13)
>
> As all these repeated calls to mark_raw_hash_blacklisted() would create
> the same keyring entry again anyways these errors can be safely ignored.
These errors can indeed be safely ignored, however they highlight issues
with some firmware vendors not checking nor optimizing their blocked
hashes. This raises security concerns, and it should be fixed by
firmware vendors.
>
> Fixes: 6364d106e041 ("certs: Allow root user to append signed hashes to the blacklist keyring")
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
> ---
> certs/blacklist.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/certs/blacklist.c b/certs/blacklist.c
> index 41f10601cc72..5f7f2882ced7 100644
> --- a/certs/blacklist.c
> +++ b/certs/blacklist.c
> @@ -191,7 +191,9 @@ static int mark_raw_hash_blacklisted(const char *hash)
> BLACKLIST_KEY_PERM,
> KEY_ALLOC_NOT_IN_QUOTA |
> KEY_ALLOC_BUILT_IN);
> - if (IS_ERR(key)) {
> +
> + /* Blacklisting the same hash twice fails but would be idempotent */
> + if (IS_ERR(key) && PTR_ERR(key) != -EACCES) {
We should not hide EACCES errors. This logs issues, which is correct for
duplicate hashes, and can help firmware vendors to fix their database.
I'd really like to see a different log message instead: change the
duplicate entry error code from EACCES to EEXIST, and call pr_warn for
this specific case.
> pr_err("Problem blacklisting hash (%ld)\n", PTR_ERR(key));
> return PTR_ERR(key);
> }
>
> base-commit: ee6050c8af96bba2f81e8b0793a1fc2f998fcd20
Powered by blists - more mailing lists