This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/18726] New: Futexes are broken on MIPS/n32
- From: "oss at malat dot biz" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 27 Jul 2015 13:30:52 +0000
- Subject: [Bug nptl/18726] New: Futexes are broken on MIPS/n32
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=18726
Bug ID: 18726
Summary: Futexes are broken on MIPS/n32
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: nptl
Assignee: unassigned at sourceware dot org
Reporter: oss at malat dot biz
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Created attachment 8454
--> https://sourceware.org/bugzilla/attachment.cgi?id=8454&action=edit
Sample program illustrating the issue
Hi,
there is a problem in generic syscall implementation, which breaks futexes,
which break pthread_* functions using them.
The problem is in
sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
file in the macro
#define ARGIFY(X) ((long long) (__typeof__ ((X) - (X))) (X))
which is then used to load syscall arguments into registers. I assume its
purpose is to avoid sign extension of an argument if it's of unsigned type,
which seems to be wrong. The CPU always does sign extensions while it's loading
32bit integers and this is expected by Linux and GCC. The problem arises, if an
argument passed this way and a loaded value are compared. Even if they are the
same, comparison fails because one of them is sign extended and the second one
isn't.
This can be fixed by replacing ARGIFY with a simple cast to long, however it
wouldn't work for a syscall, which takes 64bit argument, but I do not know
about a syscall, which would take such an argument on 32bit platform (e.g.
llseek splits its arguments into two 32bit ones). Why this macro was
introduced?
See the attached code, which illustrates the problem.
The issue doesn't arise if futex is called trough syscall().
--
You are receiving this mail because:
You are on the CC list for the bug.