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)
Thu, Oct 31, 11:59 AM
Unknown Object (File)
Oct 22 2024, 6:43 PM
Unknown Object (File)
Oct 14 2024, 6:05 PM
Unknown Object (File)
Oct 10 2024, 11:15 PM
Unknown Object (File)
Oct 1 2024, 7:50 AM
Unknown Object (File)
Sep 30 2024, 8:29 PM
Unknown Object (File)
Sep 30 2024, 8:29 PM
Unknown Object (File)
Sep 30 2024, 8:29 PM
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