Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752734AbbGMTvh (ORCPT ); Mon, 13 Jul 2015 15:51:37 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:54372 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752561AbbGMTvd (ORCPT ); Mon, 13 Jul 2015 15:51:33 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Mon, 13 Jul 2015 21:48:40 +0200 From: Stefan Agner To: Russell King - ARM Linux Cc: Rob Herring , Laura Abbott , Kees Cook , Arnd Bergmann , Ard Biesheuvel , linux-kernel@vger.kernel.org, Mark Salter , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3] ARM: early fixmap support for earlycon In-Reply-To: <20150710112522.GR7557@n2100.arm.linux.org.uk> References: <1433593888-7142-1-git-send-email-stefan@agner.ch> <20150606124800.GR7557@n2100.arm.linux.org.uk> <20150710112522.GR7557@n2100.arm.linux.org.uk> Message-ID: <2f1c4850e9e67e4f9fb8617e7352e796@agner.ch> User-Agent: Roundcube Webmail/1.1.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1745 Lines: 40 On 2015-07-10 13:25, Russell King - ARM Linux wrote: > On Sat, Jun 06, 2015 at 01:48:00PM +0100, Russell King - ARM Linux wrote: >> On Sat, Jun 06, 2015 at 02:31:28PM +0200, Stefan Agner wrote: >> > @@ -1231,7 +1272,7 @@ static void __init devicemaps_init(const struct machine_desc *mdesc) >> > >> > early_trap_init(vectors); >> > >> > - for (addr = VMALLOC_START; addr; addr += PMD_SIZE) >> > + for (addr = VMALLOC_START; addr < FIXADDR_START; addr += PMD_SIZE) >> > pmd_clear(pmd_off_k(addr)); >> >> You introduce a bug here - we no logner clear the very top entry of the >> page tables, which means it could contain anything - and means that the >> subsequent creation of the L2 table in early_pte_alloc() can fail. > > You trimmed my reply hard, and seemingly ignored this; the v4 patch > contains exactly the same code here, and therefore continues to leave > the top of the page table uninitialised. Maybe I get something wrong here, but the very top PMD is left out on purpose, since early_fixmap_shutdown takes care of that. However v3 also did not clear the second to top PMD. I thought I did take care of that by using this slightly different for loop in v4: for (addr = VMALLOC_START; addr < (FIXADDR_TOP & PMD_MASK); addr += PMD_SIZE) However, looking now at the code I'm not sure if this is right either. I think what is needed is addr < (FIXADDR_TOP & ~PMD_MASK). This will make sure that only the top PMD is not cleared, which is taken care of by early fixmap... -- Stefan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/