From: Mimi Zohar <zohar@linux.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: "Mimi Zohar" <zohar@linux.ibm.com>,
"Jarkko Sakkinen" <jarkko@kernel.org>,
"David Howells" <dhowells@redhat.com>,
"Roberto Sassu" <roberto.sassu@huawei.com>,
"Mickaël Salaün" <mic@digikod.net>,
keyrings@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] integrity: use is_key_blacklisted() in asymmetric_verify()
Date: Fri, 6 Nov 2026 12:31:48 -0500 [thread overview]
Message-ID: <20261106173149.707244-3-zohar@linux.ibm.com> (raw)
In-Reply-To: <20261106173149.707244-1-zohar@linux.ibm.com>
request_asymmetric_key() checks the key ID against the experimental IMA
blacklist keyring before looking up the key. The key ID in the
security.ima xattr is only an abbreviated (32-bit) form of the SKID, so
the key must be looked up first to obtain its complete SKID.
Look the key up, then pass the key found to is_key_blacklisted(), which
compares its complete SKID against the system blacklist. A blacklisted
key, or any error from the check, rejects the key.
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
security/integrity/digsig_asymmetric.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/security/integrity/digsig_asymmetric.c b/security/integrity/digsig_asymmetric.c
index b4c23a0ed68f..731f3b0009ab 100644
--- a/security/integrity/digsig_asymmetric.c
+++ b/security/integrity/digsig_asymmetric.c
@@ -23,23 +23,12 @@ static struct key *request_asymmetric_key(struct key *keyring, uint32_t keyid)
{
struct key *key;
char name[12];
+ int ret;
sprintf(name, "id:%08x", keyid);
pr_debug("key search: \"%s\"\n", name);
- key = get_ima_blacklist_keyring();
- if (key) {
- key_ref_t kref;
-
- kref = keyring_search(make_key_ref(key, 1),
- &key_type_asymmetric, name, true);
- if (!IS_ERR(kref)) {
- pr_err("Key '%s' is in ima_blacklist_keyring\n", name);
- return ERR_PTR(-EKEYREJECTED);
- }
- }
-
if (keyring) {
/* search in specific keyring */
key_ref_t kref;
@@ -74,6 +63,18 @@ static struct key *request_asymmetric_key(struct key *keyring, uint32_t keyid)
}
}
+ /*
+ * Check the key actually selected by the lookup against the system
+ * blacklist, so that a revoked key stops verifying even if it cannot be
+ * removed from the keyring. Fail closed on any error.
+ */
+ ret = is_key_blacklisted(key);
+ if (ret) {
+ pr_err("Key '%s' is blacklisted\n", name);
+ key_put(key);
+ return ERR_PTR(ret);
+ }
+
pr_debug("%s() = 0 [%x]\n", __func__, key_serial(key));
return key;
--
2.56.0
next prev parent reply other threads:[~2026-11-06 17:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 17:31 [PATCH 0/3] ima: use the system blacklist in lieu of the IMA blacklist keyring Mimi Zohar
2026-11-06 17:31 ` [PATCH 1/3] certs: blacklist: define skid: entries and add is_key_blacklisted() Mimi Zohar
2026-11-06 17:40 ` sashiko-bot
2026-11-06 17:31 ` Mimi Zohar [this message]
2026-11-06 17:31 ` [PATCH 3/3] ima: remove the experimental IMA blacklist keyring 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=20261106173149.707244-3-zohar@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=dhowells@redhat.com \
--cc=jarkko@kernel.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mic@digikod.net \
--cc=roberto.sassu@huawei.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.