Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3353527ybl; Mon, 19 Aug 2019 17:19:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOH4LwsUOLMdafL5gCVPfUdnFU9jF2ZOERTLTjItfGE9NduaeurbnwJlfmQQ0CuT9td3/7 X-Received: by 2002:a17:90a:19c4:: with SMTP id 4mr8119477pjj.20.1566260391267; Mon, 19 Aug 2019 17:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566260391; cv=none; d=google.com; s=arc-20160816; b=WHSjk5G9XPzpovAanM7Flq81kLFw69PV+IvJOM1JVeBhLiniWv0eaYRXPqi6YZKMiG YyEiG6dTpV014QZ1bvmWqy0dUAoAyspR7bqYc6hdTj15FlLLUQzNpaMA63HfsZ4RcF0d XLQyRRt1Gjva2+U593Yd0NnjLRAYnX87QDuLRNK7ZpB68wK3S5NA8SHkN750a1+JvHRi 2BGh3KZvOJZbyR/YuB8HZzOIi/uAx/4bf0/aiCDmZ5O83kxkOcO1lOrwb0raYa1GF1Hx Fv1zE0lgy0uCZmnw4TfgcFO50eSwBTFHC9O8GfQ3e0vVaGsgvjDmsanECDCvMSbFj9NY xYtg== 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=2LlLKA7xilo57KgJ9aBUFbPNJv3YWGuiG9UEU7t1Rzg=; b=Pg6eczhkO9GPcb3gjuS9bccuKXDvDQbZpucE2MyJM2ERFpHQsKX1CHqe1F/3uTdoRb qDt0JpvnxW3oikRFyzuNMvacvjaER9iO2IxK4weQSAFlPG94AOHbGvEI28sGGknivMPW 11mAVZy8jxcFBz616DEb0jaIWGLKc1vODm9mG/KWRrdg98TNcIVEU/6gacNyhQeiTmXf zu9FMjx6wwkE7R2uut8xtsW5WsYxU0OPBz68xYisqDvrFgkdEBTU2hBnQNQZzNnGHwi3 9tp5TT+Zfki68E7MHUE/z8hr2kNtMkn1aRoXkHut3erJQCwXjiLOOMMpbB3/7BCsr30c kOsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dNREMDP+; 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 i3si11066989pld.357.2019.08.19.17.19.36; Mon, 19 Aug 2019 17:19:51 -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=dNREMDP+; 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 S1728959AbfHTASc (ORCPT + 99 others); Mon, 19 Aug 2019 20:18:32 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:52203 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728950AbfHTAS3 (ORCPT ); Mon, 19 Aug 2019 20:18:29 -0400 Received: by mail-pl1-f202.google.com with SMTP id p9so2933044pls.18 for ; Mon, 19 Aug 2019 17:18:29 -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=2LlLKA7xilo57KgJ9aBUFbPNJv3YWGuiG9UEU7t1Rzg=; b=dNREMDP+TG2C/LXVb2y5pqTvco3iRS0dhBeVXMI8yStBmDaDACn0KU8WoFg0ZtiOXp +1T4zFY7wH7Hw2KCv+l3gjoQjRE/73lZVZEUW/AxAXh5v8A/u/MA69OZI3mABCI5gjeV HrllyORU7+ymSitKrwkt1XKnOTXejRQnccT/TflwDunzx9Gwi8xnTdCF/J87R4Dcn7wJ zhSsHEU1M6/OXOYC0CsCHnWyZYtewSK+4HWUGPTxGmxYYU+8IZ8m4D7NiVEtuaekKsia XKn86Aw95n02in30KWH/5BMISqdYFuHokAcKWfBMQBNqA6fB+Me65VVB9TyV7Q/5MjKD Zmqg== 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=2LlLKA7xilo57KgJ9aBUFbPNJv3YWGuiG9UEU7t1Rzg=; b=M+k9HlT9IRrPWMertr6xkHvGquS9xQRuyx3DUQxTwZldVJCyDZrcvlxaB48dcX6BEj hk7+gTkdiax24zYtV9VTfR3ULXXl5HyXBToOjk1AGE64tDzmmBwhFS0GfOxylwDNmfqV j1H2rDwTe97s1hwX054DTUAeK3Xpn1af/zSh4whBl7awCWmefc7lJ61QJnkIljLNdd0J XvrzQIi7nFf060PU9xoV0nObG5+F4H6y2ESwFIwU8x3abg4qI1FaswxiSKFOjqRuYYm8 vj/pSosv1Y65DFza/9FfqWJDb8bK0W6357QAN6sOTzfm6qEtoh558v0FrcGEgRgH/3J9 vPkQ== X-Gm-Message-State: APjAAAWZeSEtbebq6AdIPSuosfGou1X92z00EebkAwzzMPY1duU92ecP bN+keUa6Zf2Cb1PvjRC6awBLuEjHB5zT7LLvyK1itw== X-Received: by 2002:a63:5b52:: with SMTP id l18mr22232462pgm.21.1566260308483; Mon, 19 Aug 2019 17:18:28 -0700 (PDT) Date: Mon, 19 Aug 2019 17:17:43 -0700 In-Reply-To: <20190820001805.241928-1-matthewgarrett@google.com> Message-Id: <20190820001805.241928-8-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190820001805.241928-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH V40 07/29] lockdown: 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 Signed-off-by: James Morris --- 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 f03237e3f192..5d64a22f99ce 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.23.0.rc1.153.gdeed80330f-goog