Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eric Biggers" <ebiggers@kernel.org>, linux-crypto@vger.kernel.org
Cc: "Ard Biesheuvel" <ardb@kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>
Subject: Re: [PATCH] lib/crypto: tests: Test some longer lengths in AEAD tests
Date: Sun, 06 Dec 2026 07:08:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-252232@kernel.org> (raw)
In-Reply-To: <20261206065847.452749-1-ebiggers@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] lib/crypto: order-4 kmalloc() in test_aead_monte_carlo() exceeds
  costly order
--

commit 55dddd51268c30bf76d6b3b8102ea572f5972e8b
Author: Eric Biggers <ebiggers@kernel.org>

lib/crypto: tests: Test some longer lengths in AEAD tests

This commit extends test_aead_monte_carlo() and gen-aead-testvecs.py to test
additional data and associated data lengths up to 65536 bytes, and updates
the expected AES-CCM and AES-GCM Monte-Carlo checksums.

> diff --git a/lib/crypto/tests/aead-test-template.h b/lib/crypto/tests/aead-test-template.h
> index 7689567c86f9b..a841a51bc3426 100644
> --- a/lib/crypto/tests/aead-test-template.h
> +++ b/lib/crypto/tests/aead-test-template.h
> @@ -738,13 +738,21 @@ static void test_aead_inplace(struct kunit *test)

[ ... ]

>  static void test_aead_monte_carlo(struct kunit *test)
>  {
> -	const size_t max_data_len = 1024;
> -	const size_t max_ad_len = 293;
> +	static const size_t extra_lens[] = {
> +		4096,  4111,  8192,  16384, 16400, 32752, 32767,
> +		32768, 32769, 32784, 49152, 65520, 65535, 65536,
> +	};
> +	const size_t max_data_len = 65536;
> +	const size_t max_ad_len = 65536;

[Severity: Low]
Can raising max_data_len and max_ad_len to 65536 cause spurious failures in
test_aead_monte_carlo() under memory fragmentation?

pt, ct, decrypted, and ad are allocated via alloc_buf(), which calls
kunit_kmalloc(..., GFP_KERNEL) and asserts non-NULL.  On 4 KiB page kernels,
each 65536-byte allocation is an order-4 physically contiguous request above
PAGE_ALLOC_COSTLY_ORDER (3).

Because plain GFP_KERNEL omits __GFP_RETRY_MAYFAIL, loading the AES-CCM or
AES-GCM KUnit modules on a fragmented system can fail any of these four
allocations.  Using alloc_guarded_buf() or a kvmalloc()-backed helper would
avoid order-4 allocations.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206065847.452749-1-ebiggers@kernel.org?part=1

      reply	other threads:[~2026-12-06  7:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  6:58 [PATCH] lib/crypto: tests: Test some longer lengths in AEAD tests Eric Biggers
2026-12-06  7:08 ` sashiko-bot [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=sashiko-outbox-252232@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox