Hi Kostik,

2016-09-22 11:28 GMT+02:00 Konstantin Belousov <kostik...@gmail.com>:
> What do you mean about 'possibility to switch between TLS areas in
> usermode' ? On x86, kernel switches %fs/%gs bases on the context
> switches. There is, indeed, a way to turn off this functionality, but it
> is somewhat unobvious, I have to admit.

On x86 I've solved this by not letting apps have ownership over
%fs/%gs. Instead, they simply assume that they point to some valid
piece of memory. They can only use %fs:0. That way we now effectively
have the ability to adjust TLS from userspace on all architectures

This feature is already used extensively by the userspace emulator,
where you can run CloudABI executables on unmodified operating
systems. You can even run an emulator inside of an emulator inside of
an emulator. Not useful, but a good demonstration/test.

Another thing this could be useful for is that it allows us to
implement something like a simple truss(1) that doesn't depend on
kernel-level tracing facilities, but merely captures system call
invocations inside the process itself.

Ed Schouten <e...@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
svn-src-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to