-
Notifications
You must be signed in to change notification settings - Fork 2
WIP runtime/libia2: Protect RW segments for libc and ld.so #628
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| #include "ia2.h" | ||
|
|
||
| void ia2_compartment_destructor_1(void); | ||
|
Contributor
Author
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. TODO: Move this somewhere else/generate it from the rewriter. |
||
| void __wrap_ia2_compartment_destructor_1(void) { | ||
| ia2_compartment_destructor_1(); | ||
| } | ||
| int __real_main(int argc, char **argv); | ||
|
|
||
| /* Stores the stack pointer to return to after main() is called. */ | ||
|
|
@@ -46,10 +50,10 @@ __asm__( | |
| // Save return value | ||
| "mov %rax,%r10\n" | ||
| // Switch pkey to untrusted compartment | ||
| "xor %ecx,%ecx\n" | ||
| "xor %edx,%edx\n" | ||
| "mov_pkru_eax 0\n" | ||
| "wrpkru\n" | ||
| //"xor %ecx,%ecx\n" | ||
| //"xor %edx,%edx\n" | ||
| //"mov_pkru_eax 0\n" | ||
| //"wrpkru\n" | ||
| // Restore return value | ||
| "mov %r10,%rax\n" | ||
| "popq %rbp\n" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,3 +70,9 @@ Test(tls_protected, no_access_lib_secret) { | |
| Test(tls_protected, access_lib_secret) { | ||
| run_test(true); | ||
| } | ||
|
|
||
| #if IA2_REWRITING | ||
| void *__tls_get_addr(size_t m, size_t offset) { | ||
|
Contributor
Author
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. This could be autogenerated by the rewriter w/o requiring that it appears in user-code, but this was the easiest way to test this. This function is defined in ld.so which is in the same compartment as main.c and the call to |
||
| return NULL; | ||
| } | ||
| #endif | ||
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.
TODO: Do we want to keep the option of exiting the process in the untrusted compartment?