-
Notifications
You must be signed in to change notification settings - Fork 387
Removing arch_prctl from syscall and creating architecture specific musl calls #2350
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
Merged
Merged
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
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #include "syscall.h" | ||
|
|
||
| #define ARCH_SET_FS 0x1002 | ||
|
|
||
| int __set_thread_area(void *p) | ||
| { | ||
| return __syscall(SYS_arch_prctl, ARCH_SET_FS, p); | ||
| } |
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
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #include <os> | ||
| #include <errno.h> | ||
| #include "cpu.hpp" | ||
|
|
||
| extern "C" | ||
| long syscall_SYS_set_thread_area(struct user_desc *u_desc) { | ||
| set_tpidr(u_info); // This probably still does not work | ||
| return 0; | ||
| } | ||
|
|
||
| extern "C" | ||
| long syscall_SYS_arch_prctl(int code, uintptr_t ptr) { | ||
| os::panic("Arch_prctl is specific to x86!"); | ||
| return -ENOSYS; | ||
| } |
This file was deleted.
Oops, something went wrong.
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
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #include <os> | ||
| #include <errno.h> | ||
|
|
||
| extern "C" | ||
| long syscall_SYS_set_thread_area(struct user_desc *u_info) | ||
| { | ||
| os::panic("Libc not supported for 32 bit currently!"); | ||
| return -ENOSYS; | ||
| } | ||
|
|
||
| extern "C" | ||
| long syscall_SYS_arch_prctl(int code, uintptr_t ptr) { | ||
| os::panic("Libc not supported for 32 bit currently!"); | ||
| return -ENOSYS; | ||
| } |
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
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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #include <os> | ||
| #include <errno.h> | ||
| #include <likely> | ||
| #include <arch/x86/cpu.hpp> | ||
|
|
||
| extern "C" | ||
| long syscall_SYS_set_thread_area(struct user_desc *u_desc) { | ||
| os::panic("Setting thread pointer on 64 bit Intel/AMD should go via arch_prctl!"); | ||
| return -ENOSYS; | ||
| } | ||
|
|
||
| #define ARCH_SET_GS 0x1001 | ||
| #define ARCH_SET_FS 0x1002 | ||
| #define ARCH_GET_FS 0x1003 | ||
| #define ARCH_GET_GS 0x1004 | ||
|
|
||
| extern "C" | ||
| long syscall_SYS_arch_prctl(int code, uintptr_t ptr) { | ||
| switch(code){ | ||
| case ARCH_SET_GS: | ||
| if (UNLIKELY(!ptr)) return -EINVAL; | ||
| x86::CPU::set_gs((void*)ptr); | ||
| break; | ||
| case ARCH_SET_FS: | ||
| if (UNLIKELY(!ptr)) return -EINVAL; | ||
| x86::CPU::set_fs((void*)ptr); | ||
| break; | ||
| case ARCH_GET_GS: | ||
| os::panic("<arch_prctl> GET_GS called!\n"); | ||
| case ARCH_GET_FS: | ||
| os::panic("<arch_prctl> GET_FS called!\n"); | ||
| } | ||
| return 0; | ||
| } |
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
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.
Should we panic here? I don't think we ever want to use the syscall instruction so if some library does (like if libc decides to introduce it in more places) this will loop pretty mysterious. Not a dealbreaker though - this is what the kernel is doing today, so it's fine. But if you agree maybe use the opportunity to fail early.