Page MenuHomeFreeBSD

amd64: Cleanups to setting TLS registers for Linux binaries.
ClosedPublic

Authored by jhb on Mar 3 2021, 12:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 16 2024, 10:20 PM
Unknown Object (File)
Mar 16 2024, 10:16 PM
Unknown Object (File)
Mar 16 2024, 10:16 PM
Unknown Object (File)
Mar 16 2024, 10:16 PM
Unknown Object (File)
Mar 16 2024, 9:59 PM
Unknown Object (File)
Feb 8 2024, 12:39 AM
Unknown Object (File)
Feb 7 2024, 12:49 AM
Unknown Object (File)
Jan 2 2024, 3:50 AM
Subscribers

Details

Summary
  • Use update_pcb_bases() when updating FS or GS base addresses to permit use of FSBASE and GSBASE in Linux processes. This also sets PCB_FULL_IRET. linux32 was setting PCB_32BIT which should be a no-op (exec sets it).
  • Remove write-only variables to construct unused segment descriptors for linux32.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Mar 3 2021, 12:12 AM
kib added inline comments.
sys/amd64/linux/linux_machdep.c
293

why not update_pcb_bases() ? This name more cleanly reflects the intent there, IMO.

This revision is now accepted and ready to land.Mar 3 2021, 3:33 AM
sys/amd64/linux/linux_machdep.c
293

why not update_pcb_bases() ? This name more cleanly reflects the intent there, IMO.

Hmm, there are several other places that all use PCB_FULL_IRET already in the Linuxulator. Probably they should all switch to this?

sys/amd64/linux/linux_machdep.c
293

I looked over them.

I think that only two uses of PCB_FULL_IRET in linux_arch_prctl() are about handling fs/gsbases, and can be changed for clarity. All uses in linux_sysvec.c do want full register file reload because they modify all registers.

  • Use update_pcbbases() in a few more places.
This revision now requires review to proceed.Mar 11 2021, 10:33 PM
This revision is now accepted and ready to land.Mar 12 2021, 12:57 PM