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] [day] [month] [year] [list]
Message-ID: <20251114105359.58512d84@gandalf.local.home>
Date: Fri, 14 Nov 2025 10:53:59 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: David Laight <david.laight.linux@...il.com>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>, Josh Poimboeuf
 <jpoimboe@...nel.org>, Kees Cook <kees@...nel.org>, "Gustavo A. R. Silva"
 <gustavoars@...nel.org>, linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH] unwind deferred: Annotate struct unwind_cache with
 __counted_by

On Fri, 14 Nov 2025 10:49:52 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Fri, 14 Nov 2025 09:56:44 -0500
> Steven Rostedt <rostedt@...dmis.org> wrote:
> 
> > >     
> > > >  	unsigned int		nr_entries;
> > > > -	unsigned long		entries[];
> > > > +	unsigned long		entries[]; /* Fixed size, not bound by nr_entries */
> > > >  };      
> > > 
> > > Perhaps it should be:
> > > 	unsigned long entries[ /* MAX_UNWIND_ENTRIES */ ];    
> > 
> > Whatever would keep the coccinelle folks from sending more patches.  
> 
> Thorsten,
> 
> Which comment would you feel is more obvious that entries is not bound by
> nr_entries and prevent this patch from being sent again?
> 

Or we can simply move the macro to the header:

diff --git a/include/linux/unwind_deferred_types.h b/include/linux/unwind_deferred_types.h
index 18fa3932f61c..0e43556b9710 100644
--- a/include/linux/unwind_deferred_types.h
+++ b/include/linux/unwind_deferred_types.h
@@ -5,10 +5,14 @@
 #include <linux/types.h>
 #include <linux/atomic.h>
 
+/* Make the cache fit in a 4K page */
+#define UNWIND_MAX_ENTRIES					\
+	((SZ_4K - sizeof(struct unwind_cache)) / sizeof(long))
+
 struct unwind_cache {
 	unsigned long		unwind_completed;
 	unsigned int		nr_entries;
-	unsigned long		entries[];
+	unsigned long		entries[ /* UNWIND_MAX_ENTRIES */ ];
 };
 
 /*
diff --git a/kernel/unwind/deferred.c b/kernel/unwind/deferred.c
index a88fb481c4a3..6ea7cb5f336d 100644
--- a/kernel/unwind/deferred.c
+++ b/kernel/unwind/deferred.c
@@ -37,10 +37,6 @@ static inline bool try_assign_cnt(struct unwind_task_info *info, u32 cnt)
 }
 #endif
 
-/* Make the cache fit in a 4K page */
-#define UNWIND_MAX_ENTRIES					\
-	((SZ_4K - sizeof(struct unwind_cache)) / sizeof(long))
-
 /* Guards adding to or removing from the list of callbacks */
 static DEFINE_MUTEX(callback_mutex);
 static LIST_HEAD(callbacks);


-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ