]> sourceware.org Git - glibc.git/commitdiff
Fix mq_notify socket, recv namespace (bug 18546).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:20:08 +0000 (20:20 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:20:08 +0000 (20:20 +0000)
mq_notify (in the 1996 edition of POSIX) brings in references to recv
and socket (not in POSIX until the 2001 edition).  This patch fixes
this by using __recv and __socket, exporting them from libc at version
GLIBC_PRIVATE.

Tested for x86_64 and x86 (testsuite and comparison of installed
stripped shared libraries; PLT / dynamic symbol table changes render
the comparison not particularly useful for libc).

[BZ #18546]
* socket/recv.c (__recv): Use libc_hidden_def.
* socket/socket.c (__socket): Likewise.
* sysdeps/mach/hurd/recv.c (__recv): Likewise.
* sysdeps/mach/hurd/socket.c (__socket): Likewise.
* sysdeps/unix/sysv/linux/generic/recv.c (__recv): Likewise.
* sysdeps/unix/sysv/linux/recv.c (__recv): Use libc_hidden_weak.
* sysdeps/unix/sysv/linux/socket.c (__socket): Use
libc_hidden_def.
* sysdeps/unix/sysv/linux/x86_64/recv.c (__recv): Use
libc_hidden_weak.
* include/sys/socket.h (__socket): Do not use attribute_hidden.
Use libc_hidden_proto.
(__recv): Likewise.
* socket/Versions (libc): Export __recv and __socket at version
GLIBC_PRIVATE.
* sysdeps/unix/sysv/linux/mq_notify.c (helper_thread): Call __recv
instead of recv.
(init_mq_netlink): Call __socket instead of socket.
* conform/Makefile (test-xfail-POSIX/mqueue.h/linknamespace):
Remove variable.

14 files changed:
ChangeLog
NEWS
conform/Makefile
include/sys/socket.h
socket/Versions
socket/recv.c
socket/socket.c
sysdeps/mach/hurd/recv.c
sysdeps/mach/hurd/socket.c
sysdeps/unix/sysv/linux/generic/recv.c
sysdeps/unix/sysv/linux/mq_notify.c
sysdeps/unix/sysv/linux/recv.c
sysdeps/unix/sysv/linux/socket.c
sysdeps/unix/sysv/linux/x86_64/recv.c

index 9e45c2eb3c1c9c442c87fcc4339c9ea301646d3d..2ea4f1a9ab9aaec865b5171c3f52bca399bedd41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2015-06-17  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #18546]
+       * socket/recv.c (__recv): Use libc_hidden_def.
+       * socket/socket.c (__socket): Likewise.
+       * sysdeps/mach/hurd/recv.c (__recv): Likewise.
+       * sysdeps/mach/hurd/socket.c (__socket): Likewise.
+       * sysdeps/unix/sysv/linux/generic/recv.c (__recv): Likewise.
+       * sysdeps/unix/sysv/linux/recv.c (__recv): Use libc_hidden_weak.
+       * sysdeps/unix/sysv/linux/socket.c (__socket): Use
+       libc_hidden_def.
+       * sysdeps/unix/sysv/linux/x86_64/recv.c (__recv): Use
+       libc_hidden_weak.
+       * include/sys/socket.h (__socket): Do not use attribute_hidden.
+       Use libc_hidden_proto.
+       (__recv): Likewise.
+       * socket/Versions (libc): Export __recv and __socket at version
+       GLIBC_PRIVATE.
+       * sysdeps/unix/sysv/linux/mq_notify.c (helper_thread): Call __recv
+       instead of recv.
+       (init_mq_netlink): Call __socket instead of socket.
+       * conform/Makefile (test-xfail-POSIX/mqueue.h/linknamespace):
+       Remove variable.
+
        [BZ #18545]
        * rt/mq_timedreceive.c (mq_timedreceive): Rename to
        __mq_timedreceive and define as alias of __mq_timedreceive.  Use
diff --git a/NEWS b/NEWS
index 004d769b790f1de592da27830e65bb2299f56a53..189280013654f92677d199a1405d65b4ce9a2ffb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,7 +22,7 @@ Version 2.22
   18324, 18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434,
   18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498,
   18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532,
-  18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545.
+  18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index fa25aa810526a867cb07616fb9b2e5123ea23593..52df51ec4b4504ffbcfac03d9c85cd3386f88359 100644 (file)
@@ -346,4 +346,3 @@ test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
 # Unsorted expected failures.
 test-xfail-XPG3/unistd.h/linknamespace = yes
 test-xfail-XPG4/unistd.h/linknamespace = yes
-test-xfail-POSIX/mqueue.h/linknamespace = yes
index 99f60363a133cf9307d41d08df0618789ec01e96..2f4bfd3a9377d6dea299c44e6a6f08ea99ea8aa4 100644 (file)
@@ -8,7 +8,8 @@
    protocol PROTOCOL.  If PROTOCOL is zero, one is chosen automatically.
    Returns a file descriptor for the new socket, or -1 for errors.  */
 extern int __socket (int __domain, int __type,
-                    int __protocol) attribute_hidden;
+                    int __protocol);
+libc_hidden_proto (__socket)
 
 /* Create two new sockets, of type TYPE in domain DOMAIN and using
    protocol PROTOCOL, which are connected to each other, and put file
@@ -64,8 +65,8 @@ libc_hidden_proto (__connect)
 
    This function is a cancellation point and therefore not marked with
    __THROW.  */
-extern ssize_t __recv (int __fd, void *__buf, size_t __n, int __flags)
-     attribute_hidden;
+extern ssize_t __recv (int __fd, void *__buf, size_t __n, int __flags);
+libc_hidden_proto (__recv)
 
 /* Send N bytes of BUF on socket FD to peer at address ADDR (which is
    ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.  */
index dcad32988f8d40ba2b50e04815d51188964ad681..7ce6f43841d26202fa81f0ac5a2e2a27efcb2477 100644 (file)
@@ -39,5 +39,6 @@ libc {
   }
   GLIBC_PRIVATE {
     __sendmmsg;
+    __recv; __socket;
   }
 }
index b1dc1f4f3eb1f484d58769b00a76c4191704c6f3..63a9fcb8b7d0f8aac4a8cb50b1c880f0e80c4663 100644 (file)
@@ -30,6 +30,7 @@ __recv (fd, buf, n, flags)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__recv)
 weak_alias (__recv, recv)
 
 stub_warning (recv)
index b7d4e3b999d782139a3655e04cd3f88d7304c705..9fe8fd99299c4105a7fb382991ae46eb407f03b1 100644 (file)
@@ -32,5 +32,6 @@ __socket (domain, type, protocol)
 }
 
 
+libc_hidden_def (__socket)
 weak_alias (__socket, socket)
 stub_warning (socket)
index 4d10106d5a56cf2ee24f760c4506474c9588200f..358380e7a601520e606e46de649fbded29edbae2 100644 (file)
@@ -60,4 +60,5 @@ __recv (fd, buf, n, flags)
 
   return nread;
 }
+libc_hidden_def (__recv)
 weak_alias (__recv, recv)
index f1f33db21fa9bb9690b04af70da253a1c4c56f02..bb7daddb5ebdd4321ea0dafcda34f66e152a47e6 100644 (file)
@@ -64,4 +64,5 @@ __socket (domain, type, protocol)
   return _hurd_intern_fd (sock, O_IGNORE_CTTY, 1);
 }
 
+libc_hidden_def (__socket)
 weak_alias (__socket, socket)
index 37861721e7f1de5913da1de60d040d2b80a4ec92..324cca6713ae73235bd8cd12978a060b64f655f7 100644 (file)
@@ -28,4 +28,5 @@ __libc_recv (int sockfd, void *buffer, size_t len, int flags)
                         NULL, NULL);
 }
 strong_alias (__libc_recv, __recv)
+libc_hidden_def (__recv)
 weak_alias (__libc_recv, recv)
index 5a27274a3dba7562c2cd31400afa224a4602bfa5..84b9cfa839234f8e66db20628546b96f5372b29f 100644 (file)
@@ -117,8 +117,8 @@ helper_thread (void *arg)
     {
       union notify_data data;
 
-      ssize_t n = recv (netlink_socket, &data, sizeof (data),
-                       MSG_NOSIGNAL | MSG_WAITALL);
+      ssize_t n = __recv (netlink_socket, &data, sizeof (data),
+                         MSG_NOSIGNAL | MSG_WAITALL);
       if (n < NOTIFY_COOKIE_LEN)
        continue;
 
@@ -157,7 +157,7 @@ init_mq_netlink (void)
   if (netlink_socket == -1)
     {
       /* Just a normal netlink socket, not bound.  */
-      netlink_socket = socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 0);
+      netlink_socket = __socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 0);
       /* No need to do more if we have no socket.  */
       if (netlink_socket == -1)
        return;
index d2e80d5a8052d6cb90ae1aafe8e49843bba2e50a..cd2bc1e101e26051c9536a903420851db92f4fd9 100644 (file)
@@ -29,3 +29,4 @@ __libc_recv (int fd, void *buf, size_t len, int flags)
 }
 weak_alias (__libc_recv, recv)
 weak_alias (__libc_recv, __recv)
+libc_hidden_weak (__recv)
index fcb4775c6be9c88881f0078a0d4bb6b4b1745223..3b2c7fea2660d0c7ccb88a98fb5a822bfad87518 100644 (file)
@@ -26,4 +26,5 @@ __socket (int fd, int type, int domain)
 {
   return SOCKETCALL (socket, fd, type, domain);
 }
+libc_hidden_def (__socket)
 weak_alias (__socket, socket)
index 995d11d3f09d8c064023c26abed3947d8d11942a..06fdb7a5e61f6279c3d9b5b3a5a06175fd19f599 100644 (file)
@@ -29,4 +29,5 @@ __libc_recv (int fd, void *buf, size_t n, int flags)
 }
 
 weak_alias (__libc_recv, __recv)
+libc_hidden_weak (__recv)
 weak_alias (__recv, recv)
This page took 0.141628 seconds and 5 git commands to generate.