Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/glibc/sysdeps/unix/sysv/linux/spawni.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <paths.h>
#include <shlib-compat.h>
#include <spawn.h>
#include <spawn_int.h>
#include <posix/spawn_int.h>
#include <sysdep.h>
#include <sys/resource.h>
#include <clone_internal.h>
Expand Down Expand Up @@ -348,8 +348,8 @@ __spawnix (int *pid, const char *file,
return errno;
}

int prot = (PROT_READ | PROT_WRITE
| ((GL (dl_stack_flags) & PF_X) ? PROT_EXEC : 0));
// lind-wasm: disallow PROC_EXEC
int prot = (PROT_READ | PROT_WRITE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably should fall through to rawposix where we can lind_panic_debug

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain why if we wont remove

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo


/* Add a slack area for child's stack. */
size_t argv_size = (argc * sizeof (void *)) + 512;
Expand All @@ -361,8 +361,9 @@ __spawnix (int *pid, const char *file,
where it might use about 1k extra stack space). */
argv_size += (32 * 1024);
size_t stack_size = ALIGN_UP (argv_size, GLRO(dl_pagesize));
// lind-wasm: remove MAP_STACK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

void *stack = __mmap (NULL, stack_size, prot,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (__glibc_unlikely (stack == MAP_FAILED))
return errno;

Expand Down Expand Up @@ -401,8 +402,7 @@ __spawnix (int *pid, const char *file,
.flags = (set_cgroup ? CLONE_INTO_CGROUP : 0)
| (use_pidfd ? CLONE_PIDFD : 0)
| CLONE_CLEAR_SIGHAND
| CLONE_VM
| CLONE_VFORK,
| CLONE_VFORK, // lind-wasm: removed CLONE_VM flag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

.exit_signal = SIGCHLD,
.stack = (uintptr_t) stack,
.stack_size = stack_size,
Expand Down