public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stackinit: Keep selftest union size small on m68k
@ 2025-02-04 17:45 Kees Cook
  2025-02-06  7:49 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2025-02-04 17:45 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Kees Cook, linux-kernel, linux-hardening

The stack frame on m68k is very sensitive to the size of what needs to
be stored. Like done for long string testing, reduce the size of the
large trailing struct in the union initialization testing.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/all/CAMuHMdXW8VbtOAixO7w+aDOG70aZtZ50j1Ybcr8B3eYnRUcrcA@mail.gmail.com
Fixes: e71a29db79da ("stackinit: Add union initialization to selftests")
Signed-off-by: Kees Cook <kees@kernel.org>
---
 lib/stackinit_kunit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/stackinit_kunit.c b/lib/stackinit_kunit.c
index fbe910c9c825..967b345a98fd 100644
--- a/lib/stackinit_kunit.c
+++ b/lib/stackinit_kunit.c
@@ -75,8 +75,10 @@ static bool stackinit_range_contains(char *haystack_start, size_t haystack_size,
  */
 #ifdef CONFIG_M68K
 #define FILL_SIZE_STRING		8
+#define FILL_SIZE_ARRAY			2
 #else
 #define FILL_SIZE_STRING		16
+#define FILL_SIZE_ARRAY			8
 #endif
 
 #define INIT_CLONE_SCALAR		/**/
@@ -345,7 +347,7 @@ union test_small_start {
 	short three;
 	unsigned long four;
 	struct big_struct {
-		unsigned long array[8];
+		unsigned long array[FILL_SIZE_ARRAY];
 	} big;
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] stackinit: Keep selftest union size small on m68k
  2025-02-04 17:45 [PATCH] stackinit: Keep selftest union size small on m68k Kees Cook
@ 2025-02-06  7:49 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2025-02-06  7:49 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-kernel, linux-hardening

Hi Kees,

On Tue, 4 Feb 2025 at 18:45, Kees Cook <kees@kernel.org> wrote:
> The stack frame on m68k is very sensitive to the size of what needs to
> be stored. Like done for long string testing, reduce the size of the
> large trailing struct in the union initialization testing.
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Closes: https://lore.kernel.org/all/CAMuHMdXW8VbtOAixO7w+aDOG70aZtZ50j1Ybcr8B3eYnRUcrcA@mail.gmail.com
> Fixes: e71a29db79da ("stackinit: Add union initialization to selftests")
> Signed-off-by: Kees Cook <kees@kernel.org>

Thanks for your patch!

# stackinit: pass:102 fail:0 skip:6 total:108

Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-06  7:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04 17:45 [PATCH] stackinit: Keep selftest union size small on m68k Kees Cook
2025-02-06  7:49 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox