Skip to content

Handle or avoid nested syscalls in preload mode #1455

@sporksmith

Description

@sporksmith

The reason our signal test currently doesn't pass for preload-mode is that:

  • The virtual process calls kill(getpid(), SIGUSR1)
  • Shadow sends a SHD_SHIM_EVENT_SYSCALL request, asking the managed process to call kill itself, with the native pid substituted for the virtual pid.
  • The shim handler does so, which causes the test's corresponding signal handler to run
  • The signal handler makes another syscall (exit) which ends up causing a message to be sent to shadow.
  • Shadow is expecting SHD_SHIM_EVENT_SYSCALL_COMPLETE, and panics.

The simplest solution I can think of is to just call kill ourselves from Shadow instead of asking the plugin to do it on our behalf.

If there's a reason to have the managed process do it instead, the next simplest solution I can think of is to add a new message type like SHD_SHIM_EVENT_CONTINUE_WITH_SYSCALL, for cases like this one where Shadow needs to change the syscall parameters but doesn't need to know the result.

Metadata

Metadata

Assignees

Labels

Type: BugError or flaw producing unexpected results

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions