-
Notifications
You must be signed in to change notification settings - Fork 1
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?
Conversation
This is currently expected to crash most programs since calls into libc from compartments other than pkey = 1 do not change compartments.
| @@ -1,5 +1,9 @@ | |||
| #include "ia2.h" | |||
|
|
|||
| void ia2_compartment_destructor_1(void); | |||
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: Move this somewhere else/generate it from the rewriter.
| project(libia2) | ||
|
|
||
| add_library(libia2 ia2.c init.c threads.c main.c exit.c memory_maps.c thread_name.c) | ||
| add_library(libia2 ia2.c init.c threads.c main.c memory_maps.c thread_name.c) |
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?
| } | ||
|
|
||
| #if IA2_REWRITING | ||
| void *__tls_get_addr(size_t m, size_t offset) { |
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 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 __tls_get_addr in library.c is required for the rewriter to realize it needs to generate callgates to call it from that compartment. It then adds the -Wl,--wrap flag for this function and uses that when linking library.o.
This is currently expected to crash most programs since calls into libc from compartments other than pkey = 1 do not change compartments.