From patchwork Sat Jan 11 23:56:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 104595 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D744385802C for ; Sat, 11 Jan 2025 23:57:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D744385802C X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id D5833385840A for ; Sat, 11 Jan 2025 23:56:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D5833385840A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D5833385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736639791; cv=none; b=MyvNIDe8PAHJsPF4hv8/wQOeG0m5e0L5hMeLZgvKAXAl8nsgJbXa5On75qEop7h292pzcIQj3CV/DQIgBhNYF8VLS2hvDJUlP+uVJ770tztGCJ3knBRfhcvU5h9s4OG8pTLNoZoJ/ggJsmIBNtmHvCqjPgbaWCOMpfGnW6uq7IY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736639791; c=relaxed/simple; bh=vD0zv6qGvs3pST0mxcyv1XVwsAebvGqNiZ4jvEmGcQM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=jvTVdaAzj50DPxx7rIAo5ScmX5qlBYt++v2XhvVbrz98Q5jIS8r1DMu/Rg7z/pRTUq9MJ8/L6dOK0V7OO1fgxFteSRETHiZCLyxx+zfrplQ4x0GkDNuUI0rVta6kPe9QA4wsVL5xyYo4zsFZ71VZUyzH0wNpSj77r15y95pZDTE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5833385840A Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 172FDA02DF; Sun, 12 Jan 2025 00:56:30 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gjgv5JEn_m4T; Sun, 12 Jan 2025 00:56:30 +0100 (CET) Received: from begin (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 78FEDA02DA; Sun, 12 Jan 2025 00:56:29 +0100 (CET) Received: from samy by begin with local (Exim 4.98) (envelope-from ) id 1tWlLA-0000000A7Sz-3qH1; Sun, 12 Jan 2025 00:56:28 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] hurd: Cope with signals sent to ourself early Date: Sun, 12 Jan 2025 00:56:28 +0100 Message-ID: <20250111235628.2411974-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Typically when aborting during initialization, before signals are set up. --- sysdeps/mach/hurd/kill.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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.