public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] mips/o32: fix internal_syscall5/6/7
@ 2017-08-15 11:53 Aurelien Jarno
  2017-08-15 12:03 ` Andreas Schwab
  2017-08-15 12:17 ` Florian Weimer
  0 siblings, 2 replies; 53+ messages in thread
From: Aurelien Jarno @ 2017-08-15 11:53 UTC (permalink / raw)
  To: libc-alpha; +Cc: Aurelien Jarno

The internal_syscall5/6/7 functions use the stack pointer to store
the 5th and following arguments on the stack. In some cases GCC optimize
out the stack pointer, and thus storing the data to the stack causes a
segmentation fault.

Fix that by declaring the sp register as clobbered. Not sure it is the
best way to do that, but it seems to be enough to force GCC to not
optimize it out.

This fixes the nptl/tst-rwlock15 test on mips/o32.

ChangeLog:
	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
	(internal_syscall5): Add "$29" to the clobber list.
	(internal_syscall6): Likewise.
	(internal_syscall7): Likewise.
---
 ChangeLog                                    | 7 +++++++
 sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 56540f55a1..5d1a088431 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-08-15  Aurelien Jarno <aurelien@aurel32.net>
+
+	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+	(internal_syscall5): Add "$29" to the clobber list.
+	(internal_syscall6): Likewise.
+	(internal_syscall7): Likewise.
+
 2017-08-14  Joseph Myers  <joseph@codesourcery.com>
 
 	* conform/data/sys/wait.h-data (si_value): Do not expect for
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
index e9e3ee7e82..0df32c186f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
@@ -294,7 +294,7 @@
 	: "=r" (__v0), "+r" (__a3)					\
 	: input, "r" (__a0), "r" (__a1), "r" (__a2),			\
 	  "r" ((long) (arg5))						\
-	: __SYSCALL_CLOBBERS);						\
+	: __SYSCALL_CLOBBERS, "$29");					\
 	err = __a3;							\
 	_sys_result = __v0;						\
 	}								\
@@ -327,7 +327,7 @@
 	: "=r" (__v0), "+r" (__a3)					\
 	: input, "r" (__a0), "r" (__a1), "r" (__a2),			\
 	  "r" ((long) (arg5)), "r" ((long) (arg6))			\
-	: __SYSCALL_CLOBBERS);						\
+	: __SYSCALL_CLOBBERS, "$29");					\
 	err = __a3;							\
 	_sys_result = __v0;						\
 	}								\
@@ -361,7 +361,7 @@
 	: "=r" (__v0), "+r" (__a3)					\
 	: input, "r" (__a0), "r" (__a1), "r" (__a2),			\
 	  "r" ((long) (arg5)), "r" ((long) (arg6)), "r" ((long) (arg7))	\
-	: __SYSCALL_CLOBBERS);						\
+	: __SYSCALL_CLOBBERS, "$29");					\
 	err = __a3;							\
 	_sys_result = __v0;						\
 	}								\
-- 
2.13.2

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2017-09-08 11:15 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-15 11:53 [PATCH] mips/o32: fix internal_syscall5/6/7 Aurelien Jarno
2017-08-15 12:03 ` Andreas Schwab
2017-08-15 13:06   ` Adhemerval Zanella
2017-08-15 16:18     ` Aurelien Jarno
2017-08-15 16:26     ` Joseph Myers
2017-08-15 19:34       ` Aurelien Jarno
2017-08-15 19:54         ` Joseph Myers
2017-08-15 20:09           ` Aurelien Jarno
2017-08-15 20:21             ` Joseph Myers
2017-08-15 20:41               ` Aurelien Jarno
2017-08-16 13:26               ` Maciej W. Rozycki
2017-08-16 13:44                 ` Joseph Myers
2017-08-16 14:13                   ` Adhemerval Zanella
2017-08-16 14:47                     ` Maciej W. Rozycki
2017-08-16 14:54                       ` Adhemerval Zanella
2017-08-16 16:12                         ` Aurelien Jarno
2017-08-16 21:08                         ` Aurelien Jarno
2017-08-16 22:11                           ` Maciej W. Rozycki
2017-08-16 15:18                     ` Aurelien Jarno
2017-08-16 21:15                     ` Aurelien Jarno
2017-08-17 13:33                       ` Adhemerval Zanella
2017-08-16 14:32                   ` Maciej W. Rozycki
2017-08-16 14:47                     ` Joseph Myers
2017-08-17 16:17                       ` Maciej W. Rozycki
2017-08-17 17:25                         ` Adhemerval Zanella
2017-08-17 17:32                           ` Joseph Myers
2017-08-17 20:34                           ` Maciej W. Rozycki
2017-08-17 21:09                             ` Adhemerval Zanella
2017-08-17 21:20                               ` Aurelien Jarno
2017-08-17 22:05                                 ` Adhemerval Zanella
2017-08-17 22:34                                 ` Maciej W. Rozycki
2017-08-18  7:16                                   ` Aurelien Jarno
2017-08-18  9:32                                     ` Maciej W. Rozycki
2017-08-18 17:45                                       ` Aurelien Jarno
2017-08-18 22:27                                         ` Maciej W. Rozycki
2017-08-19 12:45                                           ` Aurelien Jarno
2017-08-21 10:49                                             ` Maciej W. Rozycki
2017-08-21 14:30                                               ` Adhemerval Zanella
2017-08-24 13:27                                                 ` [PATCH v5] [BZ #21956] MIPS/o32: Fix internal_syscall5/6/7 Maciej W. Rozycki
2017-08-24 20:08                                                   ` Adhemerval Zanella
2017-08-29 18:00                                                     ` Maciej W. Rozycki
2017-08-30 20:33                                                       ` Aurelien Jarno
2017-09-08 11:15                                                     ` MIPS: Standalone/inline assembly issues (was: MIPS/o32: Fix internal_syscall5/6/7) Maciej W. Rozycki
2017-08-26  8:00                                                   ` [PATCH v5] [BZ #21956] MIPS/o32: Fix internal_syscall5/6/7 Aurelien Jarno
2017-08-22  8:25                                               ` [PATCH] mips/o32: fix internal_syscall5/6/7 Aurelien Jarno
2017-08-22 10:07                                                 ` Maciej W. Rozycki
2017-08-30 15:35                                               ` Maciej W. Rozycki
2017-08-30 20:33                                                 ` Aurelien Jarno
2017-08-17 21:34                               ` Aurelien Jarno
2017-08-17 21:47                               ` Maciej W. Rozycki
2017-08-17 18:18                         ` Aurelien Jarno
2017-08-15 16:16   ` Aurelien Jarno
2017-08-15 12:17 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).