From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751857AbcAWGlk (ORCPT ); Sat, 23 Jan 2016 01:41:40 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:33610 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbcAWGlh (ORCPT ); Sat, 23 Jan 2016 01:41:37 -0500 Date: Sat, 23 Jan 2016 12:37:56 +0600 From: Alexander Kuleshov To: Brian Gerst Cc: Alexander Kuleshov , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andy Lutomirski , Borislav Petkov , Denys Vlasenko , Andrey Ryabinin , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [RFC PATCH] x86/head_64.S: remove redundant check that kernel address is 2M aligned Message-ID: <20160123063756.GB1205@localhost> References: <1453486392-10289-1-git-send-email-kuleshovmail@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux X-Date: Sat Jan 23 12:14:21 ALMT 2016 User-Agent: Mutt/1.6.0-rc0 ((null)) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Brian, On 01-22-16, Brian Gerst wrote: > > > > - /* Is the address not 2M aligned? */ > > - movq %rbp, %rax > > - andl $~PMD_PAGE_MASK, %eax > > - testl %eax, %eax > > - jnz bad_address > > - > > /* > > * Is the address too large? > > */ > > I think we still need to do the check, in case we came from a 64-bit > bootloader that directly jumped to startup_64. However, this check > can be simplified to: > > testl $~PMD_PAGE_MASK, %ebp > jnz bad_address Ah, ok, in this way we can't trust a bootloader. I just thought that 64-bit entry point is startup_64 from arch/x86/boot/compressed/head_64.S Thank you.