Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chris Down" <chris@chrisdown.name>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Harry Yoo" <harry@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Hao Li" <hao.li@linux.dev>, "Christoph Lameter" <cl@gentwo.org>,
	"David Rientjes" <rientjes@google.com>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Kees Cook" <kees@kernel.org>, "Marco Elver" <elver@google.com>,
	"GONG Ruiqi" <gongruiqi@huaweicloud.com>,
	"Jan Kiszka" <jan.kiszka@siemens.com>,
	"Kieran Bingham" <kbingham@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	linux-mm@kvack.org, kernel-team@meta.com
Subject: Re: [PATCH 6/8] slub_kunit: Add a test for the slab_buckets boot parameter
Date: Wed, 28 Oct 2026 07:36:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-187586@kernel.org> (raw)
In-Reply-To: <92d3b7ad95c9b7cdc76eb8f361cc2b374c018edb.1793086056.git.chris@chrisdown.name>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm: slub_kunit: test_slab_buckets() fails on !CONFIG_MMU systems
--

commit 4bcb44da46a191f12f48d8ca5b203a12aabf1dc9
Author: Chris Down <chris@chrisdown.name>

slub_kunit: Add a test for the slab_buckets boot parameter

This commit exposes slab_buckets_enabled to KUnit tests and adds a
test_slab_buckets() test case in lib/tests/slub_kunit.c to verify that
kmem_buckets_create() and memdup_user() behave as expected based on
whether slab_buckets is enabled.

> diff --git a/lib/tests/slub_kunit.c b/lib/tests/slub_kunit.c
> index 49b9942bc564e..646596663b33e 100644
> --- a/lib/tests/slub_kunit.c
> +++ b/lib/tests/slub_kunit.c
[ ... ]
> @@ -396,6 +398,38 @@ static void test_krealloc_redzone_zeroing(struct kunit *test)
>  	kmem_cache_destroy(s);
>  }
>  
> +#ifdef CONFIG_SLAB_BUCKETS
> +static void test_slab_buckets(struct kunit *test)
> +{
> +	unsigned long user_addr;
> +	const char *name;
> +	void *p;
> +
> +	if (!slab_buckets_enabled)
> +		KUNIT_EXPECT_NULL(test, kmem_buckets_create("TestSlub_buckets",
> +							    0, 0, INT_MAX, NULL));
> +
> +	user_addr = kunit_vm_mmap(test, NULL, 0, PAGE_SIZE,
> +				  PROT_READ | PROT_WRITE,
> +				  MAP_ANONYMOUS | MAP_PRIVATE, 0);
> +	KUNIT_ASSERT_NE_MSG(test, user_addr, 0, "Could not create userspace mm");

[Severity: Medium]
Will test_slab_buckets() unconditionally fail on !CONFIG_MMU systems?

Neither CONFIG_SLUB_KUNIT_TEST nor CONFIG_SLAB_BUCKETS depends on
CONFIG_MMU. When test_slab_buckets() runs in a KUnit kthread,
kunit_vm_mmap() calls kunit_vm_mmap_init() -> kunit_attach_mm() in
lib/kunit/user_alloc.c:

	/* arch_pick_mmap_layout() is only sane with MMU systems. */
	if (!IS_ENABLED(CONFIG_MMU))
		return -EINVAL;

On !CONFIG_MMU builds, kunit_vm_mmap() returns 0 and triggers
KUNIT_ASSERT_NE_MSG(test, user_addr, 0, "Could not create userspace mm").

Should test_slab_buckets() check !IS_ENABLED(CONFIG_MMU) and skip the
userspace allocation part of the test with kunit_skip() (similar to
usercopy_test_init() in lib/tests/usercopy_kunit.c)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1793086056.git.chris@chrisdown.name?part=6


  reply	other threads:[~2026-10-28  7:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27  7:35 [PATCH 0/8] mm/slab: Support selecting slab hardening features at boot Chris Down
2026-10-27  7:35 ` [PATCH 1/8] mm/slub: Support disabling freelist hardening " Chris Down
2026-10-27  7:35 ` [PATCH 2/8] slub_kunit: Add a test for slab_freelist_hardened= Chris Down
2026-10-27  7:35 ` [PATCH 3/8] mm/slub: Support disabling freelist randomisation at boot Chris Down
2026-10-27  7:35 ` [PATCH 4/8] slub_kunit: Add a test for slab_freelist_random= Chris Down
2026-10-28  7:36   ` sashiko-bot
2026-10-27  7:35 ` [PATCH 5/8] mm/slab: Support disabling SLAB_BUCKETS at boot Chris Down
2026-10-27  7:36 ` [PATCH 6/8] slub_kunit: Add a test for the slab_buckets boot parameter Chris Down
2026-10-28  7:36   ` sashiko-bot [this message]
2026-10-27  7:36 ` [PATCH 7/8] mm/slab: Support disabling KMALLOC_PARTITION_CACHES at boot Chris Down
2026-10-27  7:36 ` [PATCH 8/8] slub_kunit: Add a test for the kmalloc_partition boot parameter Chris Down
2026-10-27  8:10 ` [PATCH 0/8] mm/slab: Support selecting slab hardening features at boot Vlastimil Babka (SUSE)
2026-10-27 18:31   ` Harry Yoo

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-187586@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chrisdown.name \
    --cc=cl@gentwo.org \
    --cc=corbet@lwn.net \
    --cc=elver@google.com \
    --cc=gongruiqi@huaweicloud.com \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=jan.kiszka@siemens.com \
    --cc=kbingham@kernel.org \
    --cc=kees@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vbabka@kernel.org \
    /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