Re: PATCH: glibc 2.3.x and errno

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marcus,

> __errno_location and __h_errno_location are no longer weak symbols
> and so can not be overwritten any longer. The internal glibc systemcall
> wrappers no longer call the functions by reference, but directly.

the real problem is even worse.  glibc has switched to using thread-local
storage for errno (i.e. it is declared as 'extern __thread int errno')
when the tool chain supports the __thread keyword.

This means that C source code compiled against the new headers will
result in assembler code that *directly* accesses a thread-local
variable as defined by the TLS ABI.  In the case of errno, this 
will involve accessing the %gs segment using an offset from the GOT,
without any function call being performed.  (errno is defined to use 
the initial-exec TLS storage model.)

The __errno_location routine is provided only for backwards
compatibility reasons, it is no longer guaranteed that every
access to errno calls it.  Thus, if you overwrite the implementation
of __errno_location, you will only catch *some* errno accesses,
not all of them ...


Bye,
Ulrich (who has just implemented TLS for s390 ;-/)

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux