Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8901541ybi; Thu, 6 Jun 2019 23:19:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxT1DIoUNOIELvn4OZBQW+jlFpPyJ2vUjT5Gj0leNMoEYpvLEl2RsYhfKq51arUDTSitQlc X-Received: by 2002:a17:90a:8c87:: with SMTP id b7mr1465438pjo.139.1559888351677; Thu, 06 Jun 2019 23:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559888351; cv=none; d=google.com; s=arc-20160816; b=Vs8E5wxiTkAT4+klK/QStcwVBaZRRRmtq+IHHY20XzntO5AiWY6FGYOs4b+ueob21e ssgXfNjutrwe7ktQtIEC1KdaxH9KNbhnKS3fCPcnnlQeaDYk6crKFYLx8WHCpyUz8Dnk n4ahCZ2ZWKxDi1qaYdxJ1ERwWQRjwaBO3uF4MutG/a8U0iBv8Y1UYM384YmikefDiyqd SWca+eXNt2ZIFhzGzH1u/GWKlJm+KA6CQsYy8Rxg/CE6vK0QZq4d2rVUCEhOXOKGBlDj cAM9Fv6JCP/gpaXe+7ysAGI1kXYv4gyKyHUNW2Md7LCzvsK5xn8AQVIcgbq1IZpQuXsx 9h/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=RZEyhVJci2O3YmynUPS3B0YvCUIErQDKFmVmynlEGRs=; b=F0hur070UcJtHcSmIdhCNUc+D8XZJwMshN8jX7BbHau9K9EWulJ1YLmx4kVOT30rKc ohBnzvLMWywthIPnTaU2Fste40GJADXtWrpJDOiIVjIRwHRAnPp0tMKdwtnFhQLQpX06 oZyC17O7G+aIOsFZktUOa8jckQtx/p8dAjIINL9MbfHa9+UqA4sJRe+fKL+sKth6okj3 KttPxZ7yNKidyCRGNvHaTP/GQ/5DGjhGUT9/oa8KsYjcQxstmTHLFxpM80IXZJyHfCWG Ds89pQEIodxX8bx5vD8gIZfn2LUGkdT+2bdpsFPkK0zQdigxLEGZXjdpr559M7BE+T7k Wasw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si1027158pls.109.2019.06.06.23.18.55; Thu, 06 Jun 2019 23:19:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727182AbfFGGQN (ORCPT + 99 others); Fri, 7 Jun 2019 02:16:13 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:32777 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfFGGQN (ORCPT ); Fri, 7 Jun 2019 02:16:13 -0400 Received: by mail-ot1-f66.google.com with SMTP id p4so870375oti.0 for ; Thu, 06 Jun 2019 23:16:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RZEyhVJci2O3YmynUPS3B0YvCUIErQDKFmVmynlEGRs=; b=sDqbmQgEqeDWkHZ0LwY8RhMsA08uRGTiTUkdscz3PG3Y3Pv1F6IMuGFyG7mbUGpFE1 0HfPzKLA57XRZ/Y3c6axcUoIy2LtC7Vzo6NkfxU16JQYWDVcxhtRqfMKkT1Ds4zBfolZ Yhs+tGQ5GtdbuBtSA6rdq8+TZkN71q7XNX1FqvdlGMI2TklOxw9Ke0cLUWyGrE9x21wF +YLnTlvwHX//csBvOYYSc0smGt+CaZfxHiuT91wiLKjSx9lHmAKGHsImi8uJn2IYUeYJ aV67W3tEl6iPcRV+YBaHNz6wROPcwD7mML+1SPmkSndppDNRbm33/e7mkDbPaHmsQ59s etTQ== X-Gm-Message-State: APjAAAVNLxTCcimqbhVnXiiyJJTGW4Y2oFxl2S0+OaFXPtLGw6nyK/Ko xdqsf8d5a0Xo80FvM3hQuHgMhwiBA4CmXsfPdy0Y8Mtg X-Received: by 2002:a9d:4109:: with SMTP id o9mr17588768ote.353.1559888172957; Thu, 06 Jun 2019 23:16:12 -0700 (PDT) MIME-Version: 1.0 References: <90d30adb0943a11ab127808c03229ba657478df4.1559566521.git.christophe.leroy@c-s.fr> In-Reply-To: From: Mathieu Malaterre Date: Fri, 7 Jun 2019 08:16:01 +0200 Message-ID: Subject: Re: [PATCH] powerpc/32s: fix booting with CONFIG_PPC_EARLY_DEBUG_BOOTX To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , LKML , linuxppc-dev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 5, 2019 at 1:32 PM Mathieu Malaterre wrote: > > On Mon, Jun 3, 2019 at 3:00 PM Christophe Leroy wrote: > > > > When booting through OF, setup_disp_bat() does nothing because > > disp_BAT are not set. By change, it used to work because BOOTX > > buffer is mapped 1:1 at address 0x81000000 by the bootloader, and > > btext_setup_display() sets virt addr same as phys addr. > > > > But since commit 215b823707ce ("powerpc/32s: set up an early static > > hash table for KASAN."), a temporary page table overrides the > > bootloader mapping. > > > > This 0x81000000 is also problematic with the newly implemented > > Kernel Userspace Access Protection (KUAP) because it is within user > > address space. > > > > This patch fixes those issues by properly setting disp_BAT through > > a call to btext_prepare_BAT(), allowing setup_disp_bat() to > > properly setup BAT3 for early bootx screen buffer access. > > > > Reported-by: Mathieu Malaterre > > Fixes: 215b823707ce ("powerpc/32s: set up an early static hash table for KASAN.") > > Signed-off-by: Christophe Leroy > > The patch below does fix the symptoms I reported. Tested with CONFIG_KASAN=n : > > Tested-by: Mathieu Malaterre Link: https://bugzilla.kernel.org/show_bug.cgi?id=203699 > > Thanks ! > > > --- > > arch/powerpc/include/asm/btext.h | 4 ++++ > > arch/powerpc/kernel/prom_init.c | 1 + > > arch/powerpc/kernel/prom_init_check.sh | 2 +- > > 3 files changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/arch/powerpc/include/asm/btext.h b/arch/powerpc/include/asm/btext.h > > index 3ffad030393c..461b0f193864 100644 > > --- a/arch/powerpc/include/asm/btext.h > > +++ b/arch/powerpc/include/asm/btext.h > > @@ -13,7 +13,11 @@ extern void btext_update_display(unsigned long phys, int width, int height, > > int depth, int pitch); > > extern void btext_setup_display(int width, int height, int depth, int pitch, > > unsigned long address); > > +#ifdef CONFIG_PPC32 > > extern void btext_prepare_BAT(void); > > +#else > > +static inline void btext_prepare_BAT(void) { } > > +#endif > > extern void btext_map(void); > > extern void btext_unmap(void); > > > > diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c > > index 3555cad7bdde..ed446b7ea164 100644 > > --- a/arch/powerpc/kernel/prom_init.c > > +++ b/arch/powerpc/kernel/prom_init.c > > @@ -2336,6 +2336,7 @@ static void __init prom_check_displays(void) > > prom_printf("W=%d H=%d LB=%d addr=0x%x\n", > > width, height, pitch, addr); > > btext_setup_display(width, height, 8, pitch, addr); > > + btext_prepare_BAT(); > > } > > #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */ > > } > > diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh > > index 518d416971c1..160bef0d553d 100644 > > --- a/arch/powerpc/kernel/prom_init_check.sh > > +++ b/arch/powerpc/kernel/prom_init_check.sh > > @@ -24,7 +24,7 @@ fi > > WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush > > _end enter_prom $MEM_FUNCS reloc_offset __secondary_hold > > __secondary_hold_acknowledge __secondary_hold_spinloop __start > > -logo_linux_clut224 > > +logo_linux_clut224 btext_prepare_BAT > > reloc_got2 kernstart_addr memstart_addr linux_banner _stext > > __prom_init_toc_start __prom_init_toc_end btext_setup_display TOC." > > > > -- > > 2.13.3 > >