Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1183585ybf; Thu, 27 Feb 2020 06:28:02 -0800 (PST) X-Google-Smtp-Source: APXvYqz0UmPOQyFUVa7ml0IiT3jHeOk9fi+VP2K6mrQwYwGC7UARYd5REUNMcT/iN57Ns9XvUfCk X-Received: by 2002:aca:f305:: with SMTP id r5mr3607490oih.174.1582813681876; Thu, 27 Feb 2020 06:28:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582813681; cv=none; d=google.com; s=arc-20160816; b=mhc+enIZnrkn0sD02F4vqbH0tkVYsCUOPhgQnCCgZmSeurSvSu/pfIBVMsLenyKUTP 0V0pu5cndh7Fc7syoKygQfeErM4v34Od6JybIeuezZ1jm2Z9solkMWkll3sq0VF/z/h3 ben8yCU79tsl3Ay4tB/KVBPJGM1pdPXpOsYLV2bVKZmy2bjV6nholstrlQmYwFyiK+B5 u/9NZ/ba4Id5Vi8DMuMnAwbJ63psru7o5wNAgiN1D1CAuqmfptBq87GtR3XqQtRr+XeW orWt1aJM4pGuFYyC+iwWNHIShlAZTR2MRl5oKcfvNRjfASsLXiuCOmCh8BZUgRz4gqca 91rQ== 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=WCQwk/jCMPnE++rWDvZWsj9IOM/6Fj739FTkQQQNYoxmIn4IqN5TDHMlwrYSIv3PV/ c3I2UoQkAF+ckTjoSsysIOlOxT+fQHVIezL2F/AHtFL3u7g8Jms6rJ4WoVOJ65WIQEzD 8y6TAF7WHN3k/MIRXbMgA14jG6zmxZAeau7UXobuAF+1gYAwpi4MoWK9cpG7HO2AVSb6 88PHXluiw6geLuXONHdJcHTZn7IfHV+7igGB7YRDJB9+8/gb/YjTx+Jr4DEt8F0y6Oyp WmEZQnDRmM+GZdH6iEpCoYFqbmqjFx3drdEYnsWOUeEfaievtbsi1OQRN22wZ31Ee8bH ht9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xgVtXGww; 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 h2si1351446oie.151.2020.02.27.06.27.50; Thu, 27 Feb 2020 06:28:01 -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=xgVtXGww; 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 S2388295AbgB0OIw (ORCPT + 99 others); Thu, 27 Feb 2020 09:08:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:46670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388293AbgB0OIt (ORCPT ); Thu, 27 Feb 2020 09:08:49 -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 1599A24690; Thu, 27 Feb 2020 14:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812528; bh=hTb/1GuHF2M2JOtCgLljW2B8Dk7zHQrkGnfDwohYq90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xgVtXGww0CSFgopSuB/ms12sp2ZdHl6ZUtUkIefMR2JJCVvom7MY2tvtZcfcwUZKZ nfdAd74IkDbnR2GvaTKcFrx7lSQqlLpB6O1xZkOir8TfLcBVrWLWdg002T9sm5BJzR ZlIqX+dX36s4ZxkvTHVq4KlmdIq1c5DtMj72FJWQ= 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.4 051/135] x86/ima: use correct identifier for SetupMode variable Date: Thu, 27 Feb 2020 14:36:31 +0100 Message-Id: <20200227132236.833158415@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132228.710492098@linuxfoundation.org> References: <20200227132228.710492098@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 */