From: sashiko-bot@kernel.org
To: "Blaise Boscaccy" <bboscaccy@linux.microsoft.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v5 03/10] crypto: pkcs7: add tests for pkcs7_get_authattr
Date: Tue, 21 Apr 2026 02:06:42 +0000 [thread overview]
Message-ID: <20260421020643.5E39BC19425@smtp.kernel.org> (raw)
In-Reply-To: <20260420212653.438685-4-bboscaccy@linux.microsoft.com>
Sashiko AI review found 1 potential issue(s):
- [Medium] Test failures are silently masked by unconditionally returning 0.
--
commit 11447b57d9861b91fcbcb5b89dcfd93489f5f252
Author: James Bottomley <James.Bottomley@HansenPartnership.com>
crypto: pkcs7: add tests for pkcs7_get_authattr
This commit adds example code to the pkcs7_key_type test module to verify
a message and extract a known authenticated attribute.
> diff --git a/crypto/asymmetric_keys/pkcs7_key_type.c b/crypto/asymmetric_keys/pkcs7_key_type.c
> index b930d3bbf1af5..e0b1ce0202f6d 100644
> --- a/crypto/asymmetric_keys/pkcs7_key_type.c
> +++ b/crypto/asymmetric_keys/pkcs7_key_type.c
[ ... ]
> @@ -51,16 +52,57 @@ static int pkcs7_view_content(void *ctx, const void *data, size_t len,
> static int pkcs7_preparse(struct key_preparsed_payload *prep)
> {
[ ... ]
> + /*
> + * the parsed message has no trusted signer, so nothing should
> + * be returned here
> + */
> + ret = pkcs7_get_authattr(pkcs7, OID_messageDigest, &data, &len);
> + if (ret == 0) {
> + pr_err("OID returned when no trust in signer\n");
> + goto out;
Should a negative error code be assigned to ret here before jumping to out?
> + }
> + /* add trust and check again */
> + ret = verify_pkcs7_message_sig(NULL, 0, pkcs7,
> + VERIFY_USE_SECONDARY_KEYRING, usage,
> + NULL, NULL);
> + if (ret) {
> + pr_err("verify_pkcs7_message_sig failed!!\n");
> + goto out;
> + }
> + /* now we should find the OID */
> + ret = pkcs7_get_authattr(pkcs7, OID_messageDigest, &data, &len);
> + if (ret) {
> + pr_err("Failed to get message digest\n");
> + goto out;
> + }
> + pr_info("Correctly Got message hash, size=%zu\n", len);
> +
> + out:
> + pkcs7_free_message(pkcs7);
> + return 0;
Does this return 0 unconditionally mask the test failures?
If any of the checks above fail and jump to the out label, the function
returns 0, effectively discarding the error state. As a result, the key
instantiation will always succeed from the perspective of user space, and
test frameworks might incorrectly assume the test passed.
Should this return ret instead?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260420212653.438685-1-bboscaccy@linux.microsoft.com?part=3
next prev parent reply other threads:[~2026-04-21 2:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 21:26 [PATCH v5 00/10] Reintroduce Hornet LSM Blaise Boscaccy
2026-04-20 21:26 ` [PATCH v5 01/10] crypto: pkcs7: add flag for validated trust on a signed info block Blaise Boscaccy
2026-04-21 1:17 ` sashiko-bot
2026-04-20 21:26 ` [PATCH v5 02/10] crypto: pkcs7: add ability to extract signed attributes by OID Blaise Boscaccy
2026-04-21 1:49 ` sashiko-bot
2026-04-20 21:26 ` [PATCH v5 03/10] crypto: pkcs7: add tests for pkcs7_get_authattr Blaise Boscaccy
2026-04-21 2:06 ` sashiko-bot [this message]
2026-04-20 21:26 ` [PATCH v5 04/10] lsm: framework for BPF integrity verification Blaise Boscaccy
2026-04-20 21:26 ` [PATCH v5 05/10] lsm: security: Add additional enum values for bpf integrity checks Blaise Boscaccy
2026-04-20 21:26 ` [PATCH v5 06/10] security: Hornet LSM Blaise Boscaccy
2026-04-21 0:08 ` Fan Wu
2026-04-29 18:34 ` Blaise Boscaccy
2026-04-21 4:29 ` sashiko-bot
2026-04-23 18:37 ` [PATCH v5 6/10] " Paul Moore
2026-04-20 21:26 ` [PATCH v5 07/10] hornet: Introduce gen_sig Blaise Boscaccy
2026-04-21 0:18 ` Fan Wu
2026-04-21 3:03 ` sashiko-bot
2026-04-20 21:26 ` [PATCH v5 08/10] hornet: Add a light skeleton data extractor scripts Blaise Boscaccy
2026-04-21 3:06 ` sashiko-bot
2026-04-20 21:26 ` [PATCH v5 09/10] selftests/hornet: Add a selftest for the Hornet LSM Blaise Boscaccy
2026-04-21 3:04 ` sashiko-bot
2026-04-20 21:26 ` [PATCH v5 10/10] ipe: Add BPF program load policy enforcement via Hornet integration Blaise Boscaccy
2026-04-21 0:27 ` Fan Wu
2026-04-29 18:35 ` Blaise Boscaccy
2026-04-21 3:23 ` sashiko-bot
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=20260421020643.5E39BC19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bboscaccy@linux.microsoft.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko@lists.linux.dev \
/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.