lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251220215608.434614-5-david.laight.linux@gmail.com>
Date: Sat, 20 Dec 2025 21:56:07 +0000
From: david.laight.linux@...il.com
To: Thomas Gleixner <tglx@...utronix.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Kees Cook <kees@...nel.org>,
	linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org,
	Al Viro <viro@...iv.linux.org.uk>
Cc: David Laight <david.laight.linux@...il.com>
Subject: [PATCH 4/5] uaccess: Disable -Wshadow in __scoped_user_access()

From: David Laight <david.laight.linux@...il.com>

-Wshadow is enabled by W=2 builds and __scoped_user_access() quite
deliberately creates a 'const' shadow of the 'user' address that
references a 'guard page' when the application passes a kernel pointer.

Signed-off-by: David Laight <david.laight.linux@...il.com>
---
 include/linux/uaccess.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 589cb2ef2e7b..e2ff4146c5d0 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -754,7 +754,9 @@ USER_ACCESS_GUARD(rw, void)
 	with (typeof(uptr) _tmpptr = __scoped_user_access_begin(mode, uptr, size, elbl)) \
 		and_with (CLASS(user_##mode##_access, scope)(_tmpptr))			\
 		/* Force modified pointer usage within the scope */			\
-		and_with (const typeof(uptr) uptr = _tmpptr)
+		__diag_push() __diag_ignore_all("-Wshadow", "uptr is readonly copy")	\
+		and_with (const typeof(uptr) uptr = _tmpptr)				\
+		__diag_pop()
 
 /**
  * scoped_user_read_access_size - Start a scoped user read access with given size
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ