{"record":{"id":"3c065b1ebb0efbdd","repo":"podman-container-tools/podman","slug":"waitpid-m-3c065b","errorCode":null,"errorMessage":"waitpid: %m\n","messagePattern":"waitpid: %m\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rootless/rootless_linux.c","lineNumber":403,"sourceCode":"          exit (EXIT_FAILURE);\n        }\n      newargv[0] = (char*) path;\n      for (i = 0; i < argc; i++)\n        newargv[i+1] = argv[i];\n\n      newargv[i+1] = NULL;\n      errno = 0;\n      execv (path, newargv);\n      /* If the file was deleted in the meanwhile, return success.  */\n      if (errno == ENOENT)\n        exit (EXIT_SUCCESS);\n      exit (EXIT_FAILURE);\n    }\n\n  r = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));\n  if (r < 0)\n    {\n      fprintf (stderr, \"waitpid: %m\\n\");\n      exit (EXIT_FAILURE);\n    }\n  if (WIFEXITED(status) && WEXITSTATUS (status))\n    exit (WEXITSTATUS(status));\n  if (WIFSIGNALED (status))\n    exit (127+WTERMSIG (status));\n  if (WIFSTOPPED (status))\n      exit (EXIT_FAILURE);\n}\n\nstatic void\ndo_preexec_hooks_dir (const char *dir, char **argv, int argc)\n{\n  cleanup_free char *buffer = NULL;\n  cleanup_dir DIR *d = NULL;\n  size_t i, nfiles = 0;\n  struct dirent *de;\n","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/podman-container-tools/podman/blob/a2409076ef2fef60ad9ac046375dedc7d9410ef4/pkg/rootless/rootless_linux.c#L385-L421","documentation":"After exec_binary() forks a child to run a preexec hook, the parent reaps it with TEMP_FAILURE_RETRY(waitpid(...)) (pkg/rootless/rootless_linux.c:400). EINTR is already retried, so this message means waitpid failed for another reason - typically ECHILD because someone else (a SIGCHLD handler with SA_NOCLDWAIT, or an auto-reaping supervisor) already reaped the child. The podman process exits with EXIT_FAILURE before Go code runs.","triggerScenarios":"Running podman with preexec hooks enabled while embedded in a process that installs a SIGCHLD handler with SA_NOCLDWAIT or reaps arbitrary children (some supervision frameworks, REPLs, language runtimes); an LSM/seccomp policy denying wait4 to the podman process.","commonSituations":"Podman launched from inside process managers that auto-reap children; a preexec hook wrapper that manipulates child-process state; sandboxed environments intercepting wait syscalls.","solutions":["Run the same command from a plain shell to confirm the environment (not podman) is reaping the child","Inspect/disable the preexec hooks: remove /etc/containers/podman_preexec_hooks.txt or empty the hook directories","Identify the wrapper installing SIGCHLD handlers/SA_NOCLDWAIT around podman and disable that behavior","Capture 'strace -f -e trace=clone,wait4 podman <cmd>' and report upstream with the trace"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Ensure no auto-reaping environment is in play and hooks are sane\nls -la /etc/containers/pre-exec-hooks 2>/dev/null\nls -la \"${PODMAN_PREEXEC_HOOKS_DIR:-}\" 2>/dev/null\n# reproduce from a plain shell first to rule out wrapper interference\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not embed podman in supervisors that set SIGCHLD handlers with SA_NOCLDWAIT or auto-reap children","Test preexec hooks from a clean interactive shell before deploying","Keep an strace of a known-good run to diff when waitpid errors appear"],"tags":["preexec-hooks","process","waitpid","c","sigchld"],"backgroundTag":null,"analyzedSha":"a2409076ef2fef60ad9ac046375dedc7d9410ef4","analyzedAt":"2026-08-15T15:57:05.625Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}