From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3BFB9414A3B for ; Tue, 7 Jul 2026 13:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783430431; cv=none; b=au2Av58IWP/xS6Km9fsquE05tmk9AzT7hCKroBfsUe2b1hPXFgwzR4B2ht9U2iZdgp5Ea4pxYEQ9tyuChOtN45Pqe9AXkl7vlt+hWEgNgM3ssJFUnO7zhjmN8C72EC6iweTQPcuqA88/B2p3/2QmC0T11jMZaOg8FfAAt1AgiXY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783430431; c=relaxed/simple; bh=eNc3QGz/9muTrwbh/lHFsJSe3VCC/lDCC48jNN7Tw1U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hfYWxf0MGl2z6agGLEXDSF8TXCYtYxhIC7SPY7b201KFZzbf49mBbuMRJdSqUIyHm3vGyolfKqOIumoiiEKQTPghbrNY5bQ2aRQkO/SQkf/EKqrLyejS93SuhSJEuRDoiUSINAAfPWYv3g31xVejaKTEGfZoTC10F/6F5OAKuI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WcsyS1rN; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WcsyS1rN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 289511F000E9; Tue, 7 Jul 2026 13:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783430429; bh=ThonobVbutjdpxgi4zCNaSyVPNB4espWFRa4yco1WyI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=WcsyS1rNE6zpcJVBcO6MxkNMQ+nR+95qJS5iXV1kQ5CxwF2mZYtdDYpZTej7gCmS9 4qI533fxLYj4yayOmzWhL2+jhmX+KXpWvHuB1qF3Hnd8pM4Kh1/S6+JU/JzEsYq4j2 ptzrWG7Mkr9iVH/adrDExEHfHN6+/itICaG2k9BIHYfd/m2/zYEt4H84kX9Jw1tDHc cpYnwRUMn1wFSAlKAefI9Z+htPe5TaMjG763Xuacmc84aH2TwLV5NqC49Nt+Yq+C7B uF2/D3NeP2p4B7kSKotFUyELmyRYpDmb6sba+EYTl2L6jZ/J78cLQYnYcm20RYtxdb UvBxkn0uXde9g== Date: Tue, 7 Jul 2026 14:20:19 +0100 From: Lorenzo Stoakes To: Xie Yuanbin Cc: linux@armlinux.org.uk, akpm@linux-foundation.org, david@kernel.org, liam@infradead.org, liaohua4@huawei.com, lilinjie8@huawei.com, linusw@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.com, rppt@kernel.org, sunnanyong@huawei.com, surenb@google.com, vbabka@kernel.org, xiqi2@huawei.com Subject: Re: [PATCH v3 1/2] ARM: mm: fix use-after-free in __do_user_fault() under CONFIG_DEBUG_USER Message-ID: References: <20260707131409.79043-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: <20260707131409.79043-1-xieyuanbin1@huawei.com> On Tue, Jul 07, 2026 at 09:14:09PM +0800, Xie Yuanbin wrote: > On Tue, 7 Jul 2026 12:57:45 +0100, Russell King wrote: > > No. This information is useful debug for kernel oops. > > For kernel oops, I think it should be `!user_mode(regs)`, Qi Xi's reply: > > On Tue, 7 Jul 2026 19:48:12 +0800, Qi Xi wrote: > > For do_DataAbort() fallback: > > > > if (user_mode(regs)) { > > if (addr < TASK_SIZE) { > > mmap_read_lock(current->mm); > > show_pte(KERN_ALERT, current->mm, addr); > > mmap_read_unlock(current->mm); > > } > > } else { > > show_pte(KERN_ALERT, current->mm, addr); > > } > > changes nothing to kernel oops. It only skip show_pte() for user-mode > faults, and the fault addr is a kernel address, which means a user > program is trying to access a kernel address. > I think it is reasonable to skip show_pte() in this case? Well the whole reason you're faulting here might be because a userland process did that right? The page tables should tell you (presumably on ARM32 :) And I hate to repeat myself, maybe you didn't read the whole thread but... just use mmap_write_lock(), this isn't necessary? What is this trying to achieve? You're not in a hotpath, why are you bothering to conditionally take/not take the lock? Thanks, Lorenzo