From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8D913CE0AE for ; Fri, 26 Jun 2026 12:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782477432; cv=none; b=ldoKjkG+abm+ohgtUj0hCvUPcahrBLNVJPCJqTdP/9dlim4ycKvcIzBWY5FxmCDhhx51XG1GtImXNxUPwqW+ZZjXS5bTvCcPMMCC4j3s0hM6UcV88lWs5wIcWojPN+ApvuBx7Z5qFz4KYtPd427Bl7MxjtC8ce0MnI/x1RRq3iI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782477432; c=relaxed/simple; bh=u//sBQP9dbq9YcuAYavkFt08C1QJncQNuDa246G2vMM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=riaIpR3u6AKh9/kNMLZKcxq0X0Rv5++Kal40qzcG5o+l41ErDnCS7JWqp7ay/SvwLTaZJi4OaxgR0GsK2ZfDIzIiG04+LErfHA6jgtisA9QXSABlP9QwWjW6Bp9l5lbhHwcd8WtG3abNTAFTutDlTpZGXKBs1LzroBykOO9NM0s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=AtCJJF3C; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="AtCJJF3C" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=q1NRetAvDj6Zysapf6Nj83QBBrbnYgH2f7DVXGRpPmQ=; b=AtCJJF3CcxC2+M7yQPBFpgOu9U prM/53Pc76uGqFwtrN7d1fQxaRRiDmqUu0hEOVQUC2+W/CjOXzvu8RLB1xDEZw7TwtkUSe9kMTIaF YsnDtVp5/r4HUQbN+o9vcM6m2OOfZzwb28D5ACBGuamFTiR+y/nSDG5s4BflKMfqxcE/dxPOMvc2Z R3e0TyFQBm19fEDRomlwngHvU0Iw1Ngd/MlEJgo4DUoQqj/Qg+1EqDI+A227TWxrh/pl2PfBGEgy1 NPlZuWVUtcEEFQUN84kMHmKa9trbN2eVDxX6DQt2mwv6CEXuVWp7PQOgWXMSrOQMGeZS+j318gaMo qwTNNvUA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:58358) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wd5nq-000000002EX-2RZt; Fri, 26 Jun 2026 13:37:02 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1wd5no-0000000032I-2G2O; Fri, 26 Jun 2026 13:37:00 +0100 Date: Fri, 26 Jun 2026 13:37:00 +0100 From: Russell King To: Xie Yuanbin Cc: xiqi2@huawei.com, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sunnanyong@huawei.com Subject: Re: [PATCH v3 2/2] ARM: mm: protect show_pte() in do_DataAbort() fallback path Message-ID: References: <20260626073048.3595106-3-xiqi2@huawei.com> <20260626101615.60920-1-xieyuanbin1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260626101615.60920-1-xieyuanbin1@huawei.com> Sender: "Russell King,,," On Fri, Jun 26, 2026 at 06:16:15PM +0800, Xie Yuanbin wrote: > On Fri, 26 Jun 2026 15:30:48 +0800, Qi Xi wrote: > > @@ -638,7 +638,10 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) > > pr_alert("8<--- cut here ---\n"); > > pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n", > > inf->name, fsr, addr); > > - show_pte(KERN_ALERT, current->mm, addr); > > + if (mmap_read_trylock(current->mm)) { > > + show_pte(KERN_ALERT, current->mm, addr); > > + mmap_read_unlock(current->mm); > > + } > > For kernel faults, `current->mm` maybe NULL, and > `mmap_read_trylock(current->mm)` may cause a panic. > Also, interrupts may be disabled here. > > I suggest that waiting for this patch to be merged first: > https://lore.kernel.org/20260625122612.43501-1-xieyuanbin1@huawei.com > which make sure that interrupts are enabled here. No, it doesn't ensure that. show_pte() is also called from die_kernel_fault() and __do_kernel_fault(), which can be from a path that has interrupts disabled. See the comments in do_kernel_address_page_fault(). We are not "fixing" show_pte(), which is a diagnostic function when things go wrong in the kernel, and is there to *try* to give us information to diagnose what happened. It is *not* a function that is used routinely in the kernel. The fact it is racy with other CPUs may be a problem, but it isn't a big problem because when it's called, the system is practically dead anyway. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!