• D
    Do not call getpid wrapper after fork in tests · 12fbabd2
    Dominik Stolz 提交于
    The test calls libc::getpid() in the pre_exec hook and asserts that the returned value is different from the PID of the parent.
    However, libc::getpid() returns the wrong value.
    Before version 2.25, glibc caches the PID of the current process with the goal of avoiding additional syscalls.
    The cached value is only updated when the wrapper functions for fork or clone are called.
    In PR #81825 we switch to directly using the clone3 syscall.
    Thus, the cache is not updated and getpid returns the PID of the parent.
    source: https://man7.org/linux/man-pages/man2/getpid.2.html#NOTES
    12fbabd2
process-panic-after-fork.rs 4.6 KB