public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only
@ 2020-08-30  9:13 corinna at vinschen dot de
  2020-08-30  9:16 ` [Bug libc/26553] " corinna at vinschen dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: corinna at vinschen dot de @ 2020-08-30  9:13 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 26553
           Summary: mtx_init allows type set to "mtx_recursive" only
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: corinna at vinschen dot de
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Per C11 specs `type' must have one of the following values:

    mtx_plain
    mtx_timed
    mtx_plain | mtx_recursive
    mtx_timed | mtx_recursive

However, this call works successfully, too:

    mtx_init (&mutex, mtx_recursive);

This is used successfully, for instance, in sysdeps/pthread/tst-mtx-basic.c
in glibc's own testsuite.

The reason for this is that mtx_plain is defined with value 0.  Therefore
the mtx_init call can't recognize the problem because mtx_recursive ==
mtx_plain | mtx_recursive.

Note that this doesn't happen in, e.g., FreeBSD, which defines all
mtx_init type flags with a non-0 value.  That's how I found the problem.
I was trying to run glibc's C11 threads testsuite tests on FreeBSD code
under Cygwin and the above mtx_init call failed with thrd_error. 

I don't know how to fix this problem in glibc in a backward-compatible
way, or even if it's worth to fix at all.

Per http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2192.htm, a type value
not defined in the specs just results in "undefined behaviour".  So,
fixing this might be not worth its while, but I thought I should at least
let you know.


Corinna

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/26553] mtx_init allows type set to "mtx_recursive" only
  2020-08-30  9:13 [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only corinna at vinschen dot de
@ 2020-08-30  9:16 ` corinna at vinschen dot de
  2020-08-30 11:40 ` fw at deneb dot enyo.de
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: corinna at vinschen dot de @ 2020-08-30  9:16 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Corinna Vinschen <corinna at vinschen dot de> ---
(In reply to Corinna Vinschen from comment #0)
> This is used successfully, for instance, in sysdeps/pthread/tst-mtx-basic.c
> in glibc's own testsuite.

sysdeps/pthread/tst-mtx-recursive.c, of course, sorry!

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/26553] mtx_init allows type set to "mtx_recursive" only
  2020-08-30  9:13 [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only corinna at vinschen dot de
  2020-08-30  9:16 ` [Bug libc/26553] " corinna at vinschen dot de
@ 2020-08-30 11:40 ` fw at deneb dot enyo.de
  2020-08-30 11:46 ` corinna at vinschen dot de
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fw at deneb dot enyo.de @ 2020-08-30 11:40 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fw at deneb dot enyo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fw at deneb dot enyo.de

--- Comment #2 from Florian Weimer <fw at deneb dot enyo.de> ---
I think we can at least change the test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/26553] mtx_init allows type set to "mtx_recursive" only
  2020-08-30  9:13 [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only corinna at vinschen dot de
  2020-08-30  9:16 ` [Bug libc/26553] " corinna at vinschen dot de
  2020-08-30 11:40 ` fw at deneb dot enyo.de
@ 2020-08-30 11:46 ` corinna at vinschen dot de
  2020-12-21  2:45 ` jscott at posteo dot net
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: corinna at vinschen dot de @ 2020-08-30 11:46 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from Corinna Vinschen <corinna at vinschen dot de> ---
(In reply to Florian Weimer from comment #2)
> I think we can at least change the test.

https://sourceware.org/pipermail/libc-alpha/2020-August/117341.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/26553] mtx_init allows type set to "mtx_recursive" only
  2020-08-30  9:13 [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only corinna at vinschen dot de
                   ` (2 preceding siblings ...)
  2020-08-30 11:46 ` corinna at vinschen dot de
@ 2020-12-21  2:45 ` jscott at posteo dot net
  2020-12-21 11:48 ` adhemerval.zanella at linaro dot org
  2020-12-21 11:51 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jscott at posteo dot net @ 2020-12-21  2:45 UTC (permalink / raw)
  To: glibc-bugs

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

John Scott <jscott at posteo dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jscott at posteo dot net

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/26553] mtx_init allows type set to "mtx_recursive" only
  2020-08-30  9:13 [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only corinna at vinschen dot de
                   ` (3 preceding siblings ...)
  2020-12-21  2:45 ` jscott at posteo dot net
@ 2020-12-21 11:48 ` adhemerval.zanella at linaro dot org
  2020-12-21 11:51 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2020-12-21 11:48 UTC (permalink / raw)
  To: glibc-bugs

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

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Corinna Vinschen from comment #3)
> (In reply to Florian Weimer from comment #2)
> > I think we can at least change the test.
> 
> https://sourceware.org/pipermail/libc-alpha/2020-August/117341.html

This has been pushed upstream, should we close this bug?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/26553] mtx_init allows type set to "mtx_recursive" only
  2020-08-30  9:13 [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only corinna at vinschen dot de
                   ` (4 preceding siblings ...)
  2020-12-21 11:48 ` adhemerval.zanella at linaro dot org
@ 2020-12-21 11:51 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2020-12-21 11:51 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
   Target Milestone|---                         |2.33
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
Fixed for glibc 2.33:

commit 7b51d9f69e742d29b335f4ced07ed0f191b12f82
Author: Corinna Vinschen <vinschen@redhat.com>
Date:   Mon Sep 7 11:42:51 2020 +0200

    C11 threads: Fix inaccuracies in testsuite

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-12-21 11:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30  9:13 [Bug libc/26553] New: mtx_init allows type set to "mtx_recursive" only corinna at vinschen dot de
2020-08-30  9:16 ` [Bug libc/26553] " corinna at vinschen dot de
2020-08-30 11:40 ` fw at deneb dot enyo.de
2020-08-30 11:46 ` corinna at vinschen dot de
2020-12-21  2:45 ` jscott at posteo dot net
2020-12-21 11:48 ` adhemerval.zanella at linaro dot org
2020-12-21 11:51 ` fweimer at redhat dot com

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).