Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6089810ybh; Wed, 7 Aug 2019 17:09:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqznsfHTD6Ncqd+lwU5QZzjCAWyAMaNU/6bM1iRvsDvGsVq37/R162+RRQJ834uZ5FObK61D X-Received: by 2002:aa7:8218:: with SMTP id k24mr11700626pfi.221.1565222999730; Wed, 07 Aug 2019 17:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565222999; cv=none; d=google.com; s=arc-20160816; b=PYeIk0T9uVrlvVrN4Y7e+oksSPJD+fcNuEvlaxhAmgNr7zYbu0spO8a5I0YthrHBbv j/cgi+dVMHFNLX9oS7PSgpKPABegeLoH0rH5boHYmvR7a5TRAKgWmvEIwqo21RrSlvD6 Xlc8pySoUhTF4LPtu4SOSkItVnkXawTy1NXUTJxW6EDAqEcJzPfdAS1aLKP2eG4u7XEa Ux04+k+8L2OFevbCCP5Ex0bClO+O+RWdH1J8wwHnCUt2OYAc024tPpn8FEn3PxzuNyUo WSfZMF+oBDzqAhT5Pwv+jBF+4p3X7xAKeAjMFROtYMKYoH0F1CX2ztMj/NEqIHuStRbf 0rsQ== 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=I/5rlFVBONd1Ka7/QUlhE63dhV+4TxEgC7HKPRr7Vsc=; b=YFyaNZdY1lBJMPzndoWUTqJAs4hf91deIyKp4EgO3b4oabyw+138DuIuxxHAWOX0gX mm4hZpVJiCLpniOPX5PhAh+9ZwraMiU8rhMp+iO70ZiMCmL/FeNbiW7CUi6rpk5zycom zybQAEnrdqz9jHsztVIsXZwYff7KMctxdcpUvhCvaIfigZpW+prP8RUpF2hyz5EAQ23Z CyozBSUULemtUF6Pk8jhPonu5u9f9RXNL+8vFUHIHTgus7R7P599B8uhbSQHBvnhx2AE clfe9dIjmVjQZ7FT/MBOBqgjCrMBltt2n94Z8PWC7wKORb4A5Uf5WsX2D0dbcsV+k8/6 SADw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AQ32ZYFy; 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 d5si45983960pls.233.2019.08.07.17.09.44; Wed, 07 Aug 2019 17:09:59 -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=AQ32ZYFy; 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 S2389520AbfHHAHq (ORCPT + 99 others); Wed, 7 Aug 2019 20:07:46 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:39641 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389404AbfHHAHn (ORCPT ); Wed, 7 Aug 2019 20:07:43 -0400 Received: by mail-qk1-f201.google.com with SMTP id x1so80728083qkn.6 for ; Wed, 07 Aug 2019 17:07:43 -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=I/5rlFVBONd1Ka7/QUlhE63dhV+4TxEgC7HKPRr7Vsc=; b=AQ32ZYFy04wA4mb2XkzJMu41uBwdTPJVCQkZLoSqoG5BPESh7PtahcJElB42fN7yCa RgpAdVhcQ5fuL4/xbllTjDfI2lyqus7qV8tRpcqdDJ/VX1SpE4XMZ3HvF0pfgCWIcmbA Zz9a2qpUoHBQ5fw1br+vqmDeXDCgSck943n71lbq0K8fl99KDPL9Cr+apC6baNZBDpqB yetG9rfVr7XgiWV+oEMuvXWmxki7WHMWAVAgsDWQ3kUNYceMtvrIEGX+u90sxOg52+xU WwDTm3LZ/jev4cFV6SJG2fghnPLj1QbrnL9bCZ9OKuqjQneM4UxIH4SbmaYnC+fTKyUe xoQQ== 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=I/5rlFVBONd1Ka7/QUlhE63dhV+4TxEgC7HKPRr7Vsc=; b=ZQKsljA2DJFdVeJmw6sJ0t3P2e97noIGvEcuWBk6bff2vnshipDmHOuw3Zt0AfSfgJ cPoN4aP3in/ZybhAhc/ALw0YLcnZ6BdBufSHlg99JpzlgcnOkhH86KPrbfQL1leVoh0i Uvy2WH6h16o18UO3XVDrY4hT7nwwnRFAt4HE6UVndBSW4wDnNlHlX1NskCa+OjQIKhgO 73GPm2OfNtO9V0GXIEdA17s10iYF0c1CwGAjddIUzuiWXwjTVxvYEODqYrmWkw+BJRCA C5lNxL+i2ZEyhrluE9MqcRVK5KmBMwFv3paPb5FT3/YfEfIrsWgHIw4Kot3zrajI3A2F blfQ== X-Gm-Message-State: APjAAAU6uQZPQooSvGLn/+Ti75nIgDsxsxiMCa160WKRGW/YwoPpyc1g KZqdEmWJsBRKiSv7WoK5/XYt4dYtPA4F6lQE8s7iOA== X-Received: by 2002:a0c:eec2:: with SMTP id h2mr10594442qvs.189.1565222862448; Wed, 07 Aug 2019 17:07:42 -0700 (PDT) Date: Wed, 7 Aug 2019 17:06:59 -0700 In-Reply-To: <20190808000721.124691-1-matthewgarrett@google.com> Message-Id: <20190808000721.124691-8-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190808000721.124691-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH V38 07/29] 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, linux-api@vger.kernel.org, Dave Young , David Howells , Matthew Garrett , Kees Cook , kexec@lists.infradead.org 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 Signed-off-by: Matthew Garrett Reviewed-by: Kees Cook cc: kexec@lists.infradead.org --- 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 5ebcd02cbca7..d2f4e706a428 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -180,6 +180,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.22.0.770.g0f2c4a37fd-goog