From: Samuel Thibault Date: Sat, 11 Jan 2025 23:09:44 +0000 (+0100) Subject: hurd: Cope with signals sent to ourself early X-Git-Tag: glibc-2.41~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c4856250814d5fe1222a39c6954c4b5d79a829c;p=thirdparty%2Fglibc.git hurd: Cope with signals sent to ourself early Typically when aborting during initialization, before signals are set up. --- diff --git a/sysdeps/mach/hurd/kill.c b/sysdeps/mach/hurd/kill.c index 1e006ee1db..8cba3cc4ea 100644 --- a/sysdeps/mach/hurd/kill.c +++ b/sysdeps/mach/hurd/kill.c @@ -17,7 +17,9 @@ #include #include +#include #include +#include #include #include #include @@ -34,6 +36,14 @@ __kill (pid_t pid, int sig) mach_port_t proc; struct hurd_userlink ulink; + if (pid == __getpid () && _hurd_msgport == MACH_PORT_NULL) + { + /* We are trying to kill ourself but we have not even initialized our own + msgport yet. Abort by hand. */ + _exit (127); + /* NOTREACHED */ + } + void kill_pid (pid_t pid) /* Kill one PID. */ { /* SIGKILL is not delivered as a normal signal.