-
Notifications
You must be signed in to change notification settings - Fork 15
glibc - fix spawni #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
qianxichen233
wants to merge
1
commit into
main
Choose a base branch
from
various-fix-spawni
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
glibc - fix spawni #360
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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> | ||
|
|
@@ -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); | ||
|
|
||
| /* Add a slack area for child's stack. */ | ||
| size_t argv_size = (argc * sizeof (void *)) + 512; | ||
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
||
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? |
||
| .exit_signal = SIGCHLD, | ||
| .stack = (uintptr_t) stack, | ||
| .stack_size = stack_size, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo