[PATCH v2 0/7] tools/nolibc: fix some undefined behaviour and enable UBSAN

Thomas Weißschuh posted 7 patches 7 months, 4 weeks ago
tools/include/nolibc/compiler.h              | 9 +++++++++
tools/include/nolibc/crt.h                   | 5 +++++
tools/include/nolibc/dirent.h                | 3 ++-
tools/include/nolibc/stdlib.h                | 4 ++--
tools/testing/selftests/nolibc/Makefile      | 3 ++-
tools/testing/selftests/nolibc/nolibc-test.c | 1 +
6 files changed, 21 insertions(+), 4 deletions(-)
[PATCH v2 0/7] tools/nolibc: fix some undefined behaviour and enable UBSAN
Posted by Thomas Weißschuh 7 months, 4 weeks ago
Fix some issues uncovered by UBSAN and enable UBSAN for nolibc-test to
avoid regressions.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Changes in v2:
- Introduce and use __nolibc_aligned_as()
- Reduce size of fixes to i{64,}toa_r()
- Link to v1: https://lore.kernel.org/r/20250416-nolibc-ubsan-v1-0-c4704bb23da7@weissschuh.net

---
Thomas Weißschuh (7):
      tools/nolibc: add __nolibc_has_feature()
      tools/nolibc: add __nolibc_aligned() and __nolibc_aligned_as()
      tools/nolibc: disable function sanitizer for _start_c()
      tools/nolibc: properly align dirent buffer
      tools/nolibc: fix integer overflow in i{64,}toa_r() and
      selftests/nolibc: disable ubsan for smash_stack()
      selftests/nolibc: enable UBSAN if available

 tools/include/nolibc/compiler.h              | 9 +++++++++
 tools/include/nolibc/crt.h                   | 5 +++++
 tools/include/nolibc/dirent.h                | 3 ++-
 tools/include/nolibc/stdlib.h                | 4 ++--
 tools/testing/selftests/nolibc/Makefile      | 3 ++-
 tools/testing/selftests/nolibc/nolibc-test.c | 1 +
 6 files changed, 21 insertions(+), 4 deletions(-)
---
base-commit: 7c73c10b906778384843b9d3ac6c2224727bbf5c
change-id: 20250416-nolibc-ubsan-028401698654

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH v2 0/7] tools/nolibc: fix some undefined behaviour and enable UBSAN
Posted by Willy Tarreau 7 months, 4 weeks ago
On Sat, Apr 19, 2025 at 12:46:17PM +0200, Thomas Weißschuh wrote:
> Fix some issues uncovered by UBSAN and enable UBSAN for nolibc-test to
> avoid regressions.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Changes in v2:
> - Introduce and use __nolibc_aligned_as()
> - Reduce size of fixes to i{64,}toa_r()
> - Link to v1: https://lore.kernel.org/r/20250416-nolibc-ubsan-v1-0-c4704bb23da7@weissschuh.net

Wow that was a fast turn-around! Looks good. For the whole series:

  Acked-by: Willy Tarreau <w@1wt.eu>

Thank you Thomas!
Willy