[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patches] Fix Thumb-2 aio_suspend cancellation
- To: patches@xxxxxxxxxx
- Subject: [patches] Fix Thumb-2 aio_suspend cancellation
- From: "Joseph S. Myers" <joseph@xxxxxxxxxxxxxxxx>
- Date: Thu, 27 Nov 2008 21:01:23 +0000 (UTC)
I've applied this patch to trunk, 2.9 and 2.8 branches to fix cancellation
in aio_suspend for Thumb-2 (testcases nptl/tst-cancel17 and
nptl/tst-cancelx17). The problem with cancellation in this function and
the fix used are explained in the comment added.
Index: sysdeps/unix/sysv/linux/arm/eabi/nptl/aio_misc.h
===================================================================
--- sysdeps/unix/sysv/linux/arm/eabi/nptl/aio_misc.h (revision 0)
+++ sysdeps/unix/sysv/linux/arm/eabi/nptl/aio_misc.h (revision 0)
@@ -0,0 +1,52 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include_next <aio_misc.h>
+
+#ifdef __thumb2__
+
+#include <errno.h>
+
+/* The Thumb-2 definition of INTERNAL_SYSCALL_RAW has to hide the use
+ of r7 from the compiler because it cannot handle asm clobbering the
+ hard frame pointer. In aio_suspend, GCC does not eliminate the
+ hard frame pointer because the function uses variable-length
+ arrays, so it generates unwind information using r7 as virtual
+ stack pointer. During system calls, when r7 has been saved on the
+ stack, this means the unwind information is invalid. Without extra
+ unwind directives, which would need to cause unwind information for
+ the asm to be generated separately from that for the parts of the
+ function before and after the asm (with three index table entries),
+ it is not possible to represent any temporary change to the virtual
+ stack pointer. Instead, we move the problematic system calls out
+ of line into a function that does not require a frame pointer. */
+
+static __attribute_noinline__ void
+aio_misc_wait (int *resultp,
+ volatile int *futexp,
+ const struct timespec *timeout,
+ int cancel)
+{
+ AIO_MISC_WAIT (*resultp, *futexp, timeout, cancel);
+}
+
+#undef AIO_MISC_WAIT
+#define AIO_MISC_WAIT(result, futex, timeout, cancel) \
+ aio_misc_wait (&result, &futex, timeout, cancel)
+
+#endif
Index: ChangeLog.eglibc
===================================================================
--- ChangeLog.eglibc (revision 7416)
+++ ChangeLog.eglibc (working copy)
@@ -1,3 +1,7 @@
+2008-11-27 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/arm/eabi/nptl/aio_misc.h: New.
+
2008-11-25 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* sysdeps/unix/sysv/linux/arm/sysdep.h (LOAD_ARGS_1, LOAD_ARGS_2,
--
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx