|
Message-ID: <20160113111152.GB23370@leverpostej> Date: Wed, 13 Jan 2016 11:11:53 +0000 From: Mark Rutland <mark.rutland@....com> To: Ard Biesheuvel <ard.biesheuvel@...aro.org> Cc: "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, kernel-hardening@...ts.openwall.com, Will Deacon <will.deacon@....com>, Catalin Marinas <catalin.marinas@....com>, Leif Lindholm <leif.lindholm@...aro.org>, Kees Cook <keescook@...omium.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Stuart Yoder <stuart.yoder@...escale.com>, Sharma Bhupesh <bhupesh.sharma@...escale.com>, Arnd Bergmann <arnd@...db.de>, Marc Zyngier <marc.zyngier@....com>, Christoffer Dall <christoffer.dall@...aro.org> Subject: Re: [PATCH v3 07/21] arm64: move kernel image to base of vmalloc area On Wed, Jan 13, 2016 at 10:58:55AM +0100, Ard Biesheuvel wrote: > On 13 January 2016 at 09:39, Ard Biesheuvel <ard.biesheuvel@...aro.org> wrote: > > On 12 January 2016 at 19:14, Mark Rutland <mark.rutland@....com> wrote: > >> On Mon, Jan 11, 2016 at 02:19:00PM +0100, Ard Biesheuvel wrote: > >>> @@ -438,12 +442,29 @@ static void __init map_kernel(pgd_t *pgd) > >>> map_kernel_chunk(pgd, __init_begin, __init_end, PAGE_KERNEL_EXEC); > >>> map_kernel_chunk(pgd, _data, _end, PAGE_KERNEL); > >>> > >>> - /* > >>> - * The fixmap falls in a separate pgd to the kernel, and doesn't live > >>> - * in the carveout for the swapper_pg_dir. We can simply re-use the > >>> - * existing dir for the fixmap. > >>> - */ > >>> - set_pgd(pgd_offset_raw(pgd, FIXADDR_START), *pgd_offset_k(FIXADDR_START)); > >>> + if (pgd_index(FIXADDR_START) != pgd_index((u64)_end)) { > >> > >> To match the style of early_fixmap_init, and given we already mapped the > >> kernel image, this could be: > >> > >> if (pgd_none(pgd_offset_raw(pgd, FIXADDR_START))) { > >> > >> Which also serves as a run-time check that the pgd entry really was > >> clear. > >> > > > > Yes, that looks better. I will steal that :-) > > > > OK, that doesn't work. pgd_none() is hardcoded to 'false' when running > with fewer than 4 pgtable levels, and so we always hit the BUG() here. Ah, sorry. We could also check CONFIG_PGTABLE_LEVELS > 3 check, as with fixmap_init, perhaps? Thanks, Mark.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.