svn commit: r306162 - in head/sys/arm: arm include

Ed Schouten ed at nuxi.nl
Thu Sep 22 12:54:46 UTC 2016


Hi Kostik,

2016-09-22 11:28 GMT+02:00 Konstantin Belousov <kostikbel at 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
freely.

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 <ed at nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717


More information about the svn-src-all mailing list