]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86: Fix return value of __setup handlers
authorRandy Dunlap <rdunlap@infradead.org>
Mon, 14 Mar 2022 01:27:25 +0000 (18:27 -0700)
committerBorislav Petkov <bp@suse.de>
Wed, 4 May 2022 14:47:57 +0000 (16:47 +0200)
__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")
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Link: https://lore.kernel.org/r/20220314012725.26661-1-rdunlap@infradead.org
arch/x86/entry/vdso/vma.c
arch/x86/kernel/apic/apic.c
arch/x86/kernel/cpu/intel.c
arch/x86/mm/pat/memtype.c

index 235a5794296acbef611d65d2de8cbec7de9f4ed3..1000d457c3321e2caf3c9428e7961b0e1c572458 100644 (file)
@@ -438,7 +438,7 @@ bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
 static __init int vdso_setup(char *s)
 {
        vdso64_enabled = simple_strtoul(s, NULL, 0);
-       return 0;
+       return 1;
 }
 __setup("vdso=", vdso_setup);
 
index b70344bf660083bbeb998bc0b74737a21047d46b..ed7d9cf71f68deb122f2c086718b5f45cfe5ce6a 100644 (file)
@@ -170,7 +170,7 @@ static __init int setup_apicpmtimer(char *s)
 {
        apic_calibrate_pmtmr = 1;
        notsc_setup(NULL);
-       return 0;
+       return 1;
 }
 __setup("apicpmtimer", setup_apicpmtimer);
 #endif
index 8321c43554a1d2e2cb615b4f9d6af463eb0f082f..350c247def370e7770f98197acb1cfc49fd96329 100644 (file)
@@ -91,7 +91,7 @@ static bool ring3mwait_disabled __read_mostly;
 static int __init ring3mwait_disable(char *__unused)
 {
        ring3mwait_disabled = true;
-       return 0;
+       return 1;
 }
 __setup("ring3mwait=disable", ring3mwait_disable);
 
index 4ba2a3ee4bce1258f0b86a47a47c823e3ff2eb49..d5ef64ddd35e9f38c2a533e22d79c016fd6fcc55 100644 (file)
@@ -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);