When "dump_apple_properties" is used on the kernel boot command line,
it causes an Unknown parameter message and the string is added to init's
argument strings:
Unknown kernel command line parameters "dump_apple_properties
BOOT_IMAGE=/boot/bzImage-517rc6 efivar_ssdt=newcpu_ssdt", will be
passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
dump_apple_properties
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc6
efivar_ssdt=newcpu_ssdt
Similarly when "efivar_ssdt=somestring" is used, it is added to the
Unknown parameter message and to init's environment strings, polluting
them (see examples above).
Change the return value of the __setup functions to 1 to indicate
that the __setup options have been handled.
Fixes: 58c5475aba67 ("x86/efi: Retrieve and assign Apple device properties")
Fixes: 475fb4e8b2f4 ("efi / ACPI: load SSTDs from EFI variables")
Signed-off-by: Randy Dunlap <[email protected]>
Reported-by: Igor Zhbanov <[email protected]>
Link: lore.kernel.org/r/[email protected]
Cc: Ard Biesheuvel <[email protected]>
Cc: [email protected]
Cc: Lukas Wunner <[email protected]>
Cc: Octavian Purdila <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Matt Fleming <[email protected]>
---
drivers/firmware/efi/apple-properties.c | 2 +-
drivers/firmware/efi/efi.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- linux-next-20220228.orig/drivers/firmware/efi/apple-properties.c
+++ linux-next-20220228/drivers/firmware/efi/apple-properties.c
@@ -24,7 +24,7 @@ static bool dump_properties __initdata;
static int __init dump_properties_enable(char *arg)
{
dump_properties = true;
- return 0;
+ return 1;
}
__setup("dump_apple_properties", dump_properties_enable);
--- linux-next-20220228.orig/drivers/firmware/efi/efi.c
+++ linux-next-20220228/drivers/firmware/efi/efi.c
@@ -212,7 +212,7 @@ static int __init efivar_ssdt_setup(char
memcpy(efivar_ssdt, str, strlen(str));
else
pr_warn("efivar_ssdt: name too long: %s\n", str);
- return 0;
+ return 1;
}
__setup("efivar_ssdt=", efivar_ssdt_setup);
On Tue, 1 Mar 2022 at 05:19, Randy Dunlap <[email protected]> wrote:
>
> When "dump_apple_properties" is used on the kernel boot command line,
> it causes an Unknown parameter message and the string is added to init's
> argument strings:
>
> Unknown kernel command line parameters "dump_apple_properties
> BOOT_IMAGE=/boot/bzImage-517rc6 efivar_ssdt=newcpu_ssdt", will be
> passed to user space.
>
> Run /sbin/init as init process
> with arguments:
> /sbin/init
> dump_apple_properties
> with environment:
> HOME=/
> TERM=linux
> BOOT_IMAGE=/boot/bzImage-517rc6
> efivar_ssdt=newcpu_ssdt
>
> Similarly when "efivar_ssdt=somestring" is used, it is added to the
> Unknown parameter message and to init's environment strings, polluting
> them (see examples above).
>
> Change the return value of the __setup functions to 1 to indicate
> that the __setup options have been handled.
>
> Fixes: 58c5475aba67 ("x86/efi: Retrieve and assign Apple device properties")
> Fixes: 475fb4e8b2f4 ("efi / ACPI: load SSTDs from EFI variables")
> Signed-off-by: Randy Dunlap <[email protected]>
> Reported-by: Igor Zhbanov <[email protected]>
> Link: lore.kernel.org/r/[email protected]
> Cc: Ard Biesheuvel <[email protected]>
> Cc: [email protected]
> Cc: Lukas Wunner <[email protected]>
> Cc: Octavian Purdila <[email protected]>
> Cc: "Rafael J. Wysocki" <[email protected]>
> Cc: Matt Fleming <[email protected]>
Queued as a fix,
Thanks,
Ard.
> ---
> drivers/firmware/efi/apple-properties.c | 2 +-
> drivers/firmware/efi/efi.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> --- linux-next-20220228.orig/drivers/firmware/efi/apple-properties.c
> +++ linux-next-20220228/drivers/firmware/efi/apple-properties.c
> @@ -24,7 +24,7 @@ static bool dump_properties __initdata;
> static int __init dump_properties_enable(char *arg)
> {
> dump_properties = true;
> - return 0;
> + return 1;
> }
>
> __setup("dump_apple_properties", dump_properties_enable);
> --- linux-next-20220228.orig/drivers/firmware/efi/efi.c
> +++ linux-next-20220228/drivers/firmware/efi/efi.c
> @@ -212,7 +212,7 @@ static int __init efivar_ssdt_setup(char
> memcpy(efivar_ssdt, str, strlen(str));
> else
> pr_warn("efivar_ssdt: name too long: %s\n", str);
> - return 0;
> + return 1;
> }
> __setup("efivar_ssdt=", efivar_ssdt_setup);
>