All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-stable] mm-rodata_test-verify-test-data-is-unchanged-rather-than-non-zero.patch removed from -mm tree
@ 2025-01-14  6:42 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-01-14  6:42 UTC (permalink / raw)
  To: mm-commits, kees, jinb.park7, ptesarik, akpm


The quilt patch titled
     Subject: mm/rodata_test: verify test data is unchanged, rather than non-zero
has been removed from the -mm tree.  Its filename was
     mm-rodata_test-verify-test-data-is-unchanged-rather-than-non-zero.patch

This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Petr Tesarik <ptesarik@suse.com>
Subject: mm/rodata_test: verify test data is unchanged, rather than non-zero
Date: Tue, 19 Nov 2024 12:37:39 +0100

Verify that the test variable holds the initialization value, rather than
any non-zero value.

Link: https://lkml.kernel.org/r/386ffda192eb4a26f68c526c496afd48a5cd87ce.1732016064.git.ptesarik@suse.com
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Cc: Jinbum Park <jinb.park7@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/rodata_test.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/mm/rodata_test.c~mm-rodata_test-verify-test-data-is-unchanged-rather-than-non-zero
+++ a/mm/rodata_test.c
@@ -12,7 +12,8 @@
 #include <linux/mm.h>
 #include <asm/sections.h>
 
-static const int rodata_test_data = 0xC3;
+#define TEST_VALUE 0xC3
+static const int rodata_test_data = TEST_VALUE;
 
 void rodata_test(void)
 {
@@ -20,7 +21,7 @@ void rodata_test(void)
 
 	/* test 1: read the value */
 	/* If this test fails, some previous testrun has clobbered the state */
-	if (!READ_ONCE(rodata_test_data)) {
+	if (unlikely(READ_ONCE(rodata_test_data) != TEST_VALUE)) {
 		pr_err("test 1 fails (start data)\n");
 		return;
 	}
@@ -33,7 +34,7 @@ void rodata_test(void)
 	}
 
 	/* test 3: check the value hasn't changed */
-	if (READ_ONCE(rodata_test_data) == zero) {
+	if (unlikely(READ_ONCE(rodata_test_data) != TEST_VALUE)) {
 		pr_err("test data was changed\n");
 		return;
 	}
_

Patches currently in -mm which might be from ptesarik@suse.com are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-14  6:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14  6:42 [merged mm-stable] mm-rodata_test-verify-test-data-is-unchanged-rather-than-non-zero.patch removed from -mm tree Andrew Morton

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.