[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202507170026.0850E08ED@keescook>
Date: Thu, 17 Jul 2025 00:34:52 -0700
From: Kees Cook <kees@...nel.org>
To: Tiffany Yang <ynaffit@...gle.com>
Cc: Nathan Lynch <nathanl@...ux.ibm.com>,
"Steven Rostedt (Google)" <rostedt@...dmis.org>,
linux-kernel@...r.kernel.org, kernel-team@...roid.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arve Hjønnevåg <arve@...roid.com>,
Todd Kjos <tkjos@...roid.com>, Martijn Coenen <maco@...roid.com>,
Joel Fernandes <joelagnelf@...dia.com>,
Christian Brauner <brauner@...nel.org>,
Carlos Llamas <cmllamas@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Brendan Higgins <brendan.higgins@...ux.dev>,
David Gow <davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com
Subject: Re: [PATCH v4 6/6] binder: encapsulate individual alloc test cases
On Wed, Jul 16, 2025 at 11:32:10PM -0700, Kees Cook wrote:
> This really screams for a struct-based way to in-place declare a
> seq_buf. The current macro only works on the stack. I think this
> will work; I'll send a patch once I get it tested:
>
> #define DECLARE_SEQ_BUF(NAME, SIZE) \
> char NAME##_buffer[size]; \
> struct seq_buf NAME = { \
> .buffer = &NAME##_buffer, \
> .size = SIZE, \
> }
Oh, no, that wouldn't work in a struct -- there is a static initializer
there. And my memory is short: this would have been a revert of commit
7a8e9cdf9405 ("seq_buf: Make DECLARE_SEQ_BUF() usable").
I don't think it's possible to construct a seq_buf in a struct without a
runtime initialization. And that's true for anything that needs to
actually set a value (size) for the data type to be usable. Hmpf.
--
Kees Cook
Powered by blists - more mailing lists