From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14769 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: Hangup calling setuid() from vfork() child Date: Tue, 1 Oct 2019 11:29:08 +0200 Message-ID: <20191001092908.GU22009@port70.net> References: <87zhilvwlr.fsf@oldenburg2.str.redhat.com> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="75357"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Joshua Hudson To: musl@lists.openwall.com Original-X-From: musl-return-14785-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 01 11:29:23 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1iFETD-000JV0-82 for gllmg-musl@m.gmane.org; Tue, 01 Oct 2019 11:29:23 +0200 Original-Received: (qmail 17990 invoked by uid 550); 1 Oct 2019 09:29:20 -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 17972 invoked from network); 1 Oct 2019 09:29:20 -0000 Mail-Followup-To: musl@lists.openwall.com, Joshua Hudson Content-Disposition: inline In-Reply-To: <87zhilvwlr.fsf@oldenburg2.str.redhat.com> Xref: news.gmane.org gmane.linux.lib.musl.general:14769 Archived-At: * Florian Weimer [2019-10-01 07:54:56 +0200]: > * Joshua Hudson: > > >> Basically, the vfork() child is in an invalid state and this cannot > >> be repaired without damaging the parent. > > > > Works on glibc just fine. > > Are you sure it's changing the credentials of the right TIDs? i don't think it works on glibc (or any other linux libc for that matter) reliably because the child uses parent data structures to sync with concurrent threads and the child also clobbers the errno of the parent. but it will work usually on glibc because the signals are sent with tgkill which uses getpid + target tid and that will just fail because of the pid mismatch, i think glibc will only deadlock if the parent concurrently fiddles with the thread stack list. in any case setuid is not supportable after vfork on linux so i don't think musl should change, glibc may want to make it fail somehow to ensure users don't get the wrong idea.