Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp176509imd; Wed, 31 Oct 2018 16:51:36 -0700 (PDT) X-Google-Smtp-Source: AJdET5eILwHxwG1ze0sey1fASbDylCIsJKr3kn8Zg+HsV3EE2/yZCd3ptH47Rkto2RY6DtgiW0Tm X-Received: by 2002:a63:ef0b:: with SMTP id u11-v6mr5038356pgh.283.1541029896454; Wed, 31 Oct 2018 16:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029896; cv=none; d=google.com; s=arc-20160816; b=UUQ4m7R3J7/de3zHN9FjFoiW91uUaNRV95hfLgN+m9lUBVV1AMyaRdE+snQk47zaQD DANaI8/kcoJ/5BpYx1CCjFNbT1F/NMegcjrllE0NLSVqatQdfN4MT300q5idrJcSlqNW 8geB0u2u6L/9GtoVf6se2w05IpGkICoZt12tM5JN3r6EO7f9y7ruM2YySBV/jTyJJluF /6+efIjsZtVSvGBT8e+MaANQwIgbq9t7HEtgTWcViEm0v3pMM0WkDbLquYPhic1Va7Zg oaSwYe0dGz9HD9ZsDOIfFNQQMgNS3r9Q9ZbiU7AmKCSnRpYDsjRFVQVvqHzUZx6dMyKU flow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FlnmG836DktelHhY80RCM9NQgThrEOLwQD/dHYnzw14=; b=KeHJTZHpU9NZmHckj2a16ZuKAsiWZRuloECWudnyv1g728VLBqwm7Gs7D1MGMT8boD b6xnQgtDjB6No4tpaN+Z3DwnnCEDe59vYAtzLgTNwMv/oTnOJ3GYt/oGwJ9V8lycpqlj GTB/4SzNqGP9p1lHqSPc4WHQ8/ItWJCNt+OH1ly1KEjJ5eJ4M50iAItEcdKd/VlxTxy8 QxmXejpeqm/Vo4urUXJwweKx4QJcmmwtSTtg+IwCbdgGIsbfzq6N7LNrx3gllQzbdSTg qy2DwnJ10Z+ISSm27+HB8MKuobzaaDl6t3Qek/UduM+K4W079FXiorTXtvyCpw0Ffbjm ylUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mttwqAwh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15-v6si2665888pfn.85.2018.10.31.16.51.21; Wed, 31 Oct 2018 16:51:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mttwqAwh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728143AbeKAIGh (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:53626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727984AbeKAIGg (ORCPT ); Thu, 1 Nov 2018 04:06:36 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E25D20847; Wed, 31 Oct 2018 23:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027185; bh=Mw8EC2MR8S4zEcuXVC4fE3B8YWowHW/bBhF21Mgs6hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mttwqAwhG+dN/SDaNOcPpwNafoP34sz/LTge02XevpWaqxuES1nzKQ4AdWCNcRwkv dm83Yr01gzwAud3aGxZmyMrBwB64o9JhXeLCuiSB4mF7Zr1afYOwpFJAt+ZBOh7LR8 S5mMktFo4Oe9wZPsKWjNBAkUVzPOSlzOiRD02RgE= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Ard Biesheuvel , Sasha Levin Subject: [PATCH AUTOSEL 4.19 048/146] efi/x86: Call efi_parse_options() from efi_main() Date: Wed, 31 Oct 2018 19:04:03 -0400 Message-Id: <20181031230541.28822-48-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit c33ce984435bb6142792802d75513a71e55d1969 ] Before this commit we were only calling efi_parse_options() from make_boot_params(), but make_boot_params() only gets called if the kernel gets booted directly as an EFI executable. So when booted through e.g. grub we ended up not parsing the commandline in the boot code. This makes the drivers/firmware/efi/libstub code ignore the "quiet" commandline argument resulting in the following message being printed: "EFI stub: UEFI Secure Boot is enabled." Despite the quiet request. This commits adds an extra call to efi_parse_options() to efi_main() to make sure that the options are always processed. This fixes quiet not working. This also fixes the libstub code ignoring nokaslr and efi=nochunk. Reported-by: Peter Robinson Signed-off-by: Hans de Goede Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- arch/x86/boot/compressed/eboot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 1458b1700fc7..8b4c5e001157 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -738,6 +738,7 @@ efi_main(struct efi_config *c, struct boot_params *boot_params) struct desc_struct *desc; void *handle; efi_system_table_t *_table; + unsigned long cmdline_paddr; efi_early = c; @@ -755,6 +756,15 @@ efi_main(struct efi_config *c, struct boot_params *boot_params) else setup_boot_services32(efi_early); + /* + * make_boot_params() may have been called before efi_main(), in which + * case this is the second time we parse the cmdline. This is ok, + * parsing the cmdline multiple times does not have side-effects. + */ + cmdline_paddr = ((u64)hdr->cmd_line_ptr | + ((u64)boot_params->ext_cmd_line_ptr << 32)); + efi_parse_options((char *)cmdline_paddr); + /* * If the boot loader gave us a value for secure_boot then we use that, * otherwise we ask the BIOS. -- 2.17.1