Skip to content

PR_SET_PDEATHSIG is racy unless there is a check for the parent having already died #700

Open
microsoft/vscode
#342277

Description

@DemiMarie

If the parent process has died already, PR_SET_PDEATHSIG is a no-op. I consider this a kernel bug, but there is a workaround: if one knows what the parent process’s PID should be, one can compare the return value of getppid() to it. If they are different, raise the appropriate signal.

PR_SET_PDEATHSIG can be circumvented by a subsequent call unless it is blocked by seccomp, blocked by an LSM (like Yama), or bubblewrap is not dumpable and no other process in the same or child PID namespace has CAP_SYS_PTRACE. Bubblewrap should probably mark itself as non-dumpable to protect against the last scenario.

Activity

  1. smcv commented on Sep 9, 2025

    @smcv
    Collaborator

    PR_SET_PDEATHSIG can be circumvented by a subsequent call

    I don't know what scenario you have in mind, but if you believe you have found a security vulnerability, please report it privately.

    As far as I'm aware, bwrap's --die-with-parent is intended to be a convenience to get helper processes cleaned up automatically, rather than a security mechanism, so it's considered to be OK if there are ways it might not work. (But I'll defer to the authors of bubblewrap on this, if they have an opinion.)

  2. DemiMarie commented on Sep 9, 2025

    @DemiMarie
    Author

    PR_SET_PDEATHSIG can be circumvented by a subsequent call

    I don't know what scenario you have in mind, but if you believe you have found a security vulnerability, please report it privately.

    As far as I'm aware, bwrap's --die-with-parent is intended to be a convenience to get helper processes cleaned up automatically, rather than a security mechanism, so it's considered to be OK if there are ways it might not work. (But I'll defer to the authors of bubblewrap on this, if they have an opinion.)

    That this is racy is well-known, so I didn't see this as a security vulnerability.

  3. sertonix commented on Nov 17, 2025

    @sertonix
    Contributor

    As far as I'm aware, bwrap's --die-with-parent is intended to be a convenience to get helper processes cleaned up automatically, rather than a security mechanism

    Would it be of possible to document limitations/non-goals like this more clearly. Eg. in a CAVEATS section in the man page?

  4. DemiMarie commented on Nov 18, 2025

    @DemiMarie
    Author

    I tried to get this fixed in the kernel but the maintainers didn't seem to be interested. They recommend using cgroups to ensure that process trees are cleaned up.

  5. sertonix commented on Sep 4, 2026

    @sertonix
    Contributor

    Would the guarantees provided by CLONE_PIDFD_AUTOKILL allow for an option with security promises?

  6. DemiMarie commented on Sep 6, 2026

    @DemiMarie
    Author

    Maybe? The problem is that it isn’t transitive, and I don’t think it is synchronous either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions