Skip to content

Commit 902d75c

Browse files
committed
LoongArch: Silence the boot warning about 'nokaslr'
The kernel parameter 'nokaslr' is handled before start_kernel(), so we don't need early_param() to mark it technically. But it can cause a boot warning as follows: Unknown kernel command line parameters "nokaslr", will be passed to user space. When we use 'init=/bin/bash', 'nokaslr' which passed to user space will even cause a kernel panic. So we use early_param() to mark 'nokaslr', simply print a notice and silence the boot warning (also fix a potential panic). This logic is similar to RISC-V. Signed-off-by: Huacai Chen <[email protected]>
1 parent ee2daf7 commit 902d75c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/loongarch/kernel/relocate.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ static inline __init unsigned long get_random_boot(void)
102102
return hash;
103103
}
104104

105+
static int __init nokaslr(char *p)
106+
{
107+
pr_info("KASLR is disabled.\n");
108+
109+
return 0; /* Print a notice and silence the boot warning */
110+
}
111+
early_param("nokaslr", nokaslr);
112+
105113
static inline __init bool kaslr_disabled(void)
106114
{
107115
char *str;

0 commit comments

Comments
 (0)