From patchwork Fri May 22 17:21:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 475729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BF674140E46 for ; Sat, 23 May 2015 03:21:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=xVJFSA2t; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:cc:subject:in-reply-to :references:message-id:date; q=dns; s=default; b=pOUxGsidzuN62mo bXpmWMYpJNQIgSua+vlAPtJsmjtgNDPWqs4qdqEQPmUzWVy9t2AkhtFmae8CnWoR Lvi6TGOZEPRLezU1qWyteSM2a3OKqeJhGwWRQC9QTO2WFB4IfvIWmK8ZGXOjRFWt EV27oX+kjCSJP1KqnTfJf0sF3fVI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:cc:subject:in-reply-to :references:message-id:date; s=default; bh=tbvicFXmKOXbnn43oUOb9 03mPuQ=; b=xVJFSA2tIdaERxLpY2WUaNBv+X2fwTAe8txbKjVs+7FcaM/yA3VHv s9BfsVt8+hi8T9Uel80btmrMwR6A6PF4xiAUhQ5bZxZDg7BeAtKMH5p/gXGxL2CJ s2Os832EmK5By/c/pdWcmFXvUahaMN0hZ5Oh3CU7HKQ0LTbiem1+4I= Received: (qmail 7431 invoked by alias); 22 May 2015 17:21:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 7415 invoked by uid 89); 22 May 2015 17:21:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: Cc: GNU C Library Subject: Re: Broken MIPS build In-Reply-To: Steve Ellcey's message of Thursday, 21 May 2015 10:37:28 -0700 <1432229848.16668.83.camel@ubuntu-sellcey> References: <1432229848.16668.83.camel@ubuntu-sellcey> Message-Id: <20150522172106.1E1652C3ADB@topped-with-meat.com> Date: Fri, 22 May 2015 10:21:06 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=TpAssS3jfVahWQY6dwAA:9 a=CjuIK1q_8ugA:10 Fixed thusly. I'm not set up to compile for any machine where INTERNAL_SYSCALL_DECL is not a no-op, so I've only build-tested this on x86_64. But it should cover all cases correctly and be much less prone to reintroducing such a bug in the future. Thanks, Roland 2015-05-22 Roland McGrath * nptl/nptl-init.c (__pthread_initialize_minimal_internal): Use a separate INTERNAL_SYSCALL_DECL (err); in a local scope for each INTERNAL_SYSCALL use. diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c index 5b8d931..8a51161 100644 --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -322,19 +322,22 @@ __pthread_initialize_minimal_internal (void) #endif /* Initialize the robust mutex data. */ + { #ifdef __PTHREAD_MUTEX_HAVE_PREV - pd->robust_prev = &pd->robust_head; + pd->robust_prev = &pd->robust_head; #endif - pd->robust_head.list = &pd->robust_head; + pd->robust_head.list = &pd->robust_head; #ifdef __NR_set_robust_list - pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock) - - offsetof (pthread_mutex_t, - __data.__list.__next)); - int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head, - sizeof (struct robust_list_head)); - if (INTERNAL_SYSCALL_ERROR_P (res, err)) + pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock) + - offsetof (pthread_mutex_t, + __data.__list.__next)); + INTERNAL_SYSCALL_DECL (err); + int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head, + sizeof (struct robust_list_head)); + if (INTERNAL_SYSCALL_ERROR_P (res, err)) #endif - set_robust_list_not_avail (); + set_robust_list_not_avail (); + } #ifdef __NR_futex # ifndef __ASSUME_PRIVATE_FUTEX @@ -342,6 +345,7 @@ __pthread_initialize_minimal_internal (void) doing the test once this early is beneficial. */ { int word = 0; + INTERNAL_SYSCALL_DECL (err); word = INTERNAL_SYSCALL (futex, err, 3, &word, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1); if (!INTERNAL_SYSCALL_ERROR_P (word, err)) @@ -362,6 +366,7 @@ __pthread_initialize_minimal_internal (void) is irrelevant. Given that passing six parameters is difficult on some architectures we just pass whatever random value the calling convention calls for to the kernel. It causes no harm. */ + INTERNAL_SYSCALL_DECL (err); word = INTERNAL_SYSCALL (futex, err, 5, &word, FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME | FUTEX_PRIVATE_FLAG, 1, NULL, 0); @@ -414,8 +419,11 @@ __pthread_initialize_minimal_internal (void) # ifdef SIGSETXID __sigaddset (&sa.sa_mask, SIGSETXID); # endif - (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask, - NULL, _NSIG / 8); + { + INTERNAL_SYSCALL_DECL (err); + (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask, + NULL, _NSIG / 8); + } #endif /* Get the size of the static and alignment requirements for the TLS