Skip to content

Commit

Permalink
stackinit: Keep selftest union size small on m68k
Browse files Browse the repository at this point in the history
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: e71a29d ("stackinit: Add union initialization to selftests")
Link: https://lore.kernel.org/r/20250204174509.work.711-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
  • Loading branch information
Kees Cook committed Feb 6, 2025
1 parent dce4aab commit bb54088
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/stackinit_kunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 /**/
Expand Down Expand Up @@ -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;
};

Expand Down

0 comments on commit bb54088

Please sign in to comment.