]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix h_errno namespace (bug 18520).
authorJoseph Myers <joseph@codesourcery.com>
Fri, 12 Jun 2015 10:10:18 +0000 (10:10 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 12 Jun 2015 10:10:18 +0000 (10:10 +0000)
The 2008 edition of POSIX removed h_errno, but some functions still
bring in references to the h_errno external symbol.  As this symbol is
not a part of the public ABI (only __h_errno_location is), this patch
fixes this by renaming the GLIBC_PRIVATE TLS symbol to __h_errno.

Tested for x86_64 and x86 (testsuite, and comparison of installed
shared libraries).  Disassembly of all shared libraries using h_errno
changes because of the renaming (and changes to associated TLS / GOT
offsets in some cases); disassembly of libpthread on x86_64 changes
more substantially because the enlargement of .dynsym affects
subsequent addresses.

[BZ #18520]
* inet/herrno.c (h_errno): Rename to __h_errno.
(__libc_h_errno): Define as alias of __h_errno not h_errno.
* include/netdb.h [IS_IN_LIB && !IS_IN (libc)] (h_errno): Define
to __h_errno instead of h_errno.
* nptl/herrno.c (h_errno): Rename to __h_errno.
(__h_errno_location): Refer to __h_errno not h_errno.
* resolv/Versions (h_errno): Rename to __h_errno.
* conform/Makefile (test-xfail-XOPEN2K8/grp.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K8/pwd.h/linknamespace): Likewise.

ChangeLog
NEWS
conform/Makefile
include/netdb.h
inet/herrno.c
nptl/herrno.c
resolv/Versions

index 1e0ec7ef8a055fca7ea7ed83d140016090935add..6ca1c205f034a7296b2b3965ed7fb1b79ff5a86d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2015-06-12  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #18520]
+       * inet/herrno.c (h_errno): Rename to __h_errno.
+       (__libc_h_errno): Define as alias of __h_errno not h_errno.
+       * include/netdb.h [IS_IN_LIB && !IS_IN (libc)] (h_errno): Define
+       to __h_errno instead of h_errno.
+       * nptl/herrno.c (h_errno): Rename to __h_errno.
+       (__h_errno_location): Refer to __h_errno not h_errno.
+       * resolv/Versions (h_errno): Rename to __h_errno.
+       * conform/Makefile (test-xfail-XOPEN2K8/grp.h/linknamespace):
+       Remove variable.
+       (test-xfail-XOPEN2K8/pwd.h/linknamespace): Likewise.
+
 2015-06-11  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        * configure.ac: More strict check for AVX512 assembler support.
diff --git a/NEWS b/NEWS
index 423d31533362e79d6af459ac15688aab952609ad..9d1ce0d53fabdd76337fef6ecce872730aa56f3d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,8 @@ Version 2.22
   18111, 18116, 18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210,
   18211, 18217, 18220, 18221, 18234, 18244, 18247, 18287, 18319, 18324,
   18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434, 18444,
-  18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498, 18507.
+  18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498, 18507,
+  18520.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 8e76bcb302fd8cf48c42d6eb35171c9794c863c2..c259d34cb45cdd54a9f4ffe81eb27ef6dc26b157 100644 (file)
@@ -373,7 +373,5 @@ test-xfail-POSIX2008/grp.h/linknamespace = yes
 test-xfail-POSIX2008/netdb.h/linknamespace = yes
 test-xfail-POSIX2008/semaphore.h/linknamespace = yes
 test-xfail-XOPEN2K8/fmtmsg.h/linknamespace = yes
-test-xfail-XOPEN2K8/grp.h/linknamespace = yes
 test-xfail-XOPEN2K8/netdb.h/linknamespace = yes
-test-xfail-XOPEN2K8/pwd.h/linknamespace = yes
 test-xfail-XOPEN2K8/syslog.h/linknamespace = yes
index 9e64a15ff7fe460e8c37b59f5490205297c7bffa..e1f051d16ace7563aee78f81e9653c5b2a04456a 100644 (file)
@@ -9,7 +9,7 @@
 #  if IS_IN (libc)
 #   define h_errno __libc_h_errno
 #  else
-#   define h_errno h_errno     /* For #ifndef h_errno tests.  */
+#   define h_errno __h_errno
 #  endif
 extern __thread int h_errno attribute_tls_model_ie;
 # endif /* IS_IN_LIB */
index 829f032e47d02ed636c189c8e95c3bbf77c3645a..672a91d40765a7bb2eb45c809df16e748b3d4a41 100644 (file)
@@ -24,7 +24,7 @@
 /* We need to have the error status variable of the resolver
    accessible in the libc.  */
 
-__thread int h_errno;
-extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno")))
+__thread int __h_errno;
+extern __thread int __libc_h_errno __attribute__ ((alias ("__h_errno")))
   attribute_hidden;
 #define h_errno __libc_h_errno
index 281c47eca724dc067bae1141a641617f24d70e70..9c915280951a4d147bc41017e27cf4ac498929d9 100644 (file)
 
 /* We need to have the error status variable of the resolver
    accessible in the libc.  */
-extern __thread int h_errno;
+extern __thread int __h_errno;
 
 
 /* When threaded, h_errno may be a per-thread variable.  */
 int *
 __h_errno_location (void)
 {
-  return &h_errno;
+  return &__h_errno;
 }
index 04072acd338321d70ac0dfd15870a0c200385182..e561bce1a47ca3daad22a93c9e2d0e13083a45a0 100644 (file)
@@ -24,7 +24,7 @@ libc {
   GLIBC_PRIVATE {
     __gai_sigqueue;
 
-    h_errno; __resp;
+    __h_errno; __resp;
 
     __res_maybe_init; __res_iclose;
   }