Skip to content

thread_preload doesn't interpose some exit handlers, doesn't catch abnormal process exit #1476

@sporksmith

Description

@sporksmith

thread_preload relies on _shim_unload running in the shim to detect when a managed process exits, and stops interposing syscalls after it runs.

_shim_unload is marked with the destructor attribute; libc recognizes it and runs it along with the exit handlers.

Unfortunately this means we don't catch syscalls in any exit handlers that run after ours does. Notably, buffered file IO (from fwrite etc) is flushed in exit handlers as well, which can cause us to miss it.

If the managed process exits without running exit handlers (e.g. by crashing), Shadow doesn't detect that the process has exited and will wait forever.

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