Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3541889pxm; Mon, 28 Feb 2022 23:51:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbtr6wi0yvuyy66f5QOzqGGcDL5O9vwXA7N3biyj6SltXwN82AadeoAPRUdrchYaUOaVbB X-Received: by 2002:a63:e52:0:b0:374:7b9f:1467 with SMTP id 18-20020a630e52000000b003747b9f1467mr20229447pgo.178.1646121091539; Mon, 28 Feb 2022 23:51:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646121091; cv=none; d=google.com; s=arc-20160816; b=OdaojLb8PoTpgvvL5A53hmG1Q1VWfEd0YBb97p8pj13YbqF/YoYcw0/KWdK8wQfc93 JnxjJdJsyyHZYBIleEaUbqSpoFqsZb240o9PMnamR/CRKgm8I2+MLW5gmbrmK1+XB0zJ gKt1N3P96H5YAd1RU6d+c1fyiT1YJssrggdZM0C5088pvBCW04yEbKddYkI+bNR3kdzQ 0qtklz8fGjlGIo4KLExhzcRjF9uk3bMR6b8nS32NZjdNwYiX7IoXjHiNFiFbtNParTnh LoQc5SxGuzO+0sXxoI9EpL4Bt0NAcAR7K+0U58/oTa/myYzICEDcRfBIGOSbGxNLpajB D21A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=SNG8dsJKnqg4yoB1IAs+5+zuDlU3R1ic4tYvheuBHLI=; b=mJFDHuTMjuPx6EDfGTHQcO26iuJGsfDlxz3njT+KtQnAG2iBYHcrIUZG2FoVPk5APq 2pdLQcGqcTKcRDFXkmdaqDQNSgwuxAlSAJI1KSjfysTvM3xem0Okcgca5DPdOQ39qB6S mTXAa8qal8bNo/NYyORQQu8e4YsIxjk7oWOAf5+uSeFkMDrLxrnW/eGzXi6EbP+hKZWI PlHtrYo+MqkmlT2SRR4ij9ba+HPLXhuGcPTF/RBM1bILWctUZ+v/qFUMB6pe63Hvxr9W nyefQCghGv24GWm+0iygbUsaATnOA6AnOUWY6HeM+jgEnQqlUTvsPwi4XEVt1Rb9uR3+ 4JHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BIJf36tf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s32-20020a634520000000b00372d5be9b30si12137980pga.481.2022.02.28.23.51.17; Mon, 28 Feb 2022 23:51:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BIJf36tf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbiCAETk (ORCPT + 99 others); Mon, 28 Feb 2022 23:19:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232246AbiCAETg (ORCPT ); Mon, 28 Feb 2022 23:19:36 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17311FD3A; Mon, 28 Feb 2022 20:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=SNG8dsJKnqg4yoB1IAs+5+zuDlU3R1ic4tYvheuBHLI=; b=BIJf36tfAUXQXZqcOnbeAxttFX jFYQv0XXdHsIqDASqvzeCHFWihKYilk3cBB7YnenzeaqjtnWquPL2Fw2mclByXwyKXocnLBPj/MCX RaBePffOxZitWR550+mebrZDyIePhbYVH0r8PHLVLJcQx24hXPGUVuFzs6eBqsxmapMTWV5dPeUOv eNLkIn+YKoTteSp0QOkIc8uZW4AlOG4kySu/x+4CVBm28T0TzNfjGU8zpoKzPkyZzXMzw/b14XGcK mTSNmUW4cjUWIdFr5LGTpKGAdsPHshNUie5Tz1iOkAOHpuzMM5XNAoc7gkQiVOqLXFUI9cQd1xprT kRtI7Whg==; Received: from [2601:1c0:6280:3f0::aa0b] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOtyQ-00Er1X-42; Tue, 01 Mar 2022 04:18:54 +0000 From: Randy Dunlap To: linux-kernel@vger.kernel.org Cc: patches@lists.linux.dev, Randy Dunlap , Igor Zhbanov , Ard Biesheuvel , linux-efi@vger.kernel.org, Lukas Wunner , Octavian Purdila , "Rafael J. Wysocki" , Matt Fleming Subject: [PATCH] efi: fix return value of __setup handlers Date: Mon, 28 Feb 2022 20:18:51 -0800 Message-Id: <20220301041851.12459-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Ard Biesheuvel Cc: linux-efi@vger.kernel.org Cc: Lukas Wunner Cc: Octavian Purdila Cc: "Rafael J. Wysocki" Cc: Matt Fleming --- 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);