[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r9978 - in /fsf/trunk/libc: ./ nptl/ nptl/sysdeps/pthread/ resolv/
- To: commits@xxxxxxxxxx
- Subject: [commits] r9978 - in /fsf/trunk/libc: ./ nptl/ nptl/sysdeps/pthread/ resolv/
- From: eglibc@xxxxxxxxxx
- Date: Sat, 06 Mar 2010 08:03:09 -0000
Author: eglibc
Date: Sat Mar 6 00:03:07 2010
New Revision: 9978
Log:
Import glibc-mainline for 2010-03-06
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/allocatestack.c
fsf/trunk/libc/nptl/pthread_create.c
fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c
fsf/trunk/libc/resolv/res_send.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Mar 6 00:03:07 2010
@@ -1,3 +1,9 @@
+2010-02-18 Yann Droneaud <yann@xxxxxxxxxxx>
+
+ * resolv/res_send.c: Fixed DEBUG statements.
+ Moved tmpbuf declaration to block beginning and
+ updated pointer names used in multiple DprintQ() calls
+
2010-02-18 H.J. Lu <hongjiu.lu@xxxxxxxxx>
* config.make.in (config-asflags-i686): Define.
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sat Mar 6 00:03:07 2010
@@ -1,3 +1,14 @@
+2010-03-05 Andreas Schwab <schwab@xxxxxxxxxx>
+ Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * allocatestack.c (setxid_mark_thread): Delay handling of thread if
+ it is creating a thread or it is just being created.
+ * pthread_create.c (start_thread): Wake setxid thread if it is
+ waiting.
+ (__pthread_create_2_1): Initialize setxid_futex.
+ * sysdeps/pthread/createthread.c (do_clone): Wake setxid thread if it
+ is waiting.
+
2010-01-15 Ulrich Drepper <drepper@xxxxxxxxxx>
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
Modified: fsf/trunk/libc/nptl/allocatestack.c
==============================================================================
--- fsf/trunk/libc/nptl/allocatestack.c (original)
+++ fsf/trunk/libc/nptl/allocatestack.c Sat Mar 6 00:03:07 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -380,7 +380,7 @@
- TLS_TCB_SIZE - adj);
#elif TLS_DTV_AT_TP
pd = (struct pthread *) (((uintptr_t) attr->stackaddr
- - __static_tls_size - adj)
+ - __static_tls_size - adj)
- TLS_PRE_TCB_SIZE);
#endif
@@ -546,7 +546,7 @@
#ifndef __ASSUME_PRIVATE_FUTEX
/* The thread must know when private futexes are supported. */
pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
- header.private_futex);
+ header.private_futex);
#endif
#ifdef NEED_DL_SYSINFO
@@ -968,6 +968,13 @@
setxid_mark_thread (struct xid_command *cmdp, struct pthread *t)
{
int ch;
+
+ /* Wait until this thread is cloned. */
+ if (t->setxid_futex == -1
+ && ! atomic_compare_and_exchange_bool_acq (&t->setxid_futex, -2, -1))
+ do
+ lll_futex_wait (&t->setxid_futex, -2, LLL_PRIVATE);
+ while (t->setxid_futex == -2);
/* Don't let the thread exit before the setxid handler runs. */
t->setxid_futex = 0;
Modified: fsf/trunk/libc/nptl/pthread_create.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_create.c (original)
+++ fsf/trunk/libc/nptl/pthread_create.c Sat Mar 6 00:03:07 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007,2008,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007,2008,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -239,6 +239,10 @@
/* Initialize resolver state pointer. */
__resp = &pd->res;
+ /* Allow setxid from now onwards. */
+ if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0) == -2, 0))
+ lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
+
#ifdef __NR_set_robust_list
# ifndef __ASSUME_SET_ROBUST_LIST
if (__set_robust_list_avail >= 0)
@@ -538,6 +542,9 @@
}
}
+ /* Don't allow setxid until cloned. */
+ pd->setxid_futex = -1;
+
/* Pass the descriptor to the caller. */
*newthread = (pthread_t) pd;
Modified: fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c Sat Mar 6 00:03:07 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -28,7 +28,7 @@
#include "kernel-features.h"
-#define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
+#define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
/* Unless otherwise specified, the thread "register" is going to be
initialized with a pointer to the TCB. */
@@ -72,8 +72,14 @@
that cares whether the thread count is correct. */
atomic_increment (&__nptl_nthreads);
- if (ARCH_CLONE (fct, STACK_VARIABLES_ARGS, clone_flags,
- pd, &pd->tid, TLS_VALUE, &pd->tid) == -1)
+ int rc = ARCH_CLONE (fct, STACK_VARIABLES_ARGS, clone_flags,
+ pd, &pd->tid, TLS_VALUE, &pd->tid);
+
+ /* Allow setxid from now onwards. */
+ if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0) == -2, 0))
+ lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
+
+ if (__builtin_expect (rc == -1, 0))
{
atomic_decrement (&__nptl_nthreads); /* Oops, we lied for a second. */
Modified: fsf/trunk/libc/resolv/res_send.c
==============================================================================
--- fsf/trunk/libc/resolv/res_send.c (original)
+++ fsf/trunk/libc/resolv/res_send.c Sat Mar 6 00:03:07 2010
@@ -490,6 +490,9 @@
for (try = 0; try < statp->retry; try++) {
for (ns = 0; ns < MAXNS; ns++)
{
+#ifdef DEBUG
+ char tmpbuf[40];
+#endif
struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
if (nsap == NULL)
@@ -530,9 +533,6 @@
}
#endif
-#ifdef DEBUG
- char tmpbuf[40];
-#endif
Dprint(statp->options & RES_DEBUG,
(stdout, ";; Querying server (# %d) address = %s\n",
ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr,
@@ -575,11 +575,12 @@
(statp->pfcode & RES_PRF_REPLY),
(stdout, "%s", ""),
ans, (resplen > anssiz) ? anssiz : resplen);
- if (buf2 != NULL)
+ if (buf2 != NULL) {
DprintQ((statp->options & RES_DEBUG) ||
(statp->pfcode & RES_PRF_REPLY),
(stdout, "%s", ""),
*ansp2, (*resplen2 > *nansp2) ? *nansp2 : *resplen2);
+ }
/*
* If we have temporarily opened a virtual circuit,
@@ -883,7 +884,7 @@
(statp->pfcode & RES_PRF_REPLY),
(stdout, ";; old answer (unexpected):\n"),
*thisansp,
- (rlen > *thisanssiz) ? *thisanssiz: rlen);
+ (rlen > *thisanssizp) ? *thisanssizp: rlen);
goto read_len;
}
@@ -1186,7 +1187,7 @@
*/
Dprint(statp->options & RES_DEBUG,
(stdout, ";; undersized: %d\n",
- *thisresplen));
+ *thisresplenp));
*terrno = EMSGSIZE;
goto err_out;
}
@@ -1201,8 +1202,8 @@
(statp->pfcode & RES_PRF_REPLY),
(stdout, ";; old answer:\n"),
thisansp,
- (*thisresplen > *thisanssiz)
- ? *thisanssiz : *thisresplen);
+ (*thisresplenp > *thisanssizp)
+ ? *thisanssizp : *thisresplenp);
goto wait;
}
if (!(statp->options & RES_INSECURE1) &&
@@ -1216,8 +1217,8 @@
(statp->pfcode & RES_PRF_REPLY),
(stdout, ";; not our server:\n"),
thisansp,
- (*thisresplen > *thisanssiz)
- ? *thisanssiz : *thisresplen);
+ (*thisresplenp > *thisanssizp)
+ ? *thisanssizp : *thisresplenp);
goto wait;
}
#ifdef RES_USE_EDNS0
@@ -1232,9 +1233,9 @@
DprintQ(statp->options & RES_DEBUG,
(stdout,
"server rejected query with EDNS0:\n"),
- thisans,
- (*thisresplen > *thisanssiz)
- ? *thisanssiz : *thisresplen);
+ thisansp,
+ (*thisresplenp > *thisanssizp)
+ ? *thisanssizp : *thisresplenp);
/* record the error */
statp->_flags |= RES_F_EDNS0ERR;
goto err_out;
@@ -1258,8 +1259,8 @@
(statp->pfcode & RES_PRF_REPLY),
(stdout, ";; wrong query name:\n"),
thisansp,
- (*thisresplen > *thisanssiz)
- ? *thisanssiz : *thisresplen);
+ (*thisresplenp > *thisanssizp)
+ ? *thisanssizp : *thisresplenp);
goto wait;
}
if (anhp->rcode == SERVFAIL ||
@@ -1268,8 +1269,8 @@
DprintQ(statp->options & RES_DEBUG,
(stdout, "server rejected query:\n"),
thisansp,
- (*thisresplen > *thisanssiz)
- ? *thisanssiz : *thisresplen);
+ (*thisresplenp > *thisanssizp)
+ ? *thisanssizp : *thisresplenp);
if (recvresp1 || (buf2 != NULL && recvresp2))
return resplen;
@@ -1295,8 +1296,8 @@
DprintQ(statp->options & RES_DEBUG,
(stdout, "referred query:\n"),
thisansp,
- (*thisresplen > *thisanssiz)
- ? *thisanssiz : *thisresplen);
+ (*thisresplenp > *thisanssizp)
+ ? *thisanssizp : *thisresplenp);
goto next_ns;
}
if (!(statp->options & RES_IGNTC) && anhp->tc) {