From patchwork Thu Sep 27 08:50:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 147693 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1726440lji; Thu, 27 Sep 2018 01:51:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV62sn66pJA7Sw+Hcpq313CRC4RAhRtTVGNJr1mnkYhxvD04LJB5T4J+ADjZDGUv3Wvu+RMPO X-Received: by 2002:a17:902:344:: with SMTP id 62-v6mr9986354pld.164.1538038277365; Thu, 27 Sep 2018 01:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538038277; cv=none; d=google.com; s=arc-20160816; b=QcqaBKXEhR9DDXGBPMTZkqEryLJnYh1dTbUVHDd3w2ku+om+mqNQVURR1jXlr2fCDR rE3D33Y49b0NypIarBEU6g/bvI2/MSpNT37pHGSZQ/YEv5Ck2+wtWG3OaX/5QoLSUTC7 Pt1kyaA+iDGmTlg3lid+8EOJWy5f7w7X0Zt9cZlmxhv2OQYqPXiVy7pM8Ac/Uxfug3Cz jdB3d6c+I4tXVFDaUecr/t75TFcW3OU3N+QBHJD9//e1EviusHVk1kC2GobllztE0bzG /ysCC/AKxsKgj7F/Ercu8HOqywF/z/QCfZKhjalhFNvxJvZFs9JTWuFhwXV/a3YaqKJx iLsA== 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=AsXgWn/5EH4o89e3p8kGpDNY5N+XM/ydDKBocV+pJDQ=; b=0MN1xJiWdity+V9o8zAoFmj+Z5bcUGqlks6Su6win50LdW0Nc5weja1A7NiEVQUOTg dCiMzibZBvJ9anMRr3E65h+8juiVgFgVuZJXto3FSA5imvK2P8bi0+JyInSpH/QxRXd8 a+nh5Bpgc1XZnjZ3F7a0/rv5S7cZZeH4yziHWIMJXxor8aMfPgoGgV69XmyrBbihECHU CZ+jvMUE1kiT2oST04YAQyQlIxqwecNp6hlJL9j3Zr6xKa5GC0HJFQyuUdhJLpjw1/7z Fz/j+G50z5TUeMtHyTBRLO1UaABAJquLShBGhGX2TTDvvvCpEyrZ+YBMf69zLiv1GT4X Zmsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VwZuEh+H; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13-v6si1259522pgd.280.2018.09.27.01.51.17; Thu, 27 Sep 2018 01:51:17 -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=@linaro.org header.s=google header.b=VwZuEh+H; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727499AbeI0PIX (ORCPT + 32 others); Thu, 27 Sep 2018 11:08:23 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44391 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727458AbeI0PIV (ORCPT ); Thu, 27 Sep 2018 11:08:21 -0400 Received: by mail-wr1-f65.google.com with SMTP id v16-v6so1639985wro.11 for ; Thu, 27 Sep 2018 01:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AsXgWn/5EH4o89e3p8kGpDNY5N+XM/ydDKBocV+pJDQ=; b=VwZuEh+HHm/qu9eI3ww/1j57RkEa2/295JWTMV2PmQIwqDtmgBXcFmr8Av4NUrpNI9 plP/GvIoxmKqZ1VG671jDKl06ckGuNDV5Ijp3LpRD7WF3nk9R9i7Sbw/nQMlpyTki1Gv Mzz5dxJteq2vM4AbVJMmAUFJ3Iqe+nMPYDOuc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AsXgWn/5EH4o89e3p8kGpDNY5N+XM/ydDKBocV+pJDQ=; b=pa2guMAuQTRvvVsjKsPQXME+QR/hJFUjLQLbDF9rZQ2rg2P3LqwNDx7MzXYoBdr6q1 Dui6MwFOG5fpth7gmqqlvw9h0RNxcukbTxC6xvm5cq4lKwOP3lmuV6Bnp6wrX3QTn0Eh n/sxyqzZ4EEINcR8z6fC3FUSeX7UtQwKdHRZDJsQI0b3ARsEpONwjJXPolDThKuHV9ov XWm0RJKm9bnx6pTUibhne0P+wtM/H9FIyCx7qjLqHbKwd/eT4JiwSH51m4/X71fU8Bzk fEfeqvYbJvG9qrbGdtaeYE4VndUAil9OdRu+Y37LecLV33SpQ0q/RdQA73oxcYyUg51a Gw3Q== X-Gm-Message-State: ABuFfojmQqLMAN6kfKUQ2AwtgS+Q9X5bLLCDTZ7R0zhcNdzmiC4Q3oEV 5TzUA8PCKj7HY3dDvJBqIGNWYEU5K48= X-Received: by 2002:a5d:50cf:: with SMTP id f15-v6mr8271923wrt.128.1538038270936; Thu, 27 Sep 2018 01:51:10 -0700 (PDT) Received: from rev03.home ([2a01:cb1d:112:6f00:546e:3c44:5966:2f5e]) by smtp.gmail.com with ESMTPSA id p11-v6sm1304055wrd.74.2018.09.27.01.51.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 01:51:10 -0700 (PDT) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-efi@vger.kernel.org, Aaron Ma , Alistair Strachan , Ben Hutchings , Bhupesh Sharma , Hans de Goede , Ivan Hu , Jeremy Linton , Marc Zyngier , Matt Fleming , Peter Robinson , Sai Praneeth Prakhya , Sebastian Andrzej Siewior , Stefan Agner Subject: [PATCH 10/11] efi/x86: Call efi_parse_options() from efi_main() Date: Thu, 27 Sep 2018 10:50:37 +0200 Message-Id: <20180927085039.8391-11-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180927085039.8391-1-ard.biesheuvel@linaro.org> References: <20180927085039.8391-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede 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 --- arch/x86/boot/compressed/eboot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.18.0 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.