diff options
author | Thomas Weißschuh <linux@weissschuh.net> | 2025-04-19 12:46:20 +0200 |
---|---|---|
committer | Thomas Weißschuh <linux@weissschuh.net> | 2025-04-19 14:17:56 +0200 |
commit | 9fca5554af70fd86fb1ed78362d86ebd1a4be2ef (patch) | |
tree | 38a6adc6c453dce3102a804c0140879b3cc5b1a5 | |
parent | f4152715dcd5c580dca6ea628ec03785bba44b9a (diff) |
tools/nolibc: disable function sanitizer for _start_c()
Both constructors and main() may be executed with different function
signatures than they are actually using.
This is intentional but trips up UBSAN.
Disable the function sanitizer of UBSAN in _start_c().
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250419-nolibc-ubsan-v2-3-060b8a016917@weissschuh.net
-rw-r--r-- | tools/include/nolibc/crt.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/include/nolibc/crt.h b/tools/include/nolibc/crt.h index c4b10103bbec..961cfe777c35 100644 --- a/tools/include/nolibc/crt.h +++ b/tools/include/nolibc/crt.h @@ -7,6 +7,8 @@ #ifndef _NOLIBC_CRT_H #define _NOLIBC_CRT_H +#include "compiler.h" + char **environ __attribute__((weak)); const unsigned long *_auxv __attribute__((weak)); @@ -25,6 +27,9 @@ extern void (*const __fini_array_end[])(void) __attribute__((weak)); void _start_c(long *sp); __attribute__((weak,used)) +#if __nolibc_has_feature(undefined_behavior_sanitizer) + __attribute__((no_sanitize("function"))) +#endif void _start_c(long *sp) { long argc; |