Skip to contentSkip to conversation

x86: fix return value of __setup handlers

PATCH New Randy Dunlap 1 participant 1 message Mar 14, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix return value of __setup handlers

__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument (no '=') or environment (with '=') strings. So return 1 from these x86 __setup handlers.

Examples:

Unknown kernel command line parameters "apicpmtimer
BOOT_IMAGE=/boot/bzImage-517rc8 vdso=1 ring3mwait=disable", will be passed to user space.

Run /sbin/init as init process
with arguments:
/sbin/init
apicpmtimer
with environment:

     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc8
     vdso=1
     ring3mwait=disable
Fixes 2aae950b21e4 ("x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu")
Fixes 77b52b4c5c66 ("x86: add "debugpat" boot option")
Fixes e16fd002afe2 ("x86/cpufeature: Enable RING3MWAIT for Knights Landing")
Fixes b8ce33590687 ("x86_64: convert to clock events")
Link lore.kernel.org/r/[email protected]
Cc Andi Kleen <[email protected]>
Cc Venkatesh Pallipadi <[email protected]>
Cc Grzegorz Andrejczuk <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 arch/x86/entry/vdso/vma.c   |    2 +-
 arch/x86/kernel/apic/apic.c |    2 +-
 arch/x86/kernel/cpu/intel.c |    2 +-
 arch/x86/mm/pat/memtype.c   |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/entry/vdso/vma.c +1 -1
@@ -438,7 +438,7 @@ bool arch_syscall_is_vdso_sigreturn(stru
 static __init int vdso_setup(char *s)
 {
 	vdso64_enabled = simple_strtoul(s, NULL, 0);
-	return 0;
+	return 1;
 }
 __setup("vdso=", vdso_setup);
 
arch/x86/mm/pat/memtype.c +1 -1
@@ -101,7 +101,7 @@ int pat_debug_enable;
 static int __init pat_debug_setup(char *str)
 {
 	pat_debug_enable = 1;
-	return 0;
+	return 1;
 }
 __setup("debugpat", pat_debug_setup);
 
arch/x86/kernel/apic/apic.c +1 -1
@@ -170,7 +170,7 @@ static __init int setup_apicpmtimer(char
 {
 	apic_calibrate_pmtmr = 1;
 	notsc_setup(NULL);
-	return 0;
+	return 1;
 }
 __setup("apicpmtimer", setup_apicpmtimer);
 #endif
arch/x86/kernel/cpu/intel.c +1 -1
@@ -91,7 +91,7 @@ static bool ring3mwait_disabled __read_m
 static int __init ring3mwait_disable(char *__unused)
 {
 	ring3mwait_disabled = true;
-	return 0;
+	return 1;
 }
 __setup("ring3mwait=disable", ring3mwait_disable);