Skip to contentSkip to conversation

stackinit: Keep selftest union size small on m68k

PATCH In review Kees Cook 2 participants 2 messages Feb 4, 2025 – Feb 6, 2025 Library code

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 stackinit: Keep selftest union size small on m68k

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.

---
 lib/stackinit_kunit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/stackinit_kunit.c +3 -1
index fbe910c9c825..967b345a98fd 100644
@@ -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;
 };
 
Signature · 1 line
2.34.1
Tested-by on v1 1/1
#1 lore raw

Hi Kees,

Quoted 8 lines · Kees Cook

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.

Thanks for your patch!

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

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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