From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14765 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Joshua Hudson Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: posix_spawn Date: Mon, 30 Sep 2019 19:41:32 -0700 Message-ID: References: <20190930223632.GW9017@brightrain.aerifal.cx> <20191001022102.GA16318@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="22633"; mail-complaints-to="usenet@blaine.gmane.org" Cc: musl To: Rich Felker Original-X-From: musl-return-14781-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 01 04:41:49 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 1iF86l-0005nG-7J for gllmg-musl@m.gmane.org; Tue, 01 Oct 2019 04:41:47 +0200 Original-Received: (qmail 26034 invoked by uid 550); 1 Oct 2019 02:41:44 -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 26014 invoked from network); 1 Oct 2019 02:41:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MkRk4o08jblilMlKHZPorIc9ExbB3bph8F8lfTZUYgs=; b=GdcaDMNTDrkB2WP3cqLT4qS5riL4fX4A9rKEC9bc8rPuW3/0vba/Leu/2ow8iW+kc1 3MaPn71lLVyQP/ptD4IsBge9HGjK8vyr3vJcUHc41bHo7z9Kj/c8uhgF4h8WwC1GI5tr IYlKGA8pcOOyxpwxjW9NkC62wZm2UmXxWYlOfY+4Wrze3unpV+0ixViP9m4Kj/TKF6N+ Mb0DADAuVcHxt9CAggSe0mKeWWiQ+Mi+EMZNqvMLLlLO9e1qW1GxUeh4GazRfkaWxn+h QXU/YYevcbN85IL0UYF1mrVjhvGCOEMJcaC36Ng4G3MG0cvRIFp0Mk1BQlOrdRUK9l7/ rEOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MkRk4o08jblilMlKHZPorIc9ExbB3bph8F8lfTZUYgs=; b=kSl4vlXywmdAN6thWLQ5VHAAyge9X1Uju3boZ/1kIvfmFtbrOYiad/azzr0wRw7p/S C4mmH7YsBEK4APFWCF1WpvcJ8KtKOxyHwmwsQlC9/XGPUlXolFAPkve6z/z1f+8SBQ0U 1dtuI9iEANYQyOehGSeEyS55iP8vBPJZDwrSHqhT5jstcBkP5Wo6QNLKAuym7jB+zxzT E5HvUeKzX4u4DYu6gUTAZjjVYJuMsXlzm4Ogq5AXbY5JC6VLa7IwWHr6djSfPbBB4tNw NwnzpFl4bhFDTgia1ZxQ0NzfDQtxPwtdPSfwEfIpDHb5l37y2Ubvv9cjI6OfQN8dee+C RWAw== X-Gm-Message-State: APjAAAWivebO8j7l3xUS+FORH5llfSKUajpc6X8TdxzuAM2hWhnd5lhO tBQeh9iaBGJTKi3gQDORc7dgGParnZ3c/xYJZzQ= X-Google-Smtp-Source: APXvYqyqpU6bcj3rMpzeA99aEcmsiE6CF1dPl1fnV0v/bGoQ2UsmfA5yzB8Q11ZvHKgml1ckJD7Oo3snH/Hk3uf1bws= X-Received: by 2002:a67:b447:: with SMTP id c7mr11118499vsm.91.1569897692578; Mon, 30 Sep 2019 19:41:32 -0700 (PDT) In-Reply-To: <20191001022102.GA16318@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:14765 Archived-At: > > You now have a quirk and I need to actually detect musl libc. > Huh? This does not sound musl-specific. Musl seems to be the only library that actually implements vfork shared memory that can't tolerate calling setuid() inside it. This patch should take care of the issue. diff --git a/src/thread/synccall.c b/src/thread/synccall.c index 648a6ad4..e152ccfe 100644 --- a/src/thread/synccall.c +++ b/src/thread/synccall.c @@ -48,6 +48,9 @@ void __synccall(void (*func)(void *), void *ctx) struct sigaction sa = { .sa_flags = SA_RESTART, .sa_handler = handler }; pthread_t self = __pthread_self(), td; int count = 0; + /* If we aren't in the process we think we're in, this is the best we + * can hope for. */ + if (__pthread_self()->tid != syscall(SYS_gettid)) goto single_threaded; /* Blocking signals in two steps, first only app-level signals * before taking the lock, then all signals after taking the lock,