Skip to content

sandbox: Fix PR_SET_PDEATHSIG race condition

The child calls prctl(PR_SET_PDEATHSIG, SIGTERM) to receive the TERM signal when the parent dies. But the parent could have died before the child called prctl(2).

To solve the race we check if the original parent is the current parent after calling prctl(2). The usual trick is to compare the parent pids, but this will not work if the child is created inside a pid name space since getppid(2) will always return 0.

For now, this is not a critical problem since the parent does nothing more than wait for the child to finish, but this will change when user namespace uid/gid mapping is implemented.

Merge request reports