tools/nolibc: add test for __stack_chk_guard initialization
authorThomas Weißschuh <linux@weissschuh.net>
Sun, 21 May 2023 09:36:32 +0000 (11:36 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 9 Jun 2023 18:46:08 +0000 (11:46 -0700)
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/nolibc/nolibc-test.c

index d5d4dea..861b9a7 100644 (file)
@@ -808,6 +808,14 @@ static int run_protection(int min, int max)
        return 0;
 #endif
 
+#if defined(NOLIBC_STACKPROTECTOR)
+       if (!__stack_chk_guard) {
+               llen += printf("__stack_chk_guard not initialized");
+               pad_spc(llen, 64, "[FAIL]\n");
+               return 1;
+       }
+#endif
+
        pid = -1;
        pid = fork();