From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14771 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: Hangup calling setuid() from vfork() child Date: Tue, 1 Oct 2019 07:44:00 -0400 Message-ID: <20191001114400.GD16318@brightrain.aerifal.cx> References: <87zhilvwlr.fsf@oldenburg2.str.redhat.com> <20191001092908.GU22009@port70.net> 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="115819"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com, Joshua Hudson Original-X-From: musl-return-14787-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 01 13:44:17 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 1iFGZj-000Tzt-Du for gllmg-musl@m.gmane.org; Tue, 01 Oct 2019 13:44:15 +0200 Original-Received: (qmail 1934 invoked by uid 550); 1 Oct 2019 11:44:13 -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 1913 invoked from network); 1 Oct 2019 11:44:12 -0000 Content-Disposition: inline In-Reply-To: <20191001092908.GU22009@port70.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14771 Archived-At: On Tue, Oct 01, 2019 at 11:29:08AM +0200, Szabolcs Nagy wrote: > * 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 ~~~~~~~~ Note that this entire problem would go away if Linux would finally give us a working multithreaded credentials-change syscall... Rich