AArch64: Fix handling of nocancel syscall failures
diff mbox

Message ID 1400511234-15112-1-git-send-email-will.newton@linaro.org
State New
Headers show

Commit Message

Will Newton May 19, 2014, 2:53 p.m. UTC
The current code for nocancel syscalls does not do a comparison of
the system call return value. This leads to code being generated
where the b.cs follows the svc instruction directly without setting
the flags on which the branch depends.

ChangeLog:

2014-05-19  Will Newton  <will.newton@linaro.org>

	* sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h (PSEUDO):
	Test the return value of the system call in the nocancel case.
---
 sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h | 1 +
 1 file changed, 1 insertion(+)

Note that I suspect the reason I saw this issue was due to some change in
the way sysdep-cancel.h is getting included which may or may not be
correct.

Comments

Marcus Shawcroft May 20, 2014, 12:16 p.m. UTC | #1
On 19 May 2014 15:53, Will Newton <will.newton@linaro.org> wrote:

> 2014-05-19  Will Newton  <will.newton@linaro.org>
>
>         * sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h (PSEUDO):
>         Test the return value of the system call in the nocancel case.


Looks like an obvious fix. OK /Marcus
Kyle McMartin May 22, 2014, 3:21 a.m. UTC | #2
On Mon, May 19, 2014 at 03:53:54PM +0100, Will Newton wrote:
> 2014-05-19  Will Newton  <will.newton@linaro.org>
> 
> 	* sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h (PSEUDO):
> 	Test the return value of the system call in the nocancel case.
> ---
>  sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> Note that I suspect the reason I saw this issue was due to some change in
> the way sysdep-cancel.h is getting included which may or may not be
> correct.
> 

I hit the same thing this week in Fedora... I ended up bisecting the
change to

commit 2fbdf5339aaeaa423bd661524f7ec7af41fa2606
Author: Roland McGrath <roland@hack.frob.com>
Date:   Wed May 14 11:06:36 2014 -0700

    Consolidate not-cancel.h files.

which makes some sense, since it looks like we may have previously not
been using the correct calls until this patch, and hence why prior to
this, without your fix, we weren't seeing obvious failures in the
test-suite.

regards, Kyle

Patch
diff mbox

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index f6903b5..0e9bef3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -32,6 +32,7 @@ 
   __##syscall_name##_nocancel:						\
     cfi_startproc;							\
     DO_CALL (syscall_name, args);					\
+    cmn x0, 4095;							\
     PSEUDO_RET;								\
     cfi_endproc;							\
     .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	\