Bug 47731 - [4.6 Regression] futex_wait broken on Linux
Summary: [4.6 Regression] futex_wait broken on Linux
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgomp (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-14 09:53 UTC by Jakub Jelinek
Modified: 2011-02-14 15:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-02-14 09:53:45


Attachments
gcc46-pr47731.patch (646 bytes, patch)
2011-02-14 09:56 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2011-02-14 09:53:10 UTC
As reported in http://gcc.gnu.org/ml/fortran/2011-02/msg00108.html
futex_wait is very much broken since
http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00256.html
There are two problems:
1) the arm futex.h version is broken, as it doesn't pass NULL as the timeout
   parameter to FUTEX_WAIT or FUTEX_WAIT|FUTEX_PRIVATE.  This means the
   parameter contains random garbage, if it happens to be NULL, fine, otherwise
   it could contain some valid pointer and risk that the futex times out or
   it can contain invalid address and thus the syscall can EFAULT right away.
2) as wait.h includes "futex.h", the CPU specific futex.h versions are no longer
   used.
Comment 1 Jakub Jelinek 2011-02-14 09:56:48 UTC
Created attachment 23334 [details]
gcc46-pr47731.patch

Untested fix.
Comment 2 Jakub Jelinek 2011-02-14 15:08:29 UTC
Author: jakub
Date: Mon Feb 14 15:08:23 2011
New Revision: 170133

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170133
Log:
	PR libgomp/47731
	* config/linux/futex.h (futex_wait): Pass NULL as timeout argument
	to FUTEX_WAIT futex syscall.
	* config/linux/wait.h: Include <futex.h> instead of "futex.h".

Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/config/linux/futex.h
    trunk/libgomp/config/linux/wait.h
Comment 3 Jakub Jelinek 2011-02-14 15:54:04 UTC
Fixed.