From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10170 Path: news.gmane.org!not-for-mail From: Igmar Palsenberg Newsgroups: gmane.linux.lib.musl.general Subject: Re: abort() fails to terminate PID 1 process Date: Mon, 20 Jun 2016 14:00:42 +0200 (CEST) Message-ID: References: <20160620100443.GV22574@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1466424054 9219 80.91.229.3 (20 Jun 2016 12:00:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2016 12:00:54 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10183-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jun 20 14:00:46 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bExsj-0006Mz-5H for gllmg-musl@m.gmane.org; Mon, 20 Jun 2016 14:00:45 +0200 Original-Received: (qmail 26322 invoked by uid 550); 20 Jun 2016 12:00:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 26304 invoked from network); 20 Jun 2016 12:00:42 -0000 DKIM-Filter: OpenDKIM Filter v2.10.3 s1.palsenberg.com u5KC0gYr019333 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palsenberg.com; s=s1; t=1466424043; bh=z9pOObZoilHdy5M2/jzVeyr5RELrruvEiHw3h0sLju4=; h=Date:From:To:Subject:In-Reply-To:References:From; b=PwBg1PVjTsCeO9iNRvY8QPm6m43l1SKmKzXJG5dLnxkacNRHCZCNCULB00CNVH3YY ccS2Oa57ksu+xlACdYvqHDxnwVguBu6/3GmbzlQ9f7/+jzmdmI4mpGVt7M+qgvWUc2 4QSckRTxP5yW/OemMZRKJqj4Nk9W7cydLOUOdHsA= In-Reply-To: <20160620100443.GV22574@port70.net> User-Agent: Alpine 2.20 (LRH 67 2015-01-07) X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.5.16 (s1.palsenberg.com [127.0.0.1]); Mon, 20 Jun 2016 14:00:43 +0200 (CEST) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on s1.palsenberg.com Xref: news.gmane.org gmane.linux.lib.musl.general:10170 Archived-At: > > First, processes kan install handlers, which might > > instruct the kernel to ignore the signal. SIGABORT can be ignored. I don't > > abort() should terminate the process even if SIGABRT is ignored. That rule doesn't apply to pid 1 by default. Pid 1 should be a proper init system, not a full blows application that makes the system blow up on every error. > > expect my process to be SIGILL'ed next because of this (which, can also be > > ignored). > > Libc should NOT mess with these kind of things, that's up to the > > application. > > the glibc fallbacks are > > change signal mask and set default handling for SIGABRT > raise(SIGABRT); > "abort instruction" (segfault, sigtrap or sigill depending on target) > _exit(127); > infinite loop Pid 1 is an exception to all of this. > http://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/abort.c;h=155d70b0647e848f1d40fc0e3b15a2914d7145c0;hb=HEAD > > on x86 glibc, pid 1 would terminate with SIGSEGV > (unless there is a segfault handler). > > the musl logic is explained in > > http://git.musl-libc.org/cgit/musl/commit/?id=2557d0ba47286ed3e868f8ddc9dbed0942fe99dc > > neither of them is correct because it is not possible to > exit with the right status in general. > > SIGKILL can only be ignored by pid 1 whose exit status is > not supposed to be observable so musl may want to have a > fallback after it since the pid namespace thing is nowadays > widely abused on linux. Well, normally abort() does some signal magic, and then raises again. Which is what POSIX mandates I think. If you're pid 1 however, you should behave like one. Igmar