Re: Fwd: [RESEND RFC PATCH 0/3] Provide fast access to thread specific data

From: Florian Weimer
Date: Fri Sep 10 2021 - 12:38:18 EST


* Peter Oskolkov:

> In short, due to the need to read/write to the userspace from
> non-sleepable contexts in the kernel it seems that we need to have some
> form of per task/thread kernel/userspace shared memory that is pinned,
> similar to what your sys_task_getshared does.

In glibc, we'd also like to have this for PID and TID. Eventually,
rt_sigprocmask without kernel roundtrip in most cases would be very nice
as well. For performance and simplicity in userspace, it would be best
if the memory region could be at the same offset from the TCB for all
threads.

For KTLS, the idea was that the auxiliary vector would contain size and
alignment of the KTLS. Userspace would reserve that memory, register it
with the kernel like rseq (or the robust list pointers), and pass its
address to the vDSO functions that need them. The last part ensures
that the vDSO functions do not need non-global data to determine the
offset from the TCB. Registration is still needed for the caches.

I think previous discussions (in the KTLS and rseq context) did not have
the pinning constraint.

Thanks,
Florian