| Summary: | posix_spawn under valgrind succeeds when it would fail natively due to a missing executable | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Godmar Back <godmar> |
| Component: | general | Assignee: | Julian Seward <jseward> |
| Status: | REPORTED --- | ||
| Severity: | normal | CC: | godmar, pjfloyd |
| Priority: | NOR | ||
| Version First Reported In: | 3.22.0 | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | posix_spawn_valgrind_test.c test case | ||
|
Description
Godmar Back
2024-02-22 15:21:37 UTC
Valgrind doesn't support clone3 that posix_spawn uses on Linux (and on FreeBSD, posix_spawn uses rfork which Valgrind only supports with the posix_spawn options). Sticking to Linux, since Valgrind returns ENONSYS for clone3, glibc falls back to using clone. I'll need to look more at the specifics as to what is happening. However, fork and clone syscalls are very tricky to emulate. For instance, the CLONE_CLEAR_SIGHAND flag would involve turning the flag off initially - the child valgrind needs to keep its signal handlers - and then finding some way to get the child valgrind to clear the signal handlers in its guest. |