From cbd62c472e853eb98bbc0336f51dda06f1484a15 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Tue, 30 Mar 2021 10:20:54 +0430 Subject: [PATCH] UserspaceEmulator: Default-initialize the siginfo struct used in waitid Otherwise it'll have some random value from the stack, and the kernel will not bother setting it to zero. Also add a debug print and tweak the FIXME message. --- Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index 61724c26bd..378b789dee 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -1358,7 +1358,7 @@ int Emulator::virt$waitid(FlatPtr params_addr) mmu().copy_from_vm(¶ms, params_addr, sizeof(params)); Syscall::SC_waitid_params host_params = params; - siginfo info; + siginfo info {}; host_params.infop = &info; int rc = syscall(SC_waitid, &host_params); @@ -1366,7 +1366,8 @@ int Emulator::virt$waitid(FlatPtr params_addr) return rc; if (info.si_addr) { - // FIXME: Translate this somehow. + // FIXME: Translate this somehow once we actually start setting it in the kernel. + dbgln("si_addr is set to {:p}, I did not expect this!", info.si_addr); TODO(); }