From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932684AbbJNPbN (ORCPT ); Wed, 14 Oct 2015 11:31:13 -0400 Received: from mail-oi0-f46.google.com ([209.85.218.46]:33769 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753739AbbJNPbI (ORCPT ); Wed, 14 Oct 2015 11:31:08 -0400 MIME-Version: 1.0 In-Reply-To: <20151014151807.GA27013@gmail.com> References: <20151003112701.GA4531@gmail.com> <5612CBE8.2010504@tycho.nsa.gov> <20151006073205.GA11115@gmail.com> <5613EAD5.2070405@tycho.nsa.gov> <20151012113605.GB7384@pd.tnic> <20151012124113.GD2579@codeblueprint.co.uk> <20151012124936.GA6260@gmail.com> <20151012125548.GE2579@codeblueprint.co.uk> <20151012141754.GA6621@gmail.com> <20151012144928.GF2579@codeblueprint.co.uk> <20151014151807.GA27013@gmail.com> From: Andy Lutomirski Date: Wed, 14 Oct 2015 08:30:48 -0700 Message-ID: Subject: Re: [PATCH v2] x86/mm: warn on W+x mappings To: Ingo Molnar Cc: Matt Fleming , Borislav Petkov , Stephen Smalley , X86 ML , "linux-kernel@vger.kernel.org" , Kees Cook , Thomas Gleixner , "H. Peter Anvin" , Peter Zijlstra , Andy Lutomirski , Denys Vlasenko , Brian Gerst , "linux-efi@vger.kernel.org" , Ard Biesheuvel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 14, 2015 at 8:18 AM, Ingo Molnar wrote: > > * Matt Fleming wrote: > >> On Mon, 12 Oct, at 04:17:54PM, Ingo Molnar wrote: >> > >> > * Matt Fleming wrote: >> > >> > > On Mon, 12 Oct, at 02:49:36PM, Ingo Molnar wrote: >> > > > >> > > > >> > > > So why not unmap them after bootup? Is there any reason to call into EFI code >> > > > while the system is up and running? >> > > >> > > That's where the runtime services code lives. So if you want things like EFI >> > > variables (used by the distro installer, among other things) you need to map the >> > > runtime regions. >> > >> > So EFI variables could be queried during bootup and saved on the Linux side. >> >> Right, we could do that, but then we wouldn't be able to support >> creation/updating variables at runtime, such as when you install a >> distribution for the first time, or want to boot a new kernel filename >> directly from the firmware without a boot loader (and need to modify >> the BootXXXX variables). > > Do we know the precise position and address range of these variables? > > We could map them writable (but not executable), and the rest executable (but not > writable). > > That raises the question whether the same physical page ever mixes variables and > actual code - but the hope would be that it's suffiently page granular for this to > work. Can we just unmap these things until someone tries to do an EFI call, and then unmap them again after the call returns? We already switch pgds for EFI IIRC. --Andy