From: Mathieu Desnoyers Date: Fri, 4 Dec 2015 07:03:02 +0000 (+0100) Subject: Fix: compat_futex should work-around futex signal-restart kernel bug X-Git-Tag: v0.10.0~57 X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=commitdiff_plain;h=b2633d211b186cb201be327ded53ecf523ecf0bd;hp=b2633d211b186cb201be327ded53ecf523ecf0bd Fix: compat_futex should work-around futex signal-restart kernel bug When testing liburcu on a 3.18 Linux kernel, 2-core MIPS (cpu model : Ingenic JZRISC V4.15 FPU V0.0), we notice that a blocked sys_futex FUTEX_WAIT returns -1, errno=ENOSYS when interrupted by a SA_RESTART signal handler. This spurious ENOSYS behavior causes hangs in liburcu 0.9.x. Running a MIPS 3.18 kernel under a QEMU emulator exhibits the same behavior. This might affect earlier kernels. This issue appears to be fixed in 3.19 since commit e967ef022 "MIPS: Fix restart of indirect syscalls", but nevertheless, we should try to handle this kernel bug more gracefully than a user-space hang due to unexpected spurious ENOSYS return value. Therefore, fallback on the "async-safe" version of compat_futex in those situations where FUTEX_WAIT returns ENOSYS. This async-safe fallback has the nice property of being OK to use concurrently with other FUTEX_WAKE and FUTEX_WAIT futex() calls, because it's simply a busy-wait scheme. The 4.2 kernel on parisc, and likely newer kernels too, are also affected by a similar issue. Signed-off-by: Mathieu Desnoyers CC: Michael Jeanson CC: Paul E. McKenney CC: Ralf Baechle CC: linux-mips@linux-mips.org CC: linux-kernel@vger.kernel.org CC: "James E.J. Bottomley" CC: Helge Deller CC: linux-parisc@vger.kernel.org ---