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] [day] [month] [year] [list]
Message-ID: <202505301151.6CEDBBF8@keescook>
Date: Fri, 30 May 2025 11:52:45 -0700
From: Kees Cook <kees@...nel.org>
To: Alexander Lobakin <aleksander.lobakin@...el.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
	linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3][next] overflow: Fix direct struct member
 initialization in _DEFINE_FLEX()

On Fri, May 30, 2025 at 11:06:01AM -0700, Kees Cook wrote:
> #define __DEFINE_FLEX(type, name, member, count, trailer...)		\
>         _Static_assert(__builtin_constant_p(count),			\
>                        "onstack flex array members require compile-time const count"); \
>         union {								\
>                 u8 bytes[struct_size_t(type, member, count)];		\
>                 type obj;						\
>         } name##_u trailer;						\
>         type *name = (type *)&name##_u
> 
> #define _DEFINE_FLEX(type, name, member, count, initializer...)		\
> 	__DEFINE_FLEX(type, name, member, count, = { .obj = initializer })
> [...]
> Does that look like what you'd want? (Note I didn't actually build this;
> I want to make sure the concept is workable...)

FWIW, this is working as expected: https://godbolt.org/z/P7Go8Tr33

I'll send a proper patch...

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ