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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251121193957.1655580-3-morbo@google.com>
Date: Fri, 21 Nov 2025 19:39:44 +0000
From: Bill Wendling <morbo@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: Bill Wendling <morbo@...gle.com>, Kees Cook <kees@...nel.org>, 
	"Gustavo A. R. Silva" <gustavoars@...nel.org>, Nathan Chancellor <nathan@...nel.org>, 
	Nick Desaulniers <nick.desaulniers+lkml@...il.com>, Justin Stitt <justinstitt@...gle.com>, 
	Miguel Ojeda <ojeda@...nel.org>, Peter Zijlstra <peterz@...radead.org>, 
	Andrew Morton <akpm@...ux-foundation.org>, Heiko Carstens <hca@...ux.ibm.com>, 
	Marc Herbert <Marc.Herbert@...ux.intel.com>, Uros Bizjak <ubizjak@...il.com>, 
	Tejun Heo <tj@...nel.org>, Jeff Xu <jeffxu@...omium.org>, 
	"Michal Koutný" <mkoutny@...e.com>, Shakeel Butt <shakeel.butt@...ux.dev>, 
	"Thomas Weißschuh" <thomas.weissschuh@...utronix.de>, John Stultz <jstultz@...gle.com>, 
	Christian Brauner <brauner@...nel.org>, Randy Dunlap <rdunlap@...radead.org>, 
	Brian Gerst <brgerst@...il.com>, Masahiro Yamada <masahiroy@...nel.org>, 
	Mike Rapoport <rppt@...nel.org>, linux-mm@...ck.org, linux-hardening@...r.kernel.org, 
	llvm@...ts.linux.dev
Subject: [PATCH 2/2] memblock: annotate struct memblock_type with __counted_by_ptr

Add the '__counted_by_ptr' attribute to the 'regions' field of 'struct
memblock_type'. The 'regions' field is an array of 'struct
memblock_region' and its size is tracked by the 'max' field, which
represents the total number of allocated regions.

This annotation allows the Kernel Address Sanitizer (KASAN) to detect
out-of-bounds accesses to the 'regions' array.

Cc: Kees Cook <kees@...nel.org>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@...il.com>
Cc: Justin Stitt <justinstitt@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Heiko Carstens <hca@...ux.ibm.com>
Cc: Marc Herbert <Marc.Herbert@...ux.intel.com>
Cc: Uros Bizjak <ubizjak@...il.com>
Cc: Tejun Heo <tj@...nel.org>
Cc: Jeff Xu <jeffxu@...omium.org>
Cc: "Michal Koutný" <mkoutny@...e.com>
Cc: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: "Thomas Weißschuh" <thomas.weissschuh@...utronix.de>
Cc: John Stultz <jstultz@...gle.com>
Cc: Christian Brauner <brauner@...nel.org>
Cc: Randy Dunlap <rdunlap@...radead.org>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>
Cc: Mike Rapoport <rppt@...nel.org>
Cc: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org
Cc: linux-hardening@...r.kernel.org
Cc: llvm@...ts.linux.dev
Signed-off-by: Bill Wendling <morbo@...gle.com>
---
 include/linux/memblock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 221118b5a16e..ba7f7c999a45 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -91,7 +91,7 @@ struct memblock_type {
 	unsigned long cnt;
 	unsigned long max;
 	phys_addr_t total_size;
-	struct memblock_region *regions;
+	struct memblock_region *regions __counted_by_ptr(max);
 	char *name;
 };
 
-- 
2.52.0.rc2.455.g230fcf2819-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ