Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1399617ybz; Thu, 16 Apr 2020 08:30:06 -0700 (PDT) X-Google-Smtp-Source: APiQypJv+WsSpZ9sm234YOIFkI61S7CVa0dELL8yp+Xk0+q8Aq1NZy49DOYlnzASz6ZJwPTXdX7R X-Received: by 2002:aa7:d794:: with SMTP id s20mr18413942edq.141.1587051006584; Thu, 16 Apr 2020 08:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587051006; cv=none; d=google.com; s=arc-20160816; b=Raa7BOYd5o/iN1N/LKOrw08zMYPvr23cT2/hl1bt3G3tGGyOIqyLIlC3fRYIU2Y0DB DU9gpfK++K2u0uaPMZDLm/sEdLXEgsTstKTfur1a1PG5MDHgSh4j23Fy5ylO5VifrlU7 2BZ6g9p7dM3KJ+qzaW4BmQ8w6D5VjXkDYYR7KXHq1R0Bpl4d8c4dZEXo5uYX5ln3/ICI cwXT64YL6Awb+CnbC3mHP8U68/v+aIeEnJ4TsWfnKX1DgXmebtca8+vdX37M9SizTIeo BwtsB+8iQYdKg0hnMuzymwkyvbJu5fsrWrTjQJOzGULEucWGYHwizg9gMqLTV+HZCidW a2FA== 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=bOc2/81sOLipNvn0CeqMyH3P/AKSN0ZAsvy+iTXZLMc=; b=zYiqoZNgMZATPVOwmNypAcmSNbDmzyLjbV0AJw1RHBIto9c/hwG+aljjux82pIc55I ylomJL1O8gzMuO5vC08NbOoaPMZxddfJK3maVefRSlfpGQm+b9K1NLxeCgktW9z5jdnm MbF2Upisq2272QdbVi5QLuMgsSH9ehL6aqjc94ydrYHg/XNipY0gT8aC2Pt8j+zcPTDw WiBRaHt5N6+cuRB00ozwljQQ+fmAgIdx3iCXp7u8r5HpoQZtvhfrnp7b8Tb1tfBZM13c PTM0rYLDZX147pOJ7WVqVxqI/9rua5W736SufsqR8N3aenGBLQRcxvK53i4MWiuqf0Fw EtBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bphs0LKd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj20si5991020ejb.48.2020.04.16.08.29.42; Thu, 16 Apr 2020 08:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bphs0LKd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729526AbgDPP1f (ORCPT + 99 others); Thu, 16 Apr 2020 11:27:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:57734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898448AbgDPNo3 (ORCPT ); Thu, 16 Apr 2020 09:44:29 -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 7B9812076D; Thu, 16 Apr 2020 13:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044669; bh=VYPYg6i/pKod6qF6y1lY09357dtCaYVNp3iKvoKFzC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bphs0LKd+f/7qhwOyo2uF+Kdskb662yWrw5GxK852kGQyYRy2DBVy1nkMOuaa6Gs0 8pp3oWm6Yh4LfUYavqfEjhVynRvl5g+Ht4zYgPuJFjfXywd1Hb7A7sIdFlwo6HZiFU KvAwcqIUWq0/AUD/sglDGQL6ATHToNAKKI/Ibgfg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arvind Sankar , Ard Biesheuvel , Ingo Molnar , Sasha Levin Subject: [PATCH 5.4 054/232] efi/x86: Ignore the memory attributes table on i386 Date: Thu, 16 Apr 2020 15:22:28 +0200 Message-Id: <20200416131322.379079652@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131316.640996080@linuxfoundation.org> References: <20200416131316.640996080@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 [ Upstream commit dd09fad9d2caad2325a39b766ce9e79cfc690184 ] Commit: 3a6b6c6fb23667fa ("efi: Make EFI_MEMORY_ATTRIBUTES_TABLE initialization common across all architectures") moved the call to efi_memattr_init() from ARM specific to the generic EFI init code, in order to be able to apply the restricted permissions described in that table on x86 as well. We never enabled this feature fully on i386, and so mapping and reserving this table is pointless. However, due to the early call to memblock_reserve(), the memory bookkeeping gets confused to the point where it produces the splat below when we try to map the memory later on: ------------[ cut here ]------------ ioremap on RAM at 0x3f251000 - 0x3fa1afff WARNING: CPU: 0 PID: 0 at arch/x86/mm/ioremap.c:166 __ioremap_caller ... Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.20.0 #48 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015 EIP: __ioremap_caller.constprop.0+0x249/0x260 Code: 90 0f b7 05 4e 38 40 de 09 45 e0 e9 09 ff ff ff 90 8d 45 ec c6 05 ... EAX: 00000029 EBX: 00000000 ECX: de59c228 EDX: 00000001 ESI: 3f250fff EDI: 00000000 EBP: de3edf20 ESP: de3edee0 DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00200296 CR0: 80050033 CR2: ffd17000 CR3: 1e58c000 CR4: 00040690 Call Trace: ioremap_cache+0xd/0x10 ? old_map_region+0x72/0x9d old_map_region+0x72/0x9d efi_map_region+0x8/0xa efi_enter_virtual_mode+0x260/0x43b start_kernel+0x329/0x3aa i386_start_kernel+0xa7/0xab startup_32_smp+0x164/0x168 ---[ end trace e15ccf6b9f356833 ]--- Let's work around this by disregarding the memory attributes table altogether on i386, which does not result in a loss of functionality or protection, given that we never consumed the contents. Fixes: 3a6b6c6fb23667fa ("efi: Make EFI_MEMORY_ATTRIBUTES_TABLE ... ") Tested-by: Arvind Sankar Signed-off-by: Ard Biesheuvel Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200304165917.5893-1-ardb@kernel.org Link: https://lore.kernel.org/r/20200308080859.21568-21-ardb@kernel.org Signed-off-by: Sasha Levin --- drivers/firmware/efi/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index ad8a4bc074fbf..e3861d267d9aa 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -562,7 +562,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz, } } - if (efi_enabled(EFI_MEMMAP)) + if (!IS_ENABLED(CONFIG_X86_32) && efi_enabled(EFI_MEMMAP)) efi_memattr_init(); efi_tpm_eventlog_init(); -- 2.20.1