This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.16-ports-merge-706-gf6da27e


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  f6da27e53695ad1cc0e2a9490358decbbfdff5e5 (commit)
      from  1f51ee9246b048d8966c36ddd2c26d7e0f927d83 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f6da27e53695ad1cc0e2a9490358decbbfdff5e5

commit f6da27e53695ad1cc0e2a9490358decbbfdff5e5
Author: Peng Haitao <penght@cn.fujitsu.com>
Date:   Mon Nov 19 01:53:07 2012 -0500

    bindresvport() uses two static variables port and startport which are not
    protected. It is not safe when in multithread circumstance.
    
    bindresvport() select a port number from the range 512 to 1023, when in
    multithread circumstance, the port may be 1024. So the static variables will be
    protected.
    
    Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
    Reviewed-by: Carlos O'Donell <carlos@systemhalted.org>

diff --git a/ChangeLog b/ChangeLog
index 63e00ed..8f2f6d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-19  Peng Haitao  <penght@cn.fujitsu.com>
+
+	[BZ #13763]
+	* sunrpc/bindrsvprt.c: Add lock to protect static variable.
+
 2012-11-19  Steve McIntyre  <steve.mcintyre@linaro.org>
 
 	* sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB64): New macro.
diff --git a/NEWS b/NEWS
index 6e8c6c2..d3e64c4 100644
--- a/NEWS
+++ b/NEWS
@@ -12,15 +12,15 @@ Version 2.17
   1349, 3439, 3479, 3665, 5044, 5246, 5298, 5400, 6530, 6778, 6808, 9685,
   9914, 10014, 10038, 10631, 10873, 11438, 11607, 11638, 11741, 12140,
   13412, 13542, 13601, 13603, 13604, 13629, 13679, 13696, 13698, 13717,
-  13741, 13939, 13950, 13952, 13966, 14042, 14047, 14090, 14150, 14151,
-  14152, 14154, 14157, 14166, 14173, 14195, 14237, 14251, 14252, 14283,
-  14298, 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349, 14368,
-  14376, 14417, 14459, 14476, 14477, 14501, 14505, 14510, 14516, 14518,
-  14519, 14530, 14532, 14538, 14543, 14544, 14545, 14557, 14562, 14568,
-  14576, 14579, 14583, 14587, 14595, 14602, 14610, 14621, 14638, 14645,
-  14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694, 14716, 14743,
-  14767, 14783, 14784, 14785, 14793, 14796, 14797, 14801, 14805, 14807,
-  14809, 14811, 14815, 14821, 14824, 14828, 14831, 14838.
+  13741, 13763, 13939, 13950, 13952, 13966, 14042, 14047, 14090, 14150,
+  14151, 14152, 14154, 14157, 14166, 14173, 14195, 14237, 14251, 14252,
+  14283, 14298, 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349,
+  14368, 14376, 14417, 14459, 14476, 14477, 14501, 14505, 14510, 14516,
+  14518, 14519, 14530, 14532, 14538, 14543, 14544, 14545, 14557, 14562,
+  14568, 14576, 14579, 14583, 14587, 14595, 14602, 14610, 14621, 14638,
+  14645, 14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694, 14716,
+  14743, 14767, 14783, 14784, 14785, 14793, 14796, 14797, 14801, 14805,
+  14807, 14809, 14811, 14815, 14821, 14824, 14828, 14831, 14838.
 
 * Port to ARM AArch64 contributed by Linaro.
 
diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c
index d493c9f..e6a1b0b 100644
--- a/sunrpc/bindrsvprt.c
+++ b/sunrpc/bindrsvprt.c
@@ -35,6 +35,12 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <bits/libc-lock.h>
+
+/*
+ * Locks the static variables in this file.
+ */
+__libc_lock_define_initialized (static, lock);
 
 /*
  * Bind a socket to a privileged IP port
@@ -74,6 +80,9 @@ bindresvport (int sd, struct sockaddr_in *sin)
 
   int nports = ENDPORT - startport + 1;
   int endport = ENDPORT;
+
+  __libc_lock_lock (lock);
+
  again:
   for (i = 0; i < nports; ++i)
     {
@@ -94,6 +103,8 @@ bindresvport (int sd, struct sockaddr_in *sin)
       goto again;
     }
 
+  __libc_lock_unlock (lock);
+
   return res;
 }
 libc_hidden_def (bindresvport)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    5 +++++
 NEWS                |   18 +++++++++---------
 sunrpc/bindrsvprt.c |   11 +++++++++++
 3 files changed, 25 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]