[PATCH 0/2] tools/nolibc: fix WIFSIGNALED() for status 0

Danish Khateeb posted 2 patches 16 hours ago
tools/include/nolibc/types.h                 | 2 +-
tools/testing/selftests/nolibc/nolibc-test.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
[PATCH 0/2] tools/nolibc: fix WIFSIGNALED() for status 0
Posted by Danish Khateeb 16 hours ago
nolibc's WIFSIGNALED() is true for status 0, so a child that exits with
0 looks as if it was killed by signal 0. I ran into it in a nolibc init
for a QEMU test, which reported every clean exit of a child that way.

Patch 1 fixes the macro. Patch 2 adds nolibc-test cases for the wait
status macros, which would have caught it.

Tested on top of nolibc/for-next f2212892b6a0:
- x86_64: without patch 1, the new wifsignaled_exit0 test fails, and
  the rest of nolibc-test gives the same results with and without it.
- x86_64, i386, and arm and sparc64 under qemu-user: all new tests pass.
- libc-test against glibc: all new tests pass, so the expected values
  match glibc.

Danish Khateeb (2):
  tools/nolibc: fix WIFSIGNALED() for status 0
  selftests/nolibc: add tests for the wait status macros

 tools/include/nolibc/types.h                 | 2 +-
 tools/testing/selftests/nolibc/nolibc-test.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)


base-commit: f2212892b6a0c2adab438783e9fa8093c90786d7
-- 
2.55.0
Re: [PATCH 0/2] tools/nolibc: fix WIFSIGNALED() for status 0
Posted by Thomas Weißschuh 4 hours ago
On 2026-09-23 15:56:20-0500, Danish Khateeb wrote:
> nolibc's WIFSIGNALED() is true for status 0, so a child that exits with
> 0 looks as if it was killed by signal 0. I ran into it in a nolibc init
> for a QEMU test, which reported every clean exit of a child that way.
> 
> Patch 1 fixes the macro. Patch 2 adds nolibc-test cases for the wait
> status macros, which would have caught it.
> 
> Tested on top of nolibc/for-next f2212892b6a0:
> - x86_64: without patch 1, the new wifsignaled_exit0 test fails, and
>   the rest of nolibc-test gives the same results with and without it.
> - x86_64, i386, and arm and sparc64 under qemu-user: all new tests pass.
> - libc-test against glibc: all new tests pass, so the expected values
>   match glibc.
> 
> Danish Khateeb (2):
>   tools/nolibc: fix WIFSIGNALED() for status 0
>   selftests/nolibc: add tests for the wait status macros

Applied without the Cc stable, as we don't do that in the nolibc
subsystem.

Thanks!

>  tools/include/nolibc/types.h                 | 2 +-
>  tools/testing/selftests/nolibc/nolibc-test.c | 8 ++++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> 
> base-commit: f2212892b6a0c2adab438783e9fa8093c90786d7
> -- 
> 2.55.0
>