[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251114095734.42b51e6c@gandalf.local.home>
Date: Fri, 14 Nov 2025 09:57:34 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: 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 08:53:32 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> --- a/include/linux/unwind_deferred_types.h
> +++ b/include/linux/unwind_deferred_types.h
> @@ -2,10 +2,14 @@
> #ifndef _LINUX_UNWIND_USER_DEFERRED_TYPES_H
> #define _LINUX_UNWIND_USER_DEFERRED_TYPES_H
>
> +/* Make the cache fit in a 4K page */
> +#define UNWIND_MAX_ENTRIES \
> + ((SZ_4K - offset_of(struct unwind_cache, entries)) / sizeof(long))
> +
> struct unwind_cache {
> unsigned long unwind_completed;
> unsigned int nr_entries;
> - unsigned long entries[];
> + unsigned long entries[UNWIND_MAX_ENTRIES];
> };
>
Nope, this fails with:
/work/git/test-linux.git/include/linux/stddef.h:16:33: error: invalid use of undefined type ‘struct unwind_cache’
16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
| ^~~~~~~~~~~~~~~~~~
/work/git/test-linux.git/include/linux/unwind_deferred_types.h:9:19: note: in expansion of macro ‘offsetof’
9 | ((SZ_4K - offsetof(struct unwind_cache, entries)) / sizeof(long))
| ^~~~~~~~
/work/git/test-linux.git/include/linux/unwind_deferred_types.h:14:41: note: in expansion of macro ‘UNWIND_MAX_ENTRIES’
14 | unsigned long entries[UNWIND_MAX_ENTRIES];
| ^~~~~~~~~~~~~~~~~~
-- Steve
Powered by blists - more mailing lists