Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 30 Sep 2019 19:41:32 -0700
From: Joshua Hudson <joshudson@...il.com>
To: Rich Felker <dalias@...c.org>
Cc: musl <musl@...ts.openwall.com>
Subject: Re: Re: posix_spawn

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

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.