mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Joshua Hudson <joshudson@gmail.com>
To: Rich Felker <dalias@libc.org>
Cc: musl <musl@lists.openwall.com>
Subject: Re: Re: posix_spawn
Date: Mon, 30 Sep 2019 19:41:32 -0700	[thread overview]
Message-ID: <CA+jjjYQTJakriFpM4mc9BOLFX8j3E8p7kqWhy1P5Qwf_xV7GQA@mail.gmail.com> (raw)
In-Reply-To: <20191001022102.GA16318@brightrain.aerifal.cx>

> > 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,


  reply	other threads:[~2019-10-01  2:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30 21:15 posix_spawn Joshua Hudson
2019-09-30 22:36 ` posix_spawn Rich Felker
2019-10-01  1:58   ` Joshua Hudson
2019-10-01  2:21     ` Rich Felker
2019-10-01  2:41       ` Joshua Hudson [this message]
2019-10-01  2:55         ` Rich Felker
2019-10-01  7:05           ` Florian Weimer
2019-10-01 11:42             ` Rich Felker
2019-10-01 14:07               ` posix_spawn Joshua Hudson
2019-10-01 14:15                 ` posix_spawn Florian Weimer
2019-10-01 14:44                   ` posix_spawn Rich Felker
2019-10-01 15:06                     ` Rich Felker
2019-10-16 12:40               ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+jjjYQTJakriFpM4mc9BOLFX8j3E8p7kqWhy1P5Qwf_xV7GQA@mail.gmail.com \
    --to=joshudson@gmail.com \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).