Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3662205img; Mon, 25 Mar 2019 15:11:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwempxluSP4ubTWjIigT/RnkIftccX8my6R3vt4jPO4GkIJOKfpWerfK+uE+ltgmUrsszz3 X-Received: by 2002:aa7:82cb:: with SMTP id f11mr19236327pfn.0.1553551876940; Mon, 25 Mar 2019 15:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553551876; cv=none; d=google.com; s=arc-20160816; b=snSL4+/JthgTAUYAQD5daj2mhXRUjDm+IIs2UsCO3ui+uUA0H8GqRPbY8oVRTnLgE6 XA8xqfKmo+OC5Z3huHhFOacO7SYxqGG9+GjiFZ68Qzescw6w3vhxaIOPwdNdLvz3UMIL Iu8zDmrxiOBDQOL7Zs2R1P7ygd7V7tAmsS6Rn7lONvAoBnIVXXgUhSo0kt+zXxHlAGdj LJrVQY9gajfWriEyY6zODXNDF+WvfRam/UPMJJMaPhX3AMb6g6NpPIEICiRxDaCDwopW 8WOxSnQxe/T8bGR6VGB72SSxPOJD9aRHih6UNpyPJ/2Bkb2G8IazqGMmuYpQkjw4K8nT N4qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=zcfKxdpFss4fpHHRB0+Lld7eiBsD+1c7SytE6cVbYAQ=; b=lK/d59BuzdbFDElh1GMoVL4oHW09PmqU3tZQqRjB4OwA9argiC4rYc2bXVm8ReDOLt EEZaFTp52hbjtGdhKtSJ7eT/dcUE8JYiFy3VxnEqMk/AokbqNjHggA5hv0Tf8lo82H1U jqOMrpq05Jc2mfrOcTWcTQDqsCnryGSpjPVkxpcTCklMKoAqWG84iV1LUOf5yeI60F7c /qOYHBSpCj7PZwrL0Fzy2m3sEq72LHCcF7km0p6IVN4I6JpmnALbioPotQvRUiZpAvZt 3s7XGFyQjcumVKP3d2Pwm/yFzswEqeGF1xx5wRTnfAC30qY2yKSsZNhsethiz0bpfvQ4 3rSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="pU/fGwEe"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si13938742pgq.343.2019.03.25.15.11.02; Mon, 25 Mar 2019 15:11:16 -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=@google.com header.s=20161025 header.b="pU/fGwEe"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730725AbfCYWKM (ORCPT + 99 others); Mon, 25 Mar 2019 18:10:12 -0400 Received: from mail-ot1-f74.google.com ([209.85.210.74]:49137 "EHLO mail-ot1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730697AbfCYWKL (ORCPT ); Mon, 25 Mar 2019 18:10:11 -0400 Received: by mail-ot1-f74.google.com with SMTP id 70so1118308otn.15 for ; Mon, 25 Mar 2019 15:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zcfKxdpFss4fpHHRB0+Lld7eiBsD+1c7SytE6cVbYAQ=; b=pU/fGwEeJo9W057Fiz2WhB5YvIlTU26ECcXPrtXpWYJgVMbu/bjoyYznMie0JvzhO/ RMWldH0Yt0MU7YLBeDyWytBHuMzqJERlwFdmfJJbi+ZbOAUjxFR/HBN5ujwrCkiJxwOL VRT4+Jfgx18zSIZ6t/4LruqHwEooU53sBrBvTqizKQLihltKb4R4UhhHC2dT1e03v6tw ba42wMht7Dbvh018RXehhlCnq6oZpGQ5iQRkbDEaHPGBfbFXqo2WGwghiUe0Z2ELy1q+ qDbcd2uG+W2swTs872ukoJgbdOqFSd9dVTBjUcrMZelQnG/pbmRs7A9z1NDqna2/ivZI SSfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zcfKxdpFss4fpHHRB0+Lld7eiBsD+1c7SytE6cVbYAQ=; b=mp+zrI5+0SSs0NL6rx53SB+CRhgF0CAWvXDOc+rE2x+P2a2AyhS8v05g3VT2UuQwzy f474akjoUahMDRv5cIwHAST4WhqwZYuRIUPf5Mgnf2KTI1DTPcAWvqcvBzzmdTmApJzr jc65k6qI7MHryD8XCnU8kDGy/0KaRZwYSDWmyrsD+vaWJBhtfJfLoPa8q/oFVCxNiaFi jzlCyabEkLWAWOVAxIHJuB6iidQJ3WhZDhkJxRUBDwwEy/eFXnFSi2nRaQ26/FA4ee0e M+wfw8k2RXebNthy+hhO3ZEBHE3D7/e1HklBFe6U3fGQ0uyDYSXj7pRs18YIvM6uLUqb 0lLw== X-Gm-Message-State: APjAAAUCFDl08mnEe2oS08lvWiIm5jI/pkBvyY4qJ/IzWQz0eGYBZgUc OwDrkxvn78fQbYCsv/UzqEClS7x8MbbofcSA8EgYFQ== X-Received: by 2002:aca:ed4e:: with SMTP id l75mr13734881oih.62.1553551810951; Mon, 25 Mar 2019 15:10:10 -0700 (PDT) Date: Mon, 25 Mar 2019 15:09:32 -0700 In-Reply-To: <20190325220954.29054-1-matthewgarrett@google.com> Message-Id: <20190325220954.29054-6-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190325220954.29054-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH 05/27] Copy secure_boot flag in boot params across kexec reboot From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, Dave Young , kexec@lists.infradead.org, Matthew Garrett Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Young Kexec reboot in case secure boot being enabled does not keep the secure boot mode in new kernel, so later one can load unsigned kernel via legacy kexec_load. In this state, the system is missing the protections provided by secure boot. Adding a patch to fix this by retain the secure_boot flag in original kernel. secure_boot flag in boot_params is set in EFI stub, but kexec bypasses the stub. Fixing this issue by copying secure_boot flag across kexec reboot. Signed-off-by: Dave Young Signed-off-by: David Howells cc: kexec@lists.infradead.org Signed-off-by: Matthew Garrett --- arch/x86/kernel/kexec-bzimage64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 278cd07228dd..d49554b948fd 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -179,6 +179,7 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, if (efi_enabled(EFI_OLD_MEMMAP)) return 0; + params->secure_boot = boot_params.secure_boot; ei->efi_loader_signature = current_ei->efi_loader_signature; ei->efi_systab = current_ei->efi_systab; ei->efi_systab_hi = current_ei->efi_systab_hi; -- 2.21.0.392.gf8f6787159e-goog