* [PATCH][next] gcc-plugins: randstruct: Update code comment in relayout_struct()
@ 2023-11-25 21:49 Gustavo A. R. Silva
2023-11-28 0:34 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2023-11-25 21:49 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-hardening, linux-kernel, Gustavo A. R. Silva
Update code comment to clarify that the only element whose layout is
not randomized is a proper C99 flexible-array member. This update is
complementary to commit 1ee60356c2dc ("gcc-plugins: randstruct: Only
warn about true flexible arrays")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
scripts/gcc-plugins/randomize_layout_plugin.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c
index 910bd21d08f4..746ff2d272f2 100644
--- a/scripts/gcc-plugins/randomize_layout_plugin.c
+++ b/scripts/gcc-plugins/randomize_layout_plugin.c
@@ -339,8 +339,7 @@ static int relayout_struct(tree type)
/*
* enforce that we don't randomize the layout of the last
- * element of a struct if it's a 0 or 1-length array
- * or a proper flexible array
+ * element of a struct if it's a proper flexible array
*/
if (is_flexible_array(newtree[num_fields - 1])) {
has_flexarray = true;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] gcc-plugins: randstruct: Update code comment in relayout_struct()
2023-11-25 21:49 [PATCH][next] gcc-plugins: randstruct: Update code comment in relayout_struct() Gustavo A. R. Silva
@ 2023-11-28 0:34 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2023-11-28 0:34 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: Kees Cook, linux-hardening, linux-kernel
On Sat, 25 Nov 2023 15:49:12 -0600, Gustavo A. R. Silva wrote:
> Update code comment to clarify that the only element whose layout is
> not randomized is a proper C99 flexible-array member. This update is
> complementary to commit 1ee60356c2dc ("gcc-plugins: randstruct: Only
> warn about true flexible arrays")
>
>
Applied to for-linus/hardening, thanks!
[1/1] gcc-plugins: randstruct: Update code comment in relayout_struct()
https://git.kernel.org/kees/c/d71f22365a9c
Take care,
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-28 0:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-25 21:49 [PATCH][next] gcc-plugins: randstruct: Update code comment in relayout_struct() Gustavo A. R. Silva
2023-11-28 0:34 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox