From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7920C2BCA1 for ; Fri, 7 Jun 2019 15:52:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3797204EC for ; Fri, 7 Jun 2019 15:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559922743; bh=w9mbrg/9IYmvfv8hDeatHsg1Bwq8llFRl8Ea1mJVDsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QaQHr7XyMGNv+eSI5RnPsmMQlEt97G5iMxCeS6+xwFKG1aitEsgFhF6WH9nGhlnSI 0YYqMKg4Ih4QadfwWDLaNZslGKo7e69hWzWoAZ8Wd6iTqBT6O1nKemosmS1n4N8wix xWfHlpwvMGkq1529cFekN1FLO7B9uZUfUFhnMsTw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731952AbfFGPt3 (ORCPT ); Fri, 7 Jun 2019 11:49:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:35436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731965AbfFGPt2 (ORCPT ); Fri, 7 Jun 2019 11:49:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D94FB21473; Fri, 7 Jun 2019 15:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559922568; bh=w9mbrg/9IYmvfv8hDeatHsg1Bwq8llFRl8Ea1mJVDsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYHsIEZXU89271m5P3D96Vh+2E8ptKbZn+Ly5eXu+VIkwXiIPnIx1RJs5K1Hrq4Gy ykaW3R4jTG75yDaN6wmcvdP76QaLbddl8b4WBHs3mQUP3zS9aisstiYxDBPRW+AsKf t9YaLqBohYKmWJBb2/+goor0LkXheZrC76n4M/QE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Wood , Mimi Zohar Subject: [PATCH 5.1 58/85] x86/ima: Check EFI_RUNTIME_SERVICES before using Date: Fri, 7 Jun 2019 17:39:43 +0200 Message-Id: <20190607153855.914553406@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190607153849.101321647@linuxfoundation.org> References: <20190607153849.101321647@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Scott Wood commit 558b523d46289f111d53d7c42211069063be5985 upstream. Checking efi_enabled(EFI_BOOT) is not sufficient to ensure that EFI runtime services are available, e.g. if efi=noruntime is used. Without this, I get an oops on a PREEMPT_RT kernel where efi=noruntime is the default. Fixes: 399574c64eaf94e8 ("x86/ima: retry detecting secure boot mode") Cc: stable@vger.kernel.org (linux-5.0) Signed-off-by: Scott Wood Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/ima_arch.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/x86/kernel/ima_arch.c +++ b/arch/x86/kernel/ima_arch.c @@ -17,6 +17,11 @@ static enum efi_secureboot_mode get_sb_m size = sizeof(secboot); + if (!efi_enabled(EFI_RUNTIME_SERVICES)) { + pr_info("ima: secureboot mode unknown, no efi\n"); + return efi_secureboot_mode_unknown; + } + /* Get variable contents into buffer */ status = efi.get_variable(efi_SecureBoot_name, &efi_variable_guid, NULL, &size, &secboot);