From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932323AbcAHLns (ORCPT ); Fri, 8 Jan 2016 06:43:48 -0500 Received: from foss.arm.com ([217.140.101.70]:44776 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932178AbcAHLnq (ORCPT ); Fri, 8 Jan 2016 06:43:46 -0500 Date: Fri, 8 Jan 2016 11:43:25 +0000 From: Mark Rutland To: Ard Biesheuvel Cc: "linux-arm-kernel@lists.infradead.org" , kernel-hardening@lists.openwall.com, Will Deacon , Catalin Marinas , Leif Lindholm , Kees Cook , "linux-kernel@vger.kernel.org" , Stuart Yoder , Sharma Bhupesh , Arnd Bergmann , Marc Zyngier , Christoffer Dall Subject: Re: [PATCH v2 11/13] arm64: allow kernel Image to be loaded anywhere in physical memory Message-ID: <20160108114324.GB3097@leverpostej> References: <1451489172-17420-1-git-send-email-ard.biesheuvel@linaro.org> <1451489172-17420-12-git-send-email-ard.biesheuvel@linaro.org> <20160108112622.GA3097@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 08, 2016 at 12:34:18PM +0100, Ard Biesheuvel wrote: > On 8 January 2016 at 12:26, Mark Rutland wrote: > > We might also want to consider if we need to determine whether or not > > the bootloader actually provided entropy, (and if we need a more general > > handshake between the bootlaoder and kernel to determine that kind of > > thing). > > Yes, that is interesting. We should also think about how to handle > 'nokaslr' if it appears on the command line, since in the !EFI case, > we will be way too late to parse this, and a capable kernel will > already be running from a randomized offset. That means it is the > bootloader's responsibility to ensure that the presence of 'nokaslr' > and the entropy in x1 are consistent with each other. Argh, I hadn't considered that. :( In the absence of a pre-kernel environment, the best thing we can do is probably to print a giant warning if 'nokaslr' is present but there was entropy (where that's determined based on some handshake/magic/flag). > >> Any memory described to the kernel (even that below the start of the > >> image) which is not marked as reserved from the kernel (e.g., with a > >> diff --git a/arch/arm64/include/asm/boot.h b/arch/arm64/include/asm/boot.h > >> index 81151b67b26b..984cb0fa61ce 100644 > >> --- a/arch/arm64/include/asm/boot.h > >> +++ b/arch/arm64/include/asm/boot.h > >> @@ -11,4 +11,9 @@ > >> #define MIN_FDT_ALIGN 8 > >> #define MAX_FDT_SIZE SZ_2M > >> > >> +/* > >> + * arm64 requires the kernel image to be 2 MB aligned > > > > Nit: The image is TEXT_OFFSET from that 2M-aligned base. > > s/image/mapping/? > > > > [...] > > > > Yep. I hate TEXT_OFFSET, did I mention that? I would also love to remove it, but I believe it's simply too late. :( Thanks, Mark.