Commit a872eb21 authored by Christophe Leroy's avatar Christophe Leroy Committed by Linus Torvalds

mm: fix RODATA_TEST failure "rodata_test: test data was not read only"

On powerpc, RODATA_TEST fails with message the following messages:

  Freeing unused kernel memory: 528K
  rodata_test: test data was not read only

This is because GCC allocates it to .data section:

  c0695034 g     O .data	00000004 rodata_test_data

Since commit 056b9d8a ("mm: remove rodata_test_data export, add
pr_fmt"), rodata_test_data is used only inside rodata_test.c By
declaring it static, it gets properly allocated into .rodata section
instead of .data:

  c04df710 l     O .rodata	00000004 rodata_test_data

Fixes: 056b9d8a ("mm: remove rodata_test_data export, add pr_fmt")
Link: 's avatarChristophe Leroy <>
Cc: Kees Cook <>
Cc: Jinbum Park <>
Cc: Segher Boessenkool <>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: <>
Signed-off-by: 's avatarAndrew Morton <>
Signed-off-by: 's avatarLinus Torvalds <>
parent 31d1e130
......@@ -14,7 +14,7 @@
#include <linux/uaccess.h>
#include <asm/sections.h>
const int rodata_test_data = 0xC3;
static const int rodata_test_data = 0xC3;
void rodata_test(void)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment