Re: [PATCH 0/2] tools/nolibc: fix verrx() and errx()

From: Thomas Weißschuh

Date: Thu Sep 24 2026 - 15:42:38 EST


On 2026-09-24 07:09:56-0500, Danish Khateeb wrote:
> verrx() passes its va_list to the variadic warnx() instead of vwarnx(),
> so errx() and verrx() print their messages with the wrong arguments,
> and can crash when the format has a "%s".
>
> Patch 1 fixes it. Patch 2 adds a nolibc-test case for errx(), which
> would have caught it.
>
> The series is independent of the readdir_r()/FD_* series [1] and merges
> cleanly with it.
>
> Tested on top of nolibc/for-next 61fb00d6efee, on x86_64 and i386, and
> on arm, arm64 and sparc64 under qemu-user:
>
> - nolibc-test, all tests: no failures with the series. The only
> difference from before is the new errx test, which passes. It also
> passes against glibc (make libc-test).
>
> - Without patch 1, the errx test fails on all five. On x86_64 the child
> is killed by SIGSEGV.
>
> [1] https://lore.kernel.org/all/20260924015222.31693-1-danishkhateeb03@xxxxxxxxx/
>
> Danish Khateeb (2):
> tools/nolibc: fix verrx() and errx() message formatting
> selftests/nolibc: add a test for errx()

Thanks!

I picked up the bugfix. The selftests looks like a lot of additional
code for the value it provides, so I didn't apply it.

> tools/include/nolibc/err.h | 2 +-
> tools/testing/selftests/nolibc/nolibc-test.c | 47 ++++++++++++++++++++
> 2 files changed, 48 insertions(+), 1 deletion(-)
>
>
> base-commit: 61fb00d6efeeeb9fd65c81db3bd8b2ac140f573c
> --
> 2.55.0
>