From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59069C32792 for ; Thu, 3 Oct 2019 15:40:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 20E882133F for ; Thu, 3 Oct 2019 15:40:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cV+1SG+s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20E882133F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xqJSr1iV2VNRLbJxh43pJHWt8VUBhdm+A3BZ6iqTfkA=; b=cV+1SG+s1d6e3a 1+PGzYfEBAvrblClbfXq0lFD4/tRl78AifVRkc+ZljgAI97MjbSl9Nx9QKJBd6Gxug5U2Jgx4IW2H u7DLaEq7EjRQHchTASXzfJ+QsZH60UDBCDA/hGugyO2Uf83xAi7Yg4JGFiBg5gHadHd9jaWNGtOY7 5fvUaB+AmLi2oPLW7NynMttYSC0Gzz992Zg2CID14HRtPLOudz+yBa/udYSf+v2arClx78YekZPJK Bbpw5tMQY/I0CkYEAJl76D0yQp7NEfwh9Aas6CQHuOVfGRfRsU2D6HxeU7jDIjq1vZVDMkBK/bym5 7bwdZeAU1mJs1wfNB4kQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iG3D9-0008SU-Gu; Thu, 03 Oct 2019 15:40:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iG3D6-0007y1-CX for linux-arm-kernel@lists.infradead.org; Thu, 03 Oct 2019 15:40:09 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D525337; Thu, 3 Oct 2019 08:40:05 -0700 (PDT) Received: from arrakis.emea.arm.com (unknown [10.1.196.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 758053F534; Thu, 3 Oct 2019 08:40:04 -0700 (PDT) Date: Thu, 3 Oct 2019 16:40:02 +0100 From: Catalin Marinas To: Mark Rutland Subject: Re: [PATCH] arm64: mm: avoid virt_to_phys(init_mm.pgd) Message-ID: <20191003154002.GH21629@arrakis.emea.arm.com> References: <20191003094932.10216-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191003094932.10216-1-mark.rutland@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191003_084008_477025_8A517E3F X-CRM114-Status: GOOD ( 17.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , James Morse , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 03, 2019 at 10:49:32AM +0100, Mark Rutland wrote: > If we take an unhandled fault in the kernel, we call show_pte() to dump > the {PGDP,PGD,PUD,PMD,PTE} values for the corresponding page table walk, > where the PGDP value is virt_to_phys(mm->pgd). > > The boot-time and runtime kernel page tables, init_pg_dir and > swapper_pg_dir respectively, are kernel symbols. Thus, it is not valid > to call virt_to_phys() on either of these, though we'll do so if we take > a fault on a TTBR1 address. > > When CONFIG_DEBUG_VIRTUAL is not selected, virt_to_phys() will silently > fix this up. However, when CONFIG_DEBUG_VIRTUAL is selected, this > results in splats as below. Depending on when these occur, they can > happen to suppress information needed to debug the original unhandled > fault, such as the backtrace: > > | Unable to handle kernel paging request at virtual address ffff7fffec73cf0f > | Mem abort info: > | ESR = 0x96000004 > | EC = 0x25: DABT (current EL), IL = 32 bits > | SET = 0, FnV = 0 > | EA = 0, S1PTW = 0 > | Data abort info: > | ISV = 0, ISS = 0x00000004 > | CM = 0, WnR = 0 > | ------------[ cut here ]------------ > | virt_to_phys used for non-linear address: 00000000102c9dbe (swapper_pg_dir+0x0/0x1000) > | WARNING: CPU: 1 PID: 7558 at arch/arm64/mm/physaddr.c:15 __virt_to_phys+0xe0/0x170 arch/arm64/mm/physaddr.c:12 > | Kernel panic - not syncing: panic_on_warn set ... > | SMP: stopping secondary CPUs > | Dumping ftrace buffer: > | (ftrace buffer empty) > | Kernel Offset: disabled > | CPU features: 0x0002,23000438 > | Memory Limit: none > | Rebooting in 1 seconds.. > > We can avoid this by ensuring that we call __pa_symbol() for > init_mm.pgd, as this will always be a kernel symbol. As the dumped > {PGD,PUD,PMD,PTE} values are the raw values from the relevant entries we > don't need to handle these specially. > > Signed-off-by: Mark Rutland > Cc: Catalin Marinas > Cc: James Morse > Cc: Will Deacon Acked-by: Catalin Marinas _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel