Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4526521imb; Wed, 6 Mar 2019 16:00:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyCxuahFDdgyvvgIqA4j+M7b5w+D8rrrsFMKMRNkL/I5JNzKJKZRTLXVKw7ZHO8qV7dmL2p X-Received: by 2002:a65:5788:: with SMTP id b8mr8521079pgr.8.1551916834840; Wed, 06 Mar 2019 16:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551916834; cv=none; d=google.com; s=arc-20160816; b=S1F+sy1tdP6cWaQbVu9QwSHtbN0Lhhpsaz7LkAfsO+2gW5tvUJzQ+JBJH8Zwn1SEpW cgHsjgTYdYn1FMVVJc7lkaJCVGdq/kjGemVx71uqq+seZxA+jLlw47JpWDSqt5GChZk7 kGBJFpEXc9G5Zan0+oDy5H0FygFGyhsn7WlQ2dxZ2LONf1Qq3Pc8esTpbuN4rlpouqms rayPT8Hyn8WveoZw9zE35S0XY/eh0Li6c373mx7Sy5iM/prXUvjcyXUagzi5sJi3CAqL TTqlwpY2+ewB8/bMGS76fxRyc8k4i5RFXCq4vArsGY3KLVkQqW9SJ2OsbMGP2GMtjuvg VjUg== 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=J9HskZ77OUFICI41Y6vWx6qjidmwsaOE6tSBtlsEq6A=; b=xv3Fe1tczrtpnItC14PIR/LfqUNSFzhYtxxjOgVf+bmm7Hv+ZTDf0aUssdkVuKJV0A qtB/M8f4hsqlctGBdXlUB4OX1INBrRqRrFg6kF2dgXIePUhGIOrcMZ/CYt0JkUmtD1Vu Aw4rsvZYpj//d/3PeIyvd8z9rikbOjYYlfEzMNSxxf7wcezUI1KHTaI1C1s3pLzUPBEH tdaZnXIAIiDfOHGvtPsX3XKwsyzDqdbFFqIYdiKDembR9bnfit/+yAkKd7jE7qPev0IM uggEHSzXTV5ihfvfMKqlch/XzVBSABNHte3TZkj4YTtJ0OUo2yhEP5ISiIlNXqMbOgrG bF9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PcOpK9az; 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 n28si2849267pfi.109.2019.03.06.16.00.19; Wed, 06 Mar 2019 16:00:34 -0800 (PST) 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=PcOpK9az; 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 S1726395AbfCFX7n (ORCPT + 99 others); Wed, 6 Mar 2019 18:59:43 -0500 Received: from mail-pf1-f202.google.com ([209.85.210.202]:42575 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbfCFX7m (ORCPT ); Wed, 6 Mar 2019 18:59:42 -0500 Received: by mail-pf1-f202.google.com with SMTP id p9so15433384pfn.9 for ; Wed, 06 Mar 2019 15:59:41 -0800 (PST) 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=J9HskZ77OUFICI41Y6vWx6qjidmwsaOE6tSBtlsEq6A=; b=PcOpK9azISxtDIMoSR8lrqsGa2jzKe5DpkkVwC2lvPLouHJ+vxS0aioyTJZIJTIalp l2w1dyY3icZy5F2BbXRiOSOF6JKLNx6ZDSl4jPxhtjlbkeUmAGR5NLhNY/jl0Yj/UyKx Ky/L1DecjxO0eL/TXC88bCzSUQPTJnVc0yxiluRZyQ6euvebM9bQTAM+Pi2ngMPQSNvu /qWm8mUzjhDcr5Dbeapg9eZmk+eoR06cg69/g4BBxK6tvxx1NASQpRZHlPkLQxPniMJm RMDQslYkVwE9UPxpgtmv+vZEoFMyZdYlMcn1sN68WeheHf4ybL5NvgLvkJlAvtuNrobN Oo+w== 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=J9HskZ77OUFICI41Y6vWx6qjidmwsaOE6tSBtlsEq6A=; b=Qyan3bCSaQLrxpLug8ybjXRcd14sXBqjX8fb18wbxfoBfnuuGMphsJMPnFFiFWmZaX EAVxZoLE+7MMu+qPZovpyZ82+XkHw4q0tmfON/vFHGhpgzv9Jqj8mc8trouZVlkNq6w0 O7nrKMrcJbX0Di4rD99BX2dFKrJqpgTBUBhaDPElZuXJlZKHnHKxhxRqgX3avIFP9IQd rQyK8ZffgU+x9r2xDggZtDSjfDrqIQsoHA2xphy3wU7vYwK7H5F/K63Bnpf4cYTQMSxd vc/5z3tPsnVxneiPL8mzMCHJHK/xwvUr0/HC7gQy4iL+Fk4ReZoOGll0Zhggwj9iBiUB GfCQ== X-Gm-Message-State: APjAAAVa1NpISwed0PwkgkQHkYBhAtNVb70vywSxl6bWCAeOFie/7YcN uA783vXJYDOfB5YdhdQqjIlmdnCljLCLQVphD/0g0w== X-Received: by 2002:a62:b401:: with SMTP id h1mr3868938pfn.61.1551916781465; Wed, 06 Mar 2019 15:59:41 -0800 (PST) Date: Wed, 6 Mar 2019 15:58:52 -0800 In-Reply-To: <20190306235913.6631-1-matthewgarrett@google.com> Message-Id: <20190306235913.6631-7-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190306235913.6631-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.352.gf09ad66450-goog Subject: [PATCH 06/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 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 Reviewed-by: "Lee, Chun-Yi" 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.352.gf09ad66450-goog