[Virtio-fs] [virtiofsd] MR merged: sandbox: Fix PR_SET_PDEATHSIG race condition

virtiofs-bot at sinrega.org virtiofs-bot at sinrega.org
Mon Jun 27 11:27:42 UTC 2022


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.
---
https://gitlab.com/virtio-fs/virtiofsd/-/merge_requests/117



More information about the Virtio-fs mailing list