public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/17561] New: GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock()
@ 2014-11-06 19:57 aaro.koskinen at iki dot fi
  2014-11-06 20:01 ` [Bug nptl/17561] " aaro.koskinen at iki dot fi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: aaro.koskinen at iki dot fi @ 2014-11-06 19:57 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 17561
           Summary: GLIBC 2.20 results in SIGILL on x86_64 with double
                    pthread_rwlock_unlock()
           Product: glibc
           Version: 2.20
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: aaro.koskinen at iki dot fi
                CC: drepper.fsp at gmail dot com

The following program fails with illegal instruction on x86_64 on HW where
_xend() is not supported (even if it would the behaviour is not probably
correct):

$ cat foo.c
#include <pthread.h>
#include <stdio.h>

int main(void)
{
        pthread_rwlock_t _lock;

        pthread_rwlock_init(&_lock, 0);
        pthread_rwlock_wrlock(&_lock);
        pthread_rwlock_unlock(&_lock);
        pthread_rwlock_unlock(&_lock);
        pthread_rwlock_destroy(&_lock);
        return 0;
}
$ gcc foo.c -lpthread
$ ./a.out
Illegal instruction

This is caused by __pthread_rwlock_unlock() -> ELIDE_UNLOCK() -> _xend()

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


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

* [Bug nptl/17561] GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock()
  2014-11-06 19:57 [Bug nptl/17561] New: GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock() aaro.koskinen at iki dot fi
@ 2014-11-06 20:01 ` aaro.koskinen at iki dot fi
  2014-11-06 20:54 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: aaro.koskinen at iki dot fi @ 2014-11-06 20:01 UTC (permalink / raw)
  To: glibc-bugs

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

Aaro Koskinen <aaro.koskinen at iki dot fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-linux-gnu
               Host|                            |x86_64-linux-gnu
              Build|                            |x86_64-linux-gnu

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


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

* [Bug nptl/17561] GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock()
  2014-11-06 19:57 [Bug nptl/17561] New: GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock() aaro.koskinen at iki dot fi
  2014-11-06 20:01 ` [Bug nptl/17561] " aaro.koskinen at iki dot fi
@ 2014-11-06 20:54 ` fweimer at redhat dot com
  2014-11-06 21:03 ` aaro.koskinen at iki dot fi
  2014-11-07  0:41 ` andi-bz at firstfloor dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fweimer at redhat dot com @ 2014-11-06 20:54 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |fweimer at redhat dot com
         Resolution|---                         |INVALID
              Flags|                            |security-

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
This test case is invalid.  Calling pthread_rwlock_unlock on an rwlock which is
not locked is undefined.

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


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

* [Bug nptl/17561] GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock()
  2014-11-06 19:57 [Bug nptl/17561] New: GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock() aaro.koskinen at iki dot fi
  2014-11-06 20:01 ` [Bug nptl/17561] " aaro.koskinen at iki dot fi
  2014-11-06 20:54 ` fweimer at redhat dot com
@ 2014-11-06 21:03 ` aaro.koskinen at iki dot fi
  2014-11-07  0:41 ` andi-bz at firstfloor dot org
  3 siblings, 0 replies; 5+ messages in thread
From: aaro.koskinen at iki dot fi @ 2014-11-06 21:03 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from Aaro Koskinen <aaro.koskinen at iki dot fi> ---
Ok, such programs can be considered broken.

I was also pointed a workaround if you still need to run such:
https://github.com/andikleen/tsx-tools/blob/master/ignore-xend.c

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


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

* [Bug nptl/17561] GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock()
  2014-11-06 19:57 [Bug nptl/17561] New: GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock() aaro.koskinen at iki dot fi
                   ` (2 preceding siblings ...)
  2014-11-06 21:03 ` aaro.koskinen at iki dot fi
@ 2014-11-07  0:41 ` andi-bz at firstfloor dot org
  3 siblings, 0 replies; 5+ messages in thread
From: andi-bz at firstfloor dot org @ 2014-11-07  0:41 UTC (permalink / raw)
  To: glibc-bugs

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

Andi Kleen <andi-bz at firstfloor dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andi-bz at firstfloor dot org

--- Comment #3 from Andi Kleen <andi-bz at firstfloor dot org> ---
Yes don't do that as it's undefined.

In theory it would be possible to put a workaround into glibc for it, but it
would make the unlock path slower and so far it was not deemed needed for this
undefined case.

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


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

end of thread, other threads:[~2014-11-07  0:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-06 19:57 [Bug nptl/17561] New: GLIBC 2.20 results in SIGILL on x86_64 with double pthread_rwlock_unlock() aaro.koskinen at iki dot fi
2014-11-06 20:01 ` [Bug nptl/17561] " aaro.koskinen at iki dot fi
2014-11-06 20:54 ` fweimer at redhat dot com
2014-11-06 21:03 ` aaro.koskinen at iki dot fi
2014-11-07  0:41 ` andi-bz at firstfloor dot org

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