Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Sep 2016 14:54:44 +0200
From:      Ed Schouten <ed@nuxi.nl>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r306162 - in head/sys/arm: arm include
Message-ID:  <CABh_MKmgoh8p3=RXzQgZAosjE6rudP0t2O-rLg8k6NSPucMcdg@mail.gmail.com>
In-Reply-To: <20160922092808.GR38409@kib.kiev.ua>
References:  <201609220815.u8M8F0Lo096297@repo.freebsd.org> <20160922092808.GR38409@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Kostik,

2016-09-22 11:28 GMT+02:00 Konstantin Belousov <kostikbel@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@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABh_MKmgoh8p3=RXzQgZAosjE6rudP0t2O-rLg8k6NSPucMcdg>