From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 86A2B3858C66 for ; Sat, 29 Apr 2023 14:54:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 86A2B3858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pslxq-0000Sm-4O; Sat, 29 Apr 2023 10:54:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:MIME-Version:References:Subject:To:From: Date; bh=Pk/6cCJKVzMlxj3SpMr7FBkNyItwNWYRzEmJpMPdzFg=; b=U8fH5EIZxFSMMiCvxpCS MMM6cQuJGM7rctQAnebikD2PywAnaygs2V6MSdu0Ry5EdOaoxyajHoX44X4EmtDs1phq6a3Gp26Mn Zc69ltL221VDKMsnzdaXPnNdks+514WOeymuq/VBgwQJ6R4TuVihsGhyqMWHVBd4U1gvFF2VbmN1A Kpxjgw+SbZMKKaCm0+rFjEDkecxLu6zkFC613YWJBgpC7gLWj73bI05mBejZxmARcrb4LnWs4bfaT CQInqqZPeZykZESTbviV0oDJL4D4EdQfJkLQFOy6/yq/VhUe9eVXe0Sz1QiFwnxXVqBPDcjp9/v+j ayhGvN4phyKHDw==; Received: from [2a01:cb19:4a:a400:de41:a9ff:fe47:ec49] (helo=begin.home) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pslxp-0008Ff-Lw; Sat, 29 Apr 2023 10:54:17 -0400 Received: from samy by begin.home with local (Exim 4.96) (envelope-from ) id 1pslxo-002ESY-1v; Sat, 29 Apr 2023 16:54:16 +0200 Date: Sat, 29 Apr 2023 16:54:16 +0200 From: Samuel Thibault To: Sergey Bugaev Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: Re: [PATCH 4/7] hurd: Make _exit work during early boot-up Message-ID: <20230429145416.3uhbsjsszqwtdqsq@begin> Mail-Followup-To: Sergey Bugaev , libc-alpha@sourceware.org, bug-hurd@gnu.org References: <20230429131354.2507443-1-bugaevc@gmail.com> <20230429131354.2507443-4-bugaevc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230429131354.2507443-4-bugaevc@gmail.com> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Applied, thanks! Sergey Bugaev, le sam. 29 avril 2023 16:13:51 +0300, a ecrit: > If any of the early boot-up tasks calls exit () or returns from main (), > terminate it properly instead of crashing on trying to dereference > _hurd_ports and getting forcibly terminated by the kernel. > > We sadly cannot make the __USEPORT macro do the check for _hurd_ports > being unset, because it evaluates to the value of the expression > provided as the second argument, and that can be of any type; so there > is no single suitable fallback value for the macro to evaluate to in > case _hurd_ports is unset. Instead, each use site that wants to care for > this case will have to do its own checking. > > Checked on x86_64-gnu. \o/ > Signed-off-by: Sergey Bugaev > --- > sysdeps/mach/hurd/_exit.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c > index 73957744..80cfe532 100644 > --- a/sysdeps/mach/hurd/_exit.c > +++ b/sysdeps/mach/hurd/_exit.c > @@ -24,8 +24,9 @@ > void > _hurd_exit (int status) > { > - /* Give the proc server our exit status. */ > - __USEPORT (PROC, __proc_mark_exit (port, status, 0)); > + if (_hurd_ports != NULL) > + /* Give the proc server our exit status. */ > + __USEPORT (PROC, __proc_mark_exit (port, status, 0)); > > /* Commit suicide. */ > __task_terminate (__mach_task_self ()); > -- > 2.40.1 > -- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.