Page MenuHomeFreeBSD

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

Authored by jhb on Mar 3 2021, 12:12 AM.

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
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; 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
292

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
292

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
292

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