From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753167AbbIZRBh (ORCPT ); Sat, 26 Sep 2015 13:01:37 -0400 Received: from mail-ob0-f175.google.com ([209.85.214.175]:36394 "EHLO mail-ob0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752924AbbIZRBe (ORCPT ); Sat, 26 Sep 2015 13:01:34 -0400 MIME-Version: 1.0 In-Reply-To: <20150926055643.GA25877@gmail.com> References: <1443218539-7610-1-git-send-email-matt@codeblueprint.co.uk> <1443218539-7610-2-git-send-email-matt@codeblueprint.co.uk> <20150926055643.GA25877@gmail.com> From: Andy Lutomirski Date: Sat, 26 Sep 2015 10:01:14 -0700 Message-ID: Subject: Re: [PATCH 1/2] x86/efi: Map EFI memmap entries in-order at runtime To: Ingo Molnar Cc: Matt Fleming , Thomas Gleixner , "H. Peter Anvin" , Matt Fleming , "linux-kernel@vger.kernel.org" , "linux-efi@vger.kernel.org" , "Lee, Chun-Yi" , Borislav Petkov , Leif Lindholm , Peter Jones , James Bottomley , Matthew Garrett , Dave Young , stable , Ard Biesheuvel , Linus Torvalds , Borislav Petkov , Andy Lutomirski , Denys Vlasenko , Brian Gerst , Andrew Morton 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 Fri, Sep 25, 2015 at 10:56 PM, Ingo Molnar wrote: > > So this commit worries me. > > This bug is a good find, and the fix is obviously needed and urgent, but I'm not > sure about the implementation at all. (I've Cc:-ed a few more x86 low level > gents.) > > * Matt Fleming wrote: >> + /* >> + * Starting in UEFI v2.5 the EFI_PROPERTIES_TABLE >> + * config table feature requires us to map all entries >> + * in the same order as they appear in the EFI memory >> + * map. That is to say, entry N must have a lower >> + * virtual address than entry N+1. This is because the >> + * firmware toolchain leaves relative references in >> + * the code/data sections, which are split and become >> + * separate EFI memory regions. Mapping things >> + * out-of-order leads to the firmware accessing >> + * unmapped addresses. >> + * I'm clearly missing something. What is EFI doing that it doesn't care how big the gap between sections is but it still requires them to be in order? It's not as though x86_64 has an addressing mode that allows only non-negative offsets. --Andy From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [PATCH 1/2] x86/efi: Map EFI memmap entries in-order at runtime Date: Sat, 26 Sep 2015 10:01:14 -0700 Message-ID: References: <1443218539-7610-1-git-send-email-matt@codeblueprint.co.uk> <1443218539-7610-2-git-send-email-matt@codeblueprint.co.uk> <20150926055643.GA25877@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <20150926055643.GA25877-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Ingo Molnar Cc: Matt Fleming , Thomas Gleixner , "H. Peter Anvin" , Matt Fleming , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "Lee, Chun-Yi" , Borislav Petkov , Leif Lindholm , Peter Jones , James Bottomley , Matthew Garrett , Dave Young , stable , Ard Biesheuvel , Linus Torvalds , Borislav Petkov , Andy Lutomirski , Denys Vlasenko , Brian Gerst , Andrew Morton List-Id: linux-efi@vger.kernel.org On Fri, Sep 25, 2015 at 10:56 PM, Ingo Molnar wrote: > > So this commit worries me. > > This bug is a good find, and the fix is obviously needed and urgent, but I'm not > sure about the implementation at all. (I've Cc:-ed a few more x86 low level > gents.) > > * Matt Fleming wrote: >> + /* >> + * Starting in UEFI v2.5 the EFI_PROPERTIES_TABLE >> + * config table feature requires us to map all entries >> + * in the same order as they appear in the EFI memory >> + * map. That is to say, entry N must have a lower >> + * virtual address than entry N+1. This is because the >> + * firmware toolchain leaves relative references in >> + * the code/data sections, which are split and become >> + * separate EFI memory regions. Mapping things >> + * out-of-order leads to the firmware accessing >> + * unmapped addresses. >> + * I'm clearly missing something. What is EFI doing that it doesn't care how big the gap between sections is but it still requires them to be in order? It's not as though x86_64 has an addressing mode that allows only non-negative offsets. --Andy