live-bootstrap/sysa/musl-1.1.24/patches/avoid_sys_clone.patch

31 lines
775 B
Diff

# SPDX-FileCopyrightText: 2023 Richard Masters <grick23@gmail.com>
# SPDX-License-Identifier: MIT
diff -r -u musl-1.1.24.orig/src/process/posix_spawn.c musl-1.1.24/src/process/posix_spawn.c
--- src/process/posix_spawn.c 2019-10-13 21:58:27.000000000 +0000
+++ src/process/posix_spawn.c 2023-02-28 14:08:18.636606282 +0000
@@ -8,6 +8,7 @@
#include "syscall.h"
#include "pthread_impl.h"
#include "fdop.h"
+#define BOOTSTRAP
struct args {
int p[2];
@@ -182,8 +183,16 @@
args.envp = envp;
pthread_sigmask(SIG_BLOCK, SIGALL_SET, &args.oldmask);
+#ifndef BOOTSTRAP
pid = __clone(child, stack+sizeof stack,
CLONE_VM|CLONE_VFORK|SIGCHLD, &args);
+#else
+ pid = fork();
+ if (pid == 0) {
+ _exit(child(&args));
+ }
+#endif
+
close(args.p[1]);
if (pid > 0) {