Skip to content

FSGSBASE and user-controlled TLS

Jacob Lorentzon requested to merge 4lDO2/kernel:fsgsbase into master

This MR lets userspace manually modify FSBASE and GSBASE on older CPUs via a restricted version of proc:, thisproc:. Newer CPUs can instead use wrfsbase/wrgsbase and rdfsbase/rdgsbase, and those instructions are enabled if detected.

Additionally, this removes all kernel handling of thread-local storage, and just like Linux does, lets userspace handle TLS on their own. For this, every time fexec() is run, there will be a new grant (which the program can later funmap if desired) pointed to by AT_PHDR (and AT_PHENT and AT_PHNUM for indexing ELF segments).

Depends on syscall!67 (merged) and relibc!340 (merged).

Edited by Jacob Lorentzon

Merge request reports