Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1180321ybf; Thu, 27 Feb 2020 06:25:11 -0800 (PST) X-Google-Smtp-Source: APXvYqz67iq4Vb4qxDzNxULx1BStB0Tjf40MnjxVEUKoXJIPmVu5ATD5Od1rfaxtT3dd5bduF92U X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr3509896oig.81.1582813510862; Thu, 27 Feb 2020 06:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582813510; cv=none; d=google.com; s=arc-20160816; b=TT7LXqT7u3cD3AAJdWyqCoYAWW/XWPmV0HKGkcuz6YtHuvsdr1E1hBoahA/3hO8tjY Zqs5DhOAPu4KqC9gC7VdSRomqBsZPmUyozlC+AA0ClreXJHluAqHKfC9Oxs1Ycr9WL33 0eV6KWJWaQIqpF/jKEV/du7dn9eVq+ryPxTt/vwBaSB9hhral+qPhdEfnwceYjuyw3fP ReaAZlVpqpd7hj8FaBeNZSX2KLvJSI3ijczNV08H7/LN+7k2dmvs2Y8h/get9yNgqa8v rp/EJ9XE8H0iTVjHh0XJpbKWuEd6gPqV4hXS7RqLHZtGvB3DzOei1nqJRs0vq59ff3aS u+YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g1NyAYfmeXrZHTGbLSTanZj9kYDEeN7xl11O8UXOsm0=; b=lBb/7sf4Bf32yNup87oPYanfooCgQqV6TZlQHl8AYe+YOf14ntZwonYJG4ARlxgrak oMdg4FfjhdxnAn/IUyznHKQUoW2xS2F53m8e4oheS/y8xSYL6SA/wb0f6mfePRqgdUxb k6FKkMxo+bIEshBg8n7iT8EuKA7CCRabZpS6XgCp74OWcfUX/oN5nmFDmQMCYYHKkRRh purQJoqeQ1T14a16KIyWXnL+x96oZsbWKHt8j2PBGhctC4OaEwkJp+Qo3mq+5EzoERcZ wETijTAeyTvCtmT6dZIMvmNlwQBiUftC5Uq+96aj5/4jFDr7uwev1qQ8YZsf8UXYZfQN mwPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cJ4+wj4G; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a22si1387135oii.98.2020.02.27.06.24.58; Thu, 27 Feb 2020 06:25:10 -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=@kernel.org header.s=default header.b=cJ4+wj4G; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389017AbgB0OPH (ORCPT + 99 others); Thu, 27 Feb 2020 09:15:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:54550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388801AbgB0OPE (ORCPT ); Thu, 27 Feb 2020 09:15:04 -0500 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 7E46324691; Thu, 27 Feb 2020 14:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812904; bh=hTb/1GuHF2M2JOtCgLljW2B8Dk7zHQrkGnfDwohYq90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cJ4+wj4GMdaq1/jQ5pAnrxV4Pw0UCHi8Zxu/vv3rcsrm4Vitl29X/l3l+Sre/0BpJ IiipQruDhR4kcBsDt4UD60nzhFO0qCz6VW0hKf1hSp8n8IKklwOLUCBAo76VQHwzkv lQ8i8ZIWuEI/kgf9Ls3JopgWTLTw3uL3suGPPFGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Garrett , Ard Biesheuvel , Mimi Zohar Subject: [PATCH 5.5 059/150] x86/ima: use correct identifier for SetupMode variable Date: Thu, 27 Feb 2020 14:36:36 +0100 Message-Id: <20200227132241.780810136@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132232.815448360@linuxfoundation.org> References: <20200227132232.815448360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel commit ff5ac61ee83c13f516544d29847d28be093a40ee upstream. The IMA arch code attempts to inspect the "SetupMode" EFI variable by populating a variable called efi_SetupMode_name with the string "SecureBoot" and passing that to the EFI GetVariable service, which obviously does not yield the expected result. Given that the string is only referenced a single time, let's get rid of the intermediate variable, and pass the correct string as an immediate argument. While at it, do the same for "SecureBoot". Fixes: 399574c64eaf ("x86/ima: retry detecting secure boot mode") Fixes: 980ef4d22a95 ("x86/ima: check EFI SetupMode too") Cc: Matthew Garrett Signed-off-by: Ard Biesheuvel Cc: stable@vger.kernel.org # v5.3 Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/ima_arch.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/arch/x86/kernel/ima_arch.c +++ b/arch/x86/kernel/ima_arch.c @@ -10,8 +10,6 @@ extern struct boot_params boot_params; static enum efi_secureboot_mode get_sb_mode(void) { - efi_char16_t efi_SecureBoot_name[] = L"SecureBoot"; - efi_char16_t efi_SetupMode_name[] = L"SecureBoot"; efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID; efi_status_t status; unsigned long size; @@ -25,7 +23,7 @@ static enum efi_secureboot_mode get_sb_m } /* Get variable contents into buffer */ - status = efi.get_variable(efi_SecureBoot_name, &efi_variable_guid, + status = efi.get_variable(L"SecureBoot", &efi_variable_guid, NULL, &size, &secboot); if (status == EFI_NOT_FOUND) { pr_info("ima: secureboot mode disabled\n"); @@ -38,7 +36,7 @@ static enum efi_secureboot_mode get_sb_m } size = sizeof(setupmode); - status = efi.get_variable(efi_SetupMode_name, &efi_variable_guid, + status = efi.get_variable(L"SetupMode", &efi_variable_guid, NULL, &size, &setupmode); if (status != EFI_SUCCESS) /* ignore unknown SetupMode */