Skip to content

Commit

Permalink
UserspaceEmulator: Default-initialize the siginfo struct used in waitid
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alimpfard authored and awesomekling committed Mar 31, 2021
1 parent c4cf4ef commit cbd62c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,15 +1358,16 @@ int Emulator::virt$waitid(FlatPtr params_addr)
mmu().copy_from_vm(&params, 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);
if (rc < 0)
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();
}

Expand Down

0 comments on commit cbd62c4

Please sign in to comment.