* [PATCH] loongarch: improve logging of disabling KASLR.
@ 2026-04-03 6:30 Yuqian Yang
2026-04-12 4:42 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yuqian Yang @ 2026-04-03 6:30 UTC (permalink / raw)
To: Huacai Chen
Cc: WANG Xuerui, Cheng Nie, Wentao Guan, Dandan Zhang, loongarch,
linux-kernel, Yuqian Yang
Whether KASLR is disabled is not handled in nokaslr (early param
"nokaslr" setup function) but in kaslr_disabled. However, the logging
was done in nokaslr previously. So we move the logging to the right
place and add more specific info about why it's disabled.
Suggested-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: Yuqian Yang <yangyuqian@uniontech.com>
---
arch/loongarch/kernel/relocate.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/arch/loongarch/kernel/relocate.c b/arch/loongarch/kernel/relocate.c
index 82aa3f0359278..be11096c3c009 100644
--- a/arch/loongarch/kernel/relocate.c
+++ b/arch/loongarch/kernel/relocate.c
@@ -128,9 +128,8 @@ static inline __init unsigned long get_random_boot(void)
static int __init nokaslr(char *p)
{
- pr_info("KASLR is disabled.\n");
-
- return 0; /* Print a notice and silence the boot warning */
+ /* The real check is handled in kaslr_disabled() below. */
+ return 0;
}
early_param("nokaslr", nokaslr);
@@ -138,14 +137,19 @@ static inline __init bool kaslr_disabled(void)
{
char *str;
const char *builtin_cmdline = CONFIG_CMDLINE;
+ const char *const message = "KASLR is disabled by %s in %s cmdline.\n";
str = strstr(builtin_cmdline, "nokaslr");
- if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' '))
+ if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' ')) {
+ pr_info(message, "nokaslr", "built-in");
return true;
+ }
str = strstr(boot_command_line, "nokaslr");
- if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' '))
+ if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' ')) {
+ pr_info(message, "nokaslr", "boot");
return true;
+ }
#ifdef CONFIG_HIBERNATION
str = strstr(builtin_cmdline, "nohibernate");
@@ -165,17 +169,23 @@ static inline __init bool kaslr_disabled(void)
return false;
str = strstr(builtin_cmdline, "resume=");
- if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' '))
+ if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' ')) {
+ pr_info(message, "resume=", "built-in");
return true;
+ }
str = strstr(boot_command_line, "resume=");
- if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' '))
+ if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' ')) {
+ pr_info(message, "resume=", "boot");
return true;
+ }
#endif
str = strstr(boot_command_line, "kexec_file");
- if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' '))
+ if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' ')) {
+ pr_info(message, "kexec_file", "boot");
return true;
+ }
return false;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] loongarch: improve logging of disabling KASLR.
2026-04-03 6:30 [PATCH] loongarch: improve logging of disabling KASLR Yuqian Yang
@ 2026-04-12 4:42 ` kernel test robot
2026-04-12 8:58 ` kernel test robot
2026-04-13 8:29 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-04-12 4:42 UTC (permalink / raw)
To: Yuqian Yang, Huacai Chen
Cc: oe-kbuild-all, WANG Xuerui, Cheng Nie, Wentao Guan, Dandan Zhang,
loongarch, linux-kernel, Yuqian Yang
Hi Yuqian,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v7.0-rc7 next-20260410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yuqian-Yang/loongarch-improve-logging-of-disabling-KASLR/20260412-053808
base: linus/master
patch link: https://lore.kernel.org/r/E4B91143DC525DC6%2B20260403063008.94237-1-yangyuqian%40uniontech.com
patch subject: [PATCH] loongarch: improve logging of disabling KASLR.
config: loongarch-randconfig-002-20260412 (https://download.01.org/0day-ci/archive/20260412/202604121225.WqIkc3ZK-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260412/202604121225.WqIkc3ZK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604121225.WqIkc3ZK-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/asm-generic/bug.h:31,
from arch/loongarch/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/instrumented.h:10,
from include/linux/atomic/atomic-instrumented.h:17,
from include/linux/atomic.h:82,
from include/asm-generic/bitops/atomic.h:5,
from arch/loongarch/include/asm/bitops.h:38,
from include/linux/bitops.h:67,
from include/linux/bitmap.h:8,
from include/linux/nodemask.h:91,
from include/linux/list_lru.h:12,
from include/linux/fs/super_types.h:7,
from include/linux/fs/super.h:5,
from include/linux/fs.h:5,
from arch/loongarch/include/asm/elf.h:9,
from include/linux/elf.h:6,
from arch/loongarch/kernel/relocate.c:8:
arch/loongarch/kernel/relocate.c: In function 'kaslr_disabled':
arch/loongarch/kernel/relocate.c:144:25: error: expected ')' before 'message'
144 | pr_info(message, "nokaslr", "built-in");
| ^~~~~~~
include/linux/printk.h:483:25: note: in definition of macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/printk.h:584:26: note: in expansion of macro 'pr_fmt'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:144:17: note: in expansion of macro 'pr_info'
144 | pr_info(message, "nokaslr", "built-in");
| ^~~~~~~
include/linux/printk.h:483:24: note: to match this '('
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
include/linux/printk.h:511:26: note: in expansion of macro 'printk_index_wrap'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:144:17: note: in expansion of macro 'pr_info'
144 | pr_info(message, "nokaslr", "built-in");
| ^~~~~~~
arch/loongarch/kernel/relocate.c:150:25: error: expected ')' before 'message'
150 | pr_info(message, "nokaslr", "boot");
| ^~~~~~~
include/linux/printk.h:483:25: note: in definition of macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/printk.h:584:26: note: in expansion of macro 'pr_fmt'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:150:17: note: in expansion of macro 'pr_info'
150 | pr_info(message, "nokaslr", "boot");
| ^~~~~~~
include/linux/printk.h:483:24: note: to match this '('
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
include/linux/printk.h:511:26: note: in expansion of macro 'printk_index_wrap'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:150:17: note: in expansion of macro 'pr_info'
150 | pr_info(message, "nokaslr", "boot");
| ^~~~~~~
arch/loongarch/kernel/relocate.c:186:25: error: expected ')' before 'message'
186 | pr_info(message, "kexec_file", "boot");
| ^~~~~~~
include/linux/printk.h:483:25: note: in definition of macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/printk.h:584:26: note: in expansion of macro 'pr_fmt'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:186:17: note: in expansion of macro 'pr_info'
186 | pr_info(message, "kexec_file", "boot");
| ^~~~~~~
include/linux/printk.h:483:24: note: to match this '('
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
include/linux/printk.h:511:26: note: in expansion of macro 'printk_index_wrap'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:186:17: note: in expansion of macro 'pr_info'
186 | pr_info(message, "kexec_file", "boot");
| ^~~~~~~
>> arch/loongarch/kernel/relocate.c:140:27: warning: unused variable 'message' [-Wunused-variable]
140 | const char *const message = "KASLR is disabled by %s in %s cmdline.\n";
| ^~~~~~~
vim +/message +140 arch/loongarch/kernel/relocate.c
135
136 static inline __init bool kaslr_disabled(void)
137 {
138 char *str;
139 const char *builtin_cmdline = CONFIG_CMDLINE;
> 140 const char *const message = "KASLR is disabled by %s in %s cmdline.\n";
141
142 str = strstr(builtin_cmdline, "nokaslr");
143 if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' ')) {
144 pr_info(message, "nokaslr", "built-in");
145 return true;
146 }
147
148 str = strstr(boot_command_line, "nokaslr");
149 if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' ')) {
150 pr_info(message, "nokaslr", "boot");
151 return true;
152 }
153
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] loongarch: improve logging of disabling KASLR.
2026-04-03 6:30 [PATCH] loongarch: improve logging of disabling KASLR Yuqian Yang
2026-04-12 4:42 ` kernel test robot
@ 2026-04-12 8:58 ` kernel test robot
2026-04-13 8:29 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-04-12 8:58 UTC (permalink / raw)
To: Yuqian Yang, Huacai Chen
Cc: oe-kbuild-all, WANG Xuerui, Cheng Nie, Wentao Guan, Dandan Zhang,
loongarch, linux-kernel, Yuqian Yang
Hi Yuqian,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v7.0-rc7 next-20260410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yuqian-Yang/loongarch-improve-logging-of-disabling-KASLR/20260412-053808
base: linus/master
patch link: https://lore.kernel.org/r/E4B91143DC525DC6%2B20260403063008.94237-1-yangyuqian%40uniontech.com
patch subject: [PATCH] loongarch: improve logging of disabling KASLR.
config: loongarch-randconfig-002-20260412 (https://download.01.org/0day-ci/archive/20260412/202604121652.1axNYwys-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260412/202604121652.1axNYwys-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604121652.1axNYwys-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/asm-generic/bug.h:31,
from arch/loongarch/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/instrumented.h:10,
from include/linux/atomic/atomic-instrumented.h:17,
from include/linux/atomic.h:82,
from include/asm-generic/bitops/atomic.h:5,
from arch/loongarch/include/asm/bitops.h:38,
from include/linux/bitops.h:67,
from include/linux/bitmap.h:8,
from include/linux/nodemask.h:91,
from include/linux/list_lru.h:12,
from include/linux/fs/super_types.h:7,
from include/linux/fs/super.h:5,
from include/linux/fs.h:5,
from arch/loongarch/include/asm/elf.h:9,
from include/linux/elf.h:6,
from arch/loongarch/kernel/relocate.c:8:
arch/loongarch/kernel/relocate.c: In function 'kaslr_disabled':
>> arch/loongarch/kernel/relocate.c:144:25: error: expected ')' before 'message'
144 | pr_info(message, "nokaslr", "built-in");
| ^~~~~~~
include/linux/printk.h:483:25: note: in definition of macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/printk.h:584:26: note: in expansion of macro 'pr_fmt'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:144:17: note: in expansion of macro 'pr_info'
144 | pr_info(message, "nokaslr", "built-in");
| ^~~~~~~
include/linux/printk.h:483:24: note: to match this '('
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
include/linux/printk.h:511:26: note: in expansion of macro 'printk_index_wrap'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:144:17: note: in expansion of macro 'pr_info'
144 | pr_info(message, "nokaslr", "built-in");
| ^~~~~~~
arch/loongarch/kernel/relocate.c:150:25: error: expected ')' before 'message'
150 | pr_info(message, "nokaslr", "boot");
| ^~~~~~~
include/linux/printk.h:483:25: note: in definition of macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/printk.h:584:26: note: in expansion of macro 'pr_fmt'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:150:17: note: in expansion of macro 'pr_info'
150 | pr_info(message, "nokaslr", "boot");
| ^~~~~~~
include/linux/printk.h:483:24: note: to match this '('
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
include/linux/printk.h:511:26: note: in expansion of macro 'printk_index_wrap'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:150:17: note: in expansion of macro 'pr_info'
150 | pr_info(message, "nokaslr", "boot");
| ^~~~~~~
arch/loongarch/kernel/relocate.c:186:25: error: expected ')' before 'message'
186 | pr_info(message, "kexec_file", "boot");
| ^~~~~~~
include/linux/printk.h:483:25: note: in definition of macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/printk.h:584:26: note: in expansion of macro 'pr_fmt'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:186:17: note: in expansion of macro 'pr_info'
186 | pr_info(message, "kexec_file", "boot");
| ^~~~~~~
include/linux/printk.h:483:24: note: to match this '('
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
include/linux/printk.h:511:26: note: in expansion of macro 'printk_index_wrap'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:584:9: note: in expansion of macro 'printk'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
arch/loongarch/kernel/relocate.c:186:17: note: in expansion of macro 'pr_info'
186 | pr_info(message, "kexec_file", "boot");
| ^~~~~~~
arch/loongarch/kernel/relocate.c:140:27: warning: unused variable 'message' [-Wunused-variable]
140 | const char *const message = "KASLR is disabled by %s in %s cmdline.\n";
| ^~~~~~~
vim +144 arch/loongarch/kernel/relocate.c
> 8 #include <linux/elf.h>
9 #include <linux/kernel.h>
10 #include <linux/printk.h>
11 #include <linux/panic_notifier.h>
12 #include <linux/start_kernel.h>
13 #include <asm/bootinfo.h>
14 #include <asm/early_ioremap.h>
15 #include <asm/inst.h>
16 #include <asm/io.h>
17 #include <asm/sections.h>
18 #include <asm/setup.h>
19
20 #define RELOCATED(x) ((void *)((long)x + reloc_offset))
21 #define RELOCATED_KASLR(x) ((void *)((long)x + random_offset))
22
23 static unsigned long reloc_offset;
24
25 static inline void __init relocate_relative(void)
26 {
27 Elf64_Rela *rela, *rela_end;
28 rela = (Elf64_Rela *)&__rela_dyn_begin;
29 rela_end = (Elf64_Rela *)&__rela_dyn_end;
30
31 for ( ; rela < rela_end; rela++) {
32 Elf64_Addr addr = rela->r_offset;
33 Elf64_Addr relocated_addr = rela->r_addend;
34
35 if (rela->r_info != R_LARCH_RELATIVE)
36 continue;
37
38 relocated_addr = (Elf64_Addr)RELOCATED(relocated_addr);
39 *(Elf64_Addr *)RELOCATED(addr) = relocated_addr;
40 }
41
42 #ifdef CONFIG_RELR
43 u64 *addr = NULL;
44 u64 *relr = (u64 *)&__relr_dyn_begin;
45 u64 *relr_end = (u64 *)&__relr_dyn_end;
46
47 for ( ; relr < relr_end; relr++) {
48 if ((*relr & 1) == 0) {
49 addr = (u64 *)(*relr + reloc_offset);
50 *addr++ += reloc_offset;
51 } else {
52 for (u64 *p = addr, r = *relr >> 1; r; p++, r >>= 1)
53 if (r & 1)
54 *p += reloc_offset;
55 addr += 63;
56 }
57 }
58 #endif
59 }
60
61 static inline void __init relocate_absolute(long random_offset)
62 {
63 void *begin, *end;
64 struct rela_la_abs *p;
65
66 begin = RELOCATED_KASLR(&__la_abs_begin);
67 end = RELOCATED_KASLR(&__la_abs_end);
68
69 for (p = begin; (void *)p < end; p++) {
70 long v = p->symvalue;
71 uint32_t lu12iw, ori;
72 #ifdef CONFIG_64BIT
73 uint32_t lu32id, lu52id;
74 #endif
75 union loongarch_instruction *insn = (void *)p->pc;
76
77 lu12iw = (v >> 12) & 0xfffff;
78 ori = v & 0xfff;
79 #ifdef CONFIG_64BIT
80 lu32id = (v >> 32) & 0xfffff;
81 lu52id = v >> 52;
82 #endif
83
84 insn[0].reg1i20_format.immediate = lu12iw;
85 insn[1].reg2i12_format.immediate = ori;
86 #ifdef CONFIG_64BIT
87 insn[2].reg1i20_format.immediate = lu32id;
88 insn[3].reg2i12_format.immediate = lu52id;
89 #endif
90 }
91 }
92
93 #ifdef CONFIG_RANDOMIZE_BASE
94 static inline __init unsigned long rotate_xor(unsigned long hash,
95 const void *area, size_t size)
96 {
97 size_t i, diff;
98 const typeof(hash) *ptr = PTR_ALIGN(area, sizeof(hash));
99
100 diff = (void *)ptr - area;
101 if (size < diff + sizeof(hash))
102 return hash;
103
104 size = ALIGN_DOWN(size - diff, sizeof(hash));
105
106 for (i = 0; i < size / sizeof(hash); i++) {
107 /* Rotate by odd number of bits and XOR. */
108 hash = (hash << ((sizeof(hash) * 8) - 7)) | (hash >> 7);
109 hash ^= ptr[i];
110 }
111
112 return hash;
113 }
114
115 static inline __init unsigned long get_random_boot(void)
116 {
117 unsigned long hash = 0;
118 unsigned long entropy = random_get_entropy();
119
120 /* Attempt to create a simple but unpredictable starting entropy. */
121 hash = rotate_xor(hash, linux_banner, strlen(linux_banner));
122
123 /* Add in any runtime entropy we can get */
124 hash = rotate_xor(hash, &entropy, sizeof(entropy));
125
126 return hash;
127 }
128
129 static int __init nokaslr(char *p)
130 {
131 /* The real check is handled in kaslr_disabled() below. */
132 return 0;
133 }
134 early_param("nokaslr", nokaslr);
135
136 static inline __init bool kaslr_disabled(void)
137 {
138 char *str;
139 const char *builtin_cmdline = CONFIG_CMDLINE;
140 const char *const message = "KASLR is disabled by %s in %s cmdline.\n";
141
142 str = strstr(builtin_cmdline, "nokaslr");
143 if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' ')) {
> 144 pr_info(message, "nokaslr", "built-in");
145 return true;
146 }
147
148 str = strstr(boot_command_line, "nokaslr");
149 if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' ')) {
150 pr_info(message, "nokaslr", "boot");
151 return true;
152 }
153
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] loongarch: improve logging of disabling KASLR.
2026-04-03 6:30 [PATCH] loongarch: improve logging of disabling KASLR Yuqian Yang
2026-04-12 4:42 ` kernel test robot
2026-04-12 8:58 ` kernel test robot
@ 2026-04-13 8:29 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-04-13 8:29 UTC (permalink / raw)
To: Yuqian Yang, Huacai Chen
Cc: llvm, oe-kbuild-all, WANG Xuerui, Cheng Nie, Wentao Guan,
Dandan Zhang, loongarch, linux-kernel, Yuqian Yang
Hi Yuqian,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v7.0-rc7 next-20260410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yuqian-Yang/loongarch-improve-logging-of-disabling-KASLR/20260412-053808
base: linus/master
patch link: https://lore.kernel.org/r/E4B91143DC525DC6%2B20260403063008.94237-1-yangyuqian%40uniontech.com
patch subject: [PATCH] loongarch: improve logging of disabling KASLR.
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20260413/202604130224.WAbBNHnS-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260413/202604130224.WAbBNHnS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604130224.WAbBNHnS-lkp@intel.com/
All errors (new ones prefixed by >>):
>> arch/loongarch/kernel/relocate.c:144:11: error: expected ')'
144 | pr_info(message, "nokaslr", "built-in");
| ^
arch/loongarch/kernel/relocate.c:144:3: note: to match this '('
144 | pr_info(message, "nokaslr", "built-in");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:482:3: note: expanded from macro 'printk_index_wrap'
482 | __printk_index_emit(_fmt, NULL, NULL); \
| ^
include/linux/printk.h:435:27: note: expanded from macro '__printk_index_emit'
435 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
| ^
>> arch/loongarch/kernel/relocate.c:144:11: error: expected ')'
144 | pr_info(message, "nokaslr", "built-in");
| ^
arch/loongarch/kernel/relocate.c:144:3: note: to match this '('
144 | pr_info(message, "nokaslr", "built-in");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:482:3: note: expanded from macro 'printk_index_wrap'
482 | __printk_index_emit(_fmt, NULL, NULL); \
| ^
include/linux/printk.h:444:32: note: expanded from macro '__printk_index_emit'
444 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^
>> arch/loongarch/kernel/relocate.c:144:11: error: expected ')'
144 | pr_info(message, "nokaslr", "built-in");
| ^
arch/loongarch/kernel/relocate.c:144:3: note: to match this '('
144 | pr_info(message, "nokaslr", "built-in");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:482:3: note: expanded from macro 'printk_index_wrap'
482 | __printk_index_emit(_fmt, NULL, NULL); \
| ^
include/linux/printk.h:444:41: note: expanded from macro '__printk_index_emit'
444 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^
>> arch/loongarch/kernel/relocate.c:144:11: error: expected ')'
144 | pr_info(message, "nokaslr", "built-in");
| ^
arch/loongarch/kernel/relocate.c:144:3: note: to match this '('
144 | pr_info(message, "nokaslr", "built-in");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:483:10: note: expanded from macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
arch/loongarch/kernel/relocate.c:150:11: error: expected ')'
150 | pr_info(message, "nokaslr", "boot");
| ^
arch/loongarch/kernel/relocate.c:150:3: note: to match this '('
150 | pr_info(message, "nokaslr", "boot");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:482:3: note: expanded from macro 'printk_index_wrap'
482 | __printk_index_emit(_fmt, NULL, NULL); \
| ^
include/linux/printk.h:435:27: note: expanded from macro '__printk_index_emit'
435 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
| ^
arch/loongarch/kernel/relocate.c:150:11: error: expected ')'
150 | pr_info(message, "nokaslr", "boot");
| ^
arch/loongarch/kernel/relocate.c:150:3: note: to match this '('
150 | pr_info(message, "nokaslr", "boot");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:482:3: note: expanded from macro 'printk_index_wrap'
482 | __printk_index_emit(_fmt, NULL, NULL); \
| ^
include/linux/printk.h:444:32: note: expanded from macro '__printk_index_emit'
444 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^
arch/loongarch/kernel/relocate.c:150:11: error: expected ')'
150 | pr_info(message, "nokaslr", "boot");
| ^
arch/loongarch/kernel/relocate.c:150:3: note: to match this '('
150 | pr_info(message, "nokaslr", "boot");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:482:3: note: expanded from macro 'printk_index_wrap'
482 | __printk_index_emit(_fmt, NULL, NULL); \
| ^
include/linux/printk.h:444:41: note: expanded from macro '__printk_index_emit'
444 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^
arch/loongarch/kernel/relocate.c:150:11: error: expected ')'
150 | pr_info(message, "nokaslr", "boot");
| ^
arch/loongarch/kernel/relocate.c:150:3: note: to match this '('
150 | pr_info(message, "nokaslr", "boot");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:483:10: note: expanded from macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^
arch/loongarch/kernel/relocate.c:173:11: error: expected ')'
173 | pr_info(message, "resume=", "built-in");
| ^
arch/loongarch/kernel/relocate.c:173:3: note: to match this '('
173 | pr_info(message, "resume=", "built-in");
| ^
include/linux/printk.h:584:2: note: expanded from macro 'pr_info'
584 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^
include/linux/printk.h:511:26: note: expanded from macro 'printk'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^
include/linux/printk.h:482:3: note: expanded from macro 'printk_index_wrap'
482 | __printk_index_emit(_fmt, NULL, NULL); \
| ^
include/linux/printk.h:435:27: note: expanded from macro '__printk_index_emit'
435 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
vim +144 arch/loongarch/kernel/relocate.c
135
136 static inline __init bool kaslr_disabled(void)
137 {
138 char *str;
139 const char *builtin_cmdline = CONFIG_CMDLINE;
140 const char *const message = "KASLR is disabled by %s in %s cmdline.\n";
141
142 str = strstr(builtin_cmdline, "nokaslr");
143 if (str == builtin_cmdline || (str > builtin_cmdline && *(str - 1) == ' ')) {
> 144 pr_info(message, "nokaslr", "built-in");
145 return true;
146 }
147
148 str = strstr(boot_command_line, "nokaslr");
149 if (str == boot_command_line || (str > boot_command_line && *(str - 1) == ' ')) {
150 pr_info(message, "nokaslr", "boot");
151 return true;
152 }
153
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-13 8:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 6:30 [PATCH] loongarch: improve logging of disabling KASLR Yuqian Yang
2026-04-12 4:42 ` kernel test robot
2026-04-12 8:58 ` kernel test robot
2026-04-13 8:29 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox