glibc/sysdeps/unix/sysv/linux/mips
Joseph Myers 47c5adebd2 Correct robust mutex / PI futex kernel assumptions (bug 9894).
This patch continues fixing __ASSUME_* issues in preparation for
moving to a 2.6.32 minimum kernel version by addressing assumptions on
robust mutex and PI futex support availability.  Those assumptions are
bug 9894, but to be clear this patch does not address all the issues
from that bug about wrong version assumptions, only those still
applicable for --enable-kernel=2.6.32 or later (with the expectation
that the move to that minimum kernel will obsolete the other parts of
the bug).  The patch is independent of
<https://sourceware.org/ml/libc-alpha/2014-03/msg00585.html>, my other
pending-review patch preparing for the kernel version change; the two
together complete all the changes I believe are needed in preparation
regarding any macro in sysdeps/unix/sysv/linux/kernel-features.h that
would be affected by such a change.  (I have not checked the
correctness of macros whose conditions are unaffected by such a
change, or macros only defined in other kernel-features.h files.)

As discussed in that bug, robust mutexes and PI futexes need
futex_atomic_cmpxchg_inatomic to be implemented, in addition to
certain syscalls needed for robust mutexes (and
architecture-independent kernel pieces for all the features in
question).  That is, as I understand it, they need
futex_atomic_cmpxchg_inatomic to *work* (not return an ENOSYS error).

The issues identified in my analysis relate to ARM, M68K, MicroBlaze,
MIPS and SPARC.

On ARM, whether futex_atomic_cmpxchg_inatomic works depends on the
kernel configuration.  As of 3.13, the condition for *not* working is
CONFIG_CPU_USE_DOMAINS && CONFIG_SMP.  As of 2.6.32 it was simply
CONFIG_SMP that meant the feature was not implemented.  I don't know
if there are any circumstances in which we can say "we can assume a
userspace glibc binary built with these options will never run on a
kernel with the problematic configuration", but at least for now I'm
just undefining the relevant __ASSUME_* macros for ARM.

On M68K, two of the three macros are undefined for kernels before
3.10, but as far as I can see __ASSUME_FUTEX_LOCK_PI is in the same
group needing futex_atomic_cmpxchg_inatomic support and so should be
undefined as well.

On MicroBlaze the required support was added in 2.6.33.

On MIPS, the support depends on cpu_has_llsc in the kernel - that is,
actual hardware LL/SC support (GCC and glibc for MIPS GNU/Linux rely
on the instructions being supported in some way, but it may be kernel
emulation; futex_atomic_cmpxchg_inatomic doesn't work with that
emulation).  The same condition as in GCC for indicating LL/SC support
may not be available is used for undefining the macros in glibc,
__mips == 1 || defined _MIPS_ARCH_R5900.  (Maybe we could in fact
desupport MIPS processors without the hardware support in glibc.)

On SPARC, 32-bit kernels don't support futex_atomic_cmpxchg_inatomic;
__arch64__ || __sparc_v9__ is used as the condition for binaries that
won't run on 32-bit kernels.

This patch is not tested beyond the sanity check of an x86_64 build.

	[BZ #9894]
	* sysdeps/unix/sysv/linux/kernel-features.h
	[__sparc__ && !__arch64__ && !__sparc_v9__]
	(__ASSUME_SET_ROBUST_LIST): Do not define.
	[__sparc__ && !__arch64__ && !__sparc_v9__]
	(__ASSUME_FUTEX_LOCK_PI): Likewise.
	[__sparc__ && !__arch64__ && !__sparc_v9__] (__ASSUME_REQUEUE_PI):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_FUTEX_LOCK_PI): Undefine.
	(__ASSUME_REQUEUE_PI): Likewise.
	(__ASSUME_SET_ROBUST_LIST): Likewise.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	[__LINUX_KERNEL_VERSION < 0x030a00] (__ASSUME_FUTEX_LOCK_PI):
	Undefine.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	[__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_FUTEX_LOCK_PI):
	Likewise.
	[__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_REQUEUE_PI):
	Likewise.
	[__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_SET_ROBUST_LIST):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	[__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_FUTEX_LOCK_PI):
	Undefine.
	[__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_REQUEUE_PI): Likewise.
	[__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_SET_ROBUST_LIST):
	Likewise.
2014-03-31 12:55:18 +00:00
..
bits Fix POSIX namespace for <bits/siginfo.h> (bug 16674). 2014-03-07 23:57:56 +00:00
mips32 Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
mips64 Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
nptl Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
sys Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
____longjmp_chk.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
_test_and_set.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
brk.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
clone.S Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
configure Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
configure.ac Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
dl-cache.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
dl-static.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
getcontext.S Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
getmsg.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
getrlimit64.c Fix -Wundef warnings for _ABI* on MIPS. 2014-03-21 18:21:13 +00:00
getsysstats.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
ipc_priv.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
kernel_rt_sigframe.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
kernel_sigaction.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
kernel_stat.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
kernel_termios.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
kernel-features.h Correct robust mutex / PI futex kernel assumptions (bug 9894). 2014-03-31 12:55:18 +00:00
ldsodefs.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
libc-abis Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
makecontext.S Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
Makefile Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
pipe.S Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
pread64.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
pread.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
profil-counter.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
putmsg.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
pwrite64.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
pwrite.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
readelflib.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
register-dump.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
setcontext.S Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
setrlimit64.c Fix -Wundef warnings for _ABI* on MIPS. 2014-03-21 18:21:13 +00:00
sigaction.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
sigcontextinfo.h Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
swapcontext.S Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
syscalls.list Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
ucontext_i.sym Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
ustat.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
Versions Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
vfork.S Move mips from ports to libc. 2014-02-10 23:30:21 +00:00
xstatconv.c Move mips from ports to libc. 2014-02-10 23:30:21 +00:00