Skip to content

Conversation

@ayrtonm
Copy link
Contributor

@ayrtonm ayrtonm commented Aug 12, 2025

This is currently expected to crash most programs since calls into libc from compartments other than pkey = 1 do not change compartments.

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);
Copy link
Contributor Author

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)
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants