Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751757AbbKGHGD (ORCPT ); Sat, 7 Nov 2015 02:06:03 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:34347 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751312AbbKGHGB (ORCPT ); Sat, 7 Nov 2015 02:06:01 -0500 Date: Sat, 7 Nov 2015 08:05:54 +0100 From: Ingo Molnar To: Matt Fleming Cc: Linus Torvalds , Dave Jones , Linux Kernel Mailing List , Thomas Gleixner , "H. Peter Anvin" , Borislav Petkov , Andrew Morton , Andy Lutomirski , Denys Vlasenko , Stephen Smalley , linux-efi@vger.kernel.org Subject: Re: [GIT PULL] x86/mm changes for v4.4 Message-ID: <20151107070554.GB6235@gmail.com> References: <20151103111649.GA3477@gmail.com> <20151104233907.GA25925@codemonkey.org.uk> <20151105021710.GA22941@codemonkey.org.uk> <20151106113943.GB2651@codeblueprint.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151106113943.GB2651@codeblueprint.co.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2583 Lines: 61 * Matt Fleming wrote: > On Thu, 05 Nov, at 01:33:10PM, Linus Torvalds wrote: > > > > And if this turns out to be due to EFI wanting those permissions, what should > > we do? People have talked about running the EFI callbacks in their own private > > page table setup, which sounds like the right idea, but until that actually > > *happens*.... > > We have separate page tables today, for a few reasons, but mainly it's > so that we can have an identity mapping of memory present in the > region usually used by user processes - broken firmware still uses > those identity mappings even after the kernel tells it they're > invalid. > > Note that when I say "separate" I'm talking about trampoline_pgd[] > which is also used by the x86 suspend/resume code. > > However, turns out that the issue with the current scheme is the fact > that trampoline_pgd[] actually shares a couple of PGD entries with > swapper_pg_dir as can be seen in setup_real_mode(), > > > trampoline_pgd = (u64 *)__va(real_mode_header->trampoline_pgd); > trampoline_pgd[0] = init_level4_pgt[pgd_index(__PAGE_OFFSET)].pgd; > trampoline_pgd[511] = init_level4_pgt[511].pgd; > > > So when we map the EFI regions in efi_map_regions() we're inserting > them into swapper_pg_dir also, which is why you're seeing the > warnings. > > If I remember correctly the rationale for using trampoline_pgd[] was > that it already did what we wanted (provided the identity mapping) and > would save us the overhead of maintaining more page tables for no good > reason. Obviously this entire thread is a good reason. > > I suggest we stop using trampoline_pgd[] (since it has a good reason > for sharing the kernel mapping PGD entries) and create our own so that > we can isolate EFI completely. Ok. Could you please make this fix a priority for upcoming EFI changes? > For the immediate problem of the warnings spewing forth on all UEFI > machines, at the very least the config options needs to be disabled by > default, if not the patch reverted. We'll certainly flip around the default, but reverting would be shooting the messenger: the EFI code is endangering everyone else today, and for no good reason as it appears... so the warning very much served its purpose in pointing out a valid problem. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/