All of lore.kernel.org
 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 skcipher tests
Date: Sun, 06 Dec 2026 07:07:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-252231@kernel.org> (raw)
In-Reply-To: <20261206065824.452509-1-ebiggers@kernel.org>

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

commit 21b28950dc01e2cbd959553b9ea1f78a12029eae
Author: Eric Biggers <ebiggers@kernel.org>

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

This commit extends test_skcipher_monte_carlo() and gen-skcipher-testvecs.py
to test additional data lengths from 4096 up to 65536 bytes, and updates the
expected Monte-Carlo checksums in the six AES skcipher KUnit test suites.

> diff --git a/lib/crypto/tests/skcipher-test-template.h b/lib/crypto/tests/skcipher-test-template.h
> index e68be28b003b9..268af5f381426 100644
> --- a/lib/crypto/tests/skcipher-test-template.h
> +++ b/lib/crypto/tests/skcipher-test-template.h
> @@ -394,15 +394,20 @@ static void test_skcipher_all_key_lens(struct kunit *test)
[ ... ]
>  static void test_skcipher_monte_carlo(struct kunit *test)
>  {
> -	const size_t max_data_len = 1024;
> +	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;
>  	u8 raw_key[SKCIPHER_MAX_KEY_LEN];
>  	u8 orig_iv[SKCIPHER_IV_BUF_SIZE];
>  	u8 iv[SKCIPHER_IV_BUF_SIZE];

[Severity: Low]
Can the three 64 KiB alloc_buf() allocations for pt, ct, and decrypted fail
under memory fragmentation?

alloc_buf() calls kunit_kmalloc(test, size, GFP_KERNEL) with no vmalloc
fallback.  On 4 KiB page systems, 65536 bytes is an order-4 allocation,
above PAGE_ALLOC_COSTLY_ORDER (3).

Without __GFP_RETRY_MAYFAIL, __alloc_pages_slowpath() skips reclaim and
compaction retries under fragmentation and returns NULL, causing spurious
KUNIT_ASSERT_NOT_NULL() test failures.

Using a kvmalloc()/vmalloc()-backed helper such as alloc_guarded_buf() would
avoid order-4 physically contiguous allocations here.

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

      reply	other threads:[~2026-12-06  7:07 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 skcipher tests Eric Biggers
2026-12-06  7:07 ` 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-252231@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 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.