handle zero %gs on 64-bit linux when msr and not gdt is used
From derek.br...@gmail.com on July 21, 2010 15:34:18
%fs/%gs are left 0 on linux if SYS_arch_prctl ARCH_SET_{FS,GS} ends up using the msr and not the gdt. DR however assumes that a 0 segment register means it's uninitialized: tls is not yet set up. today MAP_32BIT always results in gdt, so everything works, but this may not always be the case, and we may relax the 32-bit reachability. one solution could be to set %gs very early, before any errno or other refs, to some sentinel (saving the old value somewhere). or perhaps libc independence will eliminate some of the cases of tls access prior to tls init.
Original issue: http://code.google.com/p/dynamorio/issues/detail?id=326