From: Alexander Potapenko <glider@google.com>
To: glider@google.com
Cc: akpm@linux-foundation.org, ryan.roberts@arm.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
elver@google.com, dvyukov@google.com,
kasan-dev@googlegroups.com
Subject: [PATCH v2 2/2] mm: kmsan: add test_uninit_page
Date: Tue, 13 Jan 2026 10:11:51 +0100 [thread overview]
Message-ID: <20260113091151.4035013-2-glider@google.com> (raw)
In-Reply-To: <20260113091151.4035013-1-glider@google.com>
Test that pages allocated with alloc_page() are uninitialized
by default.
Signed-off-by: Alexander Potapenko <glider@google.com>
---
mm/kmsan/kmsan_test.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/mm/kmsan/kmsan_test.c b/mm/kmsan/kmsan_test.c
index ba44bf2072bbe..81e642db6e239 100644
--- a/mm/kmsan/kmsan_test.c
+++ b/mm/kmsan/kmsan_test.c
@@ -378,6 +378,20 @@ static void test_uaf(struct kunit *test)
KUNIT_EXPECT_TRUE(test, report_matches(&expect));
}
+static void test_uninit_page(struct kunit *test)
+{
+ EXPECTATION_UNINIT_VALUE(expect);
+ struct page *page;
+ int *ptr;
+
+ kunit_info(test, "uninitialized page allocation (UMR report)\n");
+ page = alloc_pages(GFP_KERNEL, 0);
+ ptr = page_address(page);
+ USE(*ptr);
+ __free_pages(page, 0);
+ KUNIT_EXPECT_TRUE(test, report_matches(&expect));
+}
+
static volatile char *test_uaf_pages_helper(int order, int offset)
{
struct page *page;
@@ -727,6 +741,7 @@ static struct kunit_case kmsan_test_cases[] = {
KUNIT_CASE(test_uninit_kmsan_check_memory),
KUNIT_CASE(test_init_kmsan_vmap_vunmap),
KUNIT_CASE(test_init_vmalloc),
+ KUNIT_CASE(test_uninit_page),
KUNIT_CASE(test_uaf),
KUNIT_CASE(test_uaf_pages),
KUNIT_CASE(test_uaf_high_order_pages),
--
2.52.0.457.g6b5491de43-goog
prev parent reply other threads:[~2026-01-13 9:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 9:11 [PATCH v2 1/2] mm: kmsan: add tests for high-order page freeing Alexander Potapenko
2026-01-13 9:11 ` Alexander Potapenko [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=20260113091151.4035013-2-glider@google.com \
--to=glider@google.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox