aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/cloudabi64/cloudabi64_util.h
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2016-04-06 11:11:31 +0000
committerEd Schouten <ed@FreeBSD.org>2016-04-06 11:11:31 +0000
commitab8357507077525f79ba675f5b4daf505ab3fa01 (patch)
treeb34a51eca356eac838df8dddb88435653105bae9 /sys/compat/cloudabi64/cloudabi64_util.h
parent1c7c13aa0e7ad180c67fb2dc24964febe4a44bab (diff)
downloadsrc-ab8357507077525f79ba675f5b4daf505ab3fa01.tar.gz
src-ab8357507077525f79ba675f5b4daf505ab3fa01.zip
Make CloudABI's way of doing TLS more friendly to userspace emulators.
We're currently seeing how hard it would be to run CloudABI binaries on operating systems cannot be modified easily (Windows, Mac OS X). The idea is that we want to just run them without any sandboxing. Now that CloudABI executables are PIE, this is already a bit easier, but TLS is still problematic: - CloudABI executables want to write to the %fs, which typically requires extra system calls by the emulator every time it needs to switch between CloudABI's and its own TLS. - If CloudABI executables overwrite the %fs base unconditionally, it also becomes harder for the emulator to store a backup of the old value of %fs. To solve this, let's no longer overwrite %fs, but just %fs:0. As CloudABI's C library does not use a TCB, this space can now be used by an emulator to keep track of its internal state. The executable can now safely overwrite %fs:0, as long as it makes sure that the TCB is copied over to the new TLS area. Ensure that there is an initial TLS area set up when the process starts, only containing a bogus TCB. We don't really care about its contents on FreeBSD. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5836
Notes
Notes: svn path=/head/; revision=297613
Diffstat (limited to 'sys/compat/cloudabi64/cloudabi64_util.h')
-rw-r--r--sys/compat/cloudabi64/cloudabi64_util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/cloudabi64/cloudabi64_util.h b/sys/compat/cloudabi64/cloudabi64_util.h
index dcec70ece5f4..29a90d779821 100644
--- a/sys/compat/cloudabi64/cloudabi64_util.h
+++ b/sys/compat/cloudabi64/cloudabi64_util.h
@@ -42,7 +42,7 @@ extern Elf64_Brandinfo cloudabi64_brand;
register_t *cloudabi64_copyout_strings(struct image_params *);
int cloudabi64_fixup(register_t **, struct image_params *);
-void cloudabi64_thread_setregs(struct thread *,
- const cloudabi64_threadattr_t *);
+int cloudabi64_thread_setregs(struct thread *,
+ const cloudabi64_threadattr_t *, uint64_t);
#endif