public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* pthread_mutex_lock problem after upgrade to glibc 2.26 (Linux x32)
@ 2017-10-15 10:19 Arkadiusz Miśkiewicz
  2017-10-15 12:04 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Arkadiusz Miśkiewicz @ 2017-10-15 10:19 UTC (permalink / raw)
  To: libc-alpha

Hi,

This code:

#define _GNU_SOURCE 1

#include <stdio.h>
#include <pthread.h>

int main() {

        static pthread_mutex_t rpmsigTbl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
        printf("LOCK1\n");
        pthread_mutex_lock(&rpmsigTbl_lock);
        printf("LOCK2\n");
        pthread_mutex_lock(&rpmsigTbl_lock);
        printf("LOCK3\n");
}


built on glibc 2.25 on Linux x32 locks when running that binary on glibc 2.26:

$ ./a.out
LOCK1
LOCK2

It was built with "gcc -fopenmp test.c" and -fopenmp seems to be a important factor.
If not using -fopenmp then the problem is gone.

gcc 7.2

Issue doesn't happen on x86_64 or i686, only x32.

Rebuilding the code with glibc 2.26 headers make it work fine on glibc 2.26.

Building binary on 2.26 and using thar binary on 2.25 also locks up
the same way as described above.

Some incompatible change in glibc 2.26?
-- 
Arkadiusz Miśkiewicz, arekm / ( maven.pl | pld-linux.org )

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pthread_mutex_lock problem after upgrade to glibc 2.26 (Linux x32)
  2017-10-15 10:19 pthread_mutex_lock problem after upgrade to glibc 2.26 (Linux x32) Arkadiusz Miśkiewicz
@ 2017-10-15 12:04 ` Andreas Schwab
  2017-10-15 12:56   ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2017-10-15 12:04 UTC (permalink / raw)
  To: Arkadiusz Miśkiewicz; +Cc: libc-alpha

On Okt 15 2017, Arkadiusz Miśkiewicz <arekm@maven.pl> wrote:

> Some incompatible change in glibc 2.26?

The problem is that sysdeps/nptl/bits/thread-shared-types.h in 2.26 uses
#if __WORDSIZE == 64 where sysdeps/x86/bits/pthreadtypes.h in 2.25 uses
#ifdef __x86_64__.  This isn't the same on x32.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pthread_mutex_lock problem after upgrade to glibc 2.26 (Linux x32)
  2017-10-15 12:04 ` Andreas Schwab
@ 2017-10-15 12:56   ` H.J. Lu
  2017-10-15 13:49     ` Arkadiusz Miśkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2017-10-15 12:56 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Arkadiusz Miśkiewicz, GNU C Library

On Sun, Oct 15, 2017 at 5:04 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> On Okt 15 2017, Arkadiusz Miśkiewicz <arekm@maven.pl> wrote:
>
>> Some incompatible change in glibc 2.26?
>
> The problem is that sysdeps/nptl/bits/thread-shared-types.h in 2.26 uses
> #if __WORDSIZE == 64 where sysdeps/x86/bits/pthreadtypes.h in 2.25 uses
> #ifdef __x86_64__.  This isn't the same on x32.
>
> Andreas.

This is a regression.  Please open a glibc bug.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pthread_mutex_lock problem after upgrade to glibc 2.26 (Linux x32)
  2017-10-15 12:56   ` H.J. Lu
@ 2017-10-15 13:49     ` Arkadiusz Miśkiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Arkadiusz Miśkiewicz @ 2017-10-15 13:49 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Andreas Schwab, GNU C Library, Adhemerval Zanella

On Sunday 15 of October 2017, H.J. Lu wrote:
> On Sun, Oct 15, 2017 at 5:04 AM, Andreas Schwab <schwab@linux-m68k.org> 
wrote:
> > On Okt 15 2017, Arkadiusz Miśkiewicz <arekm@maven.pl> wrote:
> >> Some incompatible change in glibc 2.26?
> > 
> > The problem is that sysdeps/nptl/bits/thread-shared-types.h in 2.26 uses
> > #if __WORDSIZE == 64 where sysdeps/x86/bits/pthreadtypes.h in 2.25 uses
> > #ifdef __x86_64__.  This isn't the same on x32.
> > 
> > Andreas.
> 
> This is a regression.  Please open a glibc bug.

Done. https://sourceware.org/bugzilla/show_bug.cgi?id=22298

Regression introduced by commit:

commit eab380d8ec9884e90232dceba24161e63ddd26b8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Apr 4 15:51:10 2017 -0300

    Move shared pthread definitions to common headers

> 
> Thanks.


-- 
Arkadiusz Miśkiewicz, arekm / ( maven.pl | pld-linux.org )

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-15 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-15 10:19 pthread_mutex_lock problem after upgrade to glibc 2.26 (Linux x32) Arkadiusz Miśkiewicz
2017-10-15 12:04 ` Andreas Schwab
2017-10-15 12:56   ` H.J. Lu
2017-10-15 13:49     ` Arkadiusz Miśkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).