I.e. if the parent bwrap process is killed soon after startup, the child bwrap process stops being able to clean up properly. This is probably because the setting of PR_SET_PDEATHSIG in the child doesn't happen immediately and when it does happen, the original parent is already dead, so PR_SET_PDEATHSIG becomes attached to PID 1. (Note: the script above depends on timing and might need to be run in a loop and/or a carefully placed sleep to show this result.)
I.e. if the parent bwrap process is killed soon after startup, the child bwrap process stops being able to clean up properly. This is probably because the setting of
PR_SET_PDEATHSIG
in the child doesn't happen immediately and when it does happen, the original parent is already dead, soPR_SET_PDEATHSIG
becomes attached to PID 1. (Note: the script above depends on timing and might need to be run in a loop and/or a carefully placed sleep to show this result.)In a different terminal:
See also https://stackoverflow.com/questions/42496478/prctlpr-set-pdeathsig-race-condition for a discussion of this race condition and possible mitigations.