When called with WNOHANG and no child has exited, waitid returns with info.si_pid set to zero and thus check for info.si_pid != 0 will cause target siginfo structure to be uninitialized. Fixed by removing the check.
Signed-off-by: Serge Belyshev <belys...@depni.sinp.msu.ru> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/817 --- linux-user/syscall.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5950222a77..b80531ac4c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8724,9 +8724,8 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, case TARGET_NR_waitid: { siginfo_t info; - info.si_pid = 0; ret = get_errno(safe_waitid(arg1, arg2, &info, arg4, NULL)); - if (!is_error(ret) && arg3 && info.si_pid != 0) { + if (!is_error(ret) && arg3) { if (!(p = lock_user(VERIFY_WRITE, arg3, sizeof(target_siginfo_t), 0))) return -TARGET_EFAULT; host_to_target_siginfo(p, &info); -- 2.34.1