Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796179999; b=S/tJ29v0nbaQDRgCFsR9wDkCTIo+KM/gMIi5CUrU3IEVbwqjS+ffRerjLVkQyufk44Dy 7G/6sGY+992YODoG9WN0VyMbkYqKN/yxrfpKWeFathG8RmezatQNBeI41CWuh7hgZ3QB1 zqAR0FEgvQe/wgWsCfpI+wzYH4o8vz00iv2DeRqXD1yh9RxrBKm5TaoOo4DXX5lCjCTPk CiOiAmSy0MT961a1BkFsIh8YkO6QiDJIxi+3dFEiHhmaNe9elRlo0mRbTXjJVrX0j0vmA oSin2Lf4thC4CwJo8Q7JAd4zOQEQp8jcNtc3MAOhPGzx8cRTlOsMKw7kBmkrHchyyJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796179999; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=T3RdDELmj3dHIv1GotMlOf9EDV5GFRy5zD5wuWQAj3w=; b=jTpGOOhksMjm1oXcoPIRdiyC7U2xP/IspNgZ9TDYGriDZ6pbQQ6SAlsj/BElTzvRgEPb CmkGwLS946+YYEBsI3b1olxgzGTElHvVuVS7FCsOAJR8mQFmjMQS9hcp4q/TJaPzVIlAW PwsMfMt1DrG/3DHGA1gYcwQPYKUSqidkaLgbgy8t3fGJBbzlX/wWXVP7UtOsK9hUiBQnh +mnNKPUHJI5vASaFJ6vgnuSDpFcAa6I3cl4w5+GhbWlLBfKB5tegqDRRIQOUlHKKHX1aB dMIyKyoSQ2OM9CUYblL/zpKZwlId+4MV4FAP6EwogixK0bX/mJYmXwa102fCPcVk6zQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="JA/2MOfn"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B939606A31A; Wed, 2 Dec 2026 02:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JA/2MOfn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56C081F000C1; Wed, 2 Dec 2026 02:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796179999; bh=T3RdDELmj3dHIv1GotMlOf9EDV5GFRy5zD5wuWQAj3w=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=JA/2MOfnOqdRy+1Xh0P7WsjCR+Q/Z49Hg7Tlg7YyehSgItZ9WKEwmZo/Sw/fVcQOr KzqbjyzLqL5bUwxtT+Ft4r0tjqVA10njRFci801mIjh0sRCeya2MJKGqdJ3k4IqMfu O/bsG/STxmdLrM1vB2mVpycyayKB+NKWI8lf8yjOyNPrx7iB8EoaLe7yWaYDn5kaUK kLhAFVXAarzmRiq+j/sA+QSvNUa6zuoKZkBbesOeNQK2VspMf4GRkrjz3vtb0/8XcH F9YA6bt+qzLNSM5GK4onS66x01ahdx6eSwQRSwRwdiCh4tWO3kYIe+KaIn3Re9zMf2 jOHWWuoju6HLQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 10/12] uaccess: Refuse and warn in access_ok() when current->mm is NULL Reply-To: sashiko-reviews@lists.linux.dev To: "James Houghton" , "Andrew Morton" , "Alexander Viro" , "Arnd Bergmann" Cc: "Sean Christopherson" , "Paolo Bonzini" , "Jim Mattson" , "Jens Axboe" , "David Hildenbrand" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , x86@kernel.org, "Catalin Marinas" , "Will Deacon" , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , "Madhavan Srinivasan" , "Chris Zankel" , "Max Filippov" , "Dinh Nguyen" , "Simon Schuster" , "David Sterba" , "Alexei Starovoitov" , "Daniel Borkmann" , "Andrii Nakryiko" , "Eduard Zingerman" , "Kumar Kartikeya Dwivedi" , "KP Singh" , "Matt Bobrowski" , "Peter Zijlstra" , "Arnaldo Carvalho de Melo" , "Namhyung Kim" , "Steven Rostedt" , "Masami Hiramatsu" , linux-mm@kvack.org, bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, dsterba@suse.cz In-Reply-To: <20261202023920.595207-11-jthoughton@google.com> References: <20261202023920.595207-1-jthoughton@google.com> <20261202023920.595207-11-jthoughton@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 02:53:16 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] perf: arm_brbe: false WARN and broken filtering in filter_branch_privilege() -- commit c51cfe7734b475135fde7076d5f8a8f55775551a Author: James Houghton uaccess: Refuse and warn in access_ok() when current->mm is NULL This commit adds uaccess_without_mm() and updates access_ok() (and x86's clear_user()) to warn and fail when current->mm is NULL. > diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/ua= ccess.h > index 9f5bd9c69c249..6ce7d0fe3bf9c 100644 > --- a/arch/arm64/include/asm/uaccess.h > +++ b/arch/arm64/include/asm/uaccess.h > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > =20 > #include > #include > @@ -37,6 +38,9 @@ static inline int __access_ok(const void __user *ptr, u= nsigned long size); > */ > static inline int access_ok(const void __user *addr, unsigned long size) > { > + if (uaccess_without_mm()) > + return 0; [Severity: Medium] Does this cause a false WARN_ON_ONCE(!current->mm) and break branch privilege filtering in arm_brbe's filter_branch_privilege() when a PMU interrupt fires while current->mm is NULL? From the PMU hardirq handler (armv8pmu_handle_irq() -> read_branch_records() -> brbe_read_filtered_entries() -> filter_branch_record()), filter_branch_privilege() uses access_ok() purely to classify branch record addresses without accessing user memory: drivers/perf/arm_brbe.c:filter_branch_privilege() { bool from_user =3D access_ok((void __user *)(unsigned long)entry->from, 4); bool to_user =3D access_ok((void __user *)(unsigned long)entry->to, 4); ... if (from_user =3D=3D to_user) return ((entry->priv =3D=3D PERF_BR_PRIV_KERNEL) && !exclude_kernel) || ((entry->priv =3D=3D PERF_BR_PRIV_USER) && (branch_sample_type & PERF_SAMPLE_BRANCH_USER)); ... if (exclude_kernel) { if (!from_user) entry->from =3D 0; if (!to_user) entry->to =3D 0; } } When a PMU overflow interrupt hits the idle task or a kernel thread during CPU-wide branch-stack profiling, current->mm is NULL. Both access_ok() calls warn and return 0, so from_user =3D=3D to_user evaluates to true even= for cross-EL branch records, skipping the address zeroing of excluded user or kernel addresses. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202023920.5952= 07-1-jthoughton@google.com?part=3D10