bubblewrap icon indicating copy to clipboard operation
bubblewrap copied to clipboard

Hangs if the calling process ignores SIGCHLD

Open yan12125 opened this issue 4 months ago • 0 comments

For example, this program hangs unless I remove the call to signal function.

#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>

int main(void) {
    signal(SIGCHLD, SIG_IGN);

    pid_t pid = fork();

    if (pid == 0) {
        const char *argv[] = {
            "/usr/bin/bwrap",
            "--ro-bind", "/", "/",
            "--proc", "/proc",
            "/usr/bin/true",
            NULL
        };

        execv(argv[0], (char * const *)argv);
    }

    waitpid(pid, NULL, 0);

    return 0;
}

A real-world case is:

  • gcin, the affected application, uses signal(SIGCHLD, SIG_IGN);
  • gcin eventually uses glycin library
  • glycin uses bwrap

From gdb, bwrap is stuck in monitor_child. A fix might be using SIG_DFL for SIGCHLD before executing a process.

yan12125 avatar Oct 09 '25 00:10 yan12125