Skip to content

tools/nolibc: fix verrx() and errx()

Danish Khateeb linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2tools/nolibc: fix verrx() and errx() message formattingtools/include/nolibc/err.h+1 -10 replies
2/2selftests/nolibc: add a test for errx()tools/testing/selftests/nolibc/nolibc-test.c+47 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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/[email protected]/

Danish Khateeb (2):
tools/nolibc: fix verrx() and errx() message formatting selftests/nolibc: add a test for errx()

 tools/include/nolibc/err.h                   |  2 +-
 tools/testing/selftests/nolibc/nolibc-test.c | 47 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)

base-commit: 61fb00d6efeeeb9fd65c81db3bd8b2ac140f573c

Signature · 1 line
2.55.0