[PATCH] ARM EABI: fix 64-bit syscall's arguments decoding

Dmitry V. Levin ldv at altlinux.org
Sat May 28 20:52:59 UTC 2011


On Wed, May 25, 2011 at 09:12:39AM +0200, Andreas Schwab wrote:
> "Kirill A. Shutemov" <kirill-oKw7cIdHH8eLwutG50LtGA at public.gmane.org> writes:
> 
> > ARM OABI and ARM EABI have different function parameters passing rules.
> > With EABI, 64-bit function parameters passed in registers are aligned to
> > an even-numbered register instead of using the next available pair. [1]
> > This rule also applies to syscall's arguments.
> >
> > strace is not aware about this difference. This patch fixes it.
> > Five syscalls affected.
> 
> Please take a look at printllval.

Please have a look at the second edition of this fix:

* linux/arm/syscallent.h (pread, pwrite, truncate64, ftruncate64,
readahead, preadv, pwritev): Fix number of arguments.
* util.c (printllval): Align 64bit argument to 64bit boundary on
__ARM_EABI__.
    
diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h
index 784b986..5969900 100644
--- a/linux/arm/syscallent.h
+++ b/linux/arm/syscallent.h
@@ -209,8 +209,8 @@
 	{ 3,	TS,	sys_rt_sigqueueinfo,    "rt_sigqueueinfo"}, /* 178 */
 	{ 2,	TS,	sys_rt_sigsuspend,	"rt_sigsuspend"	}, /* 179 */
 
-	{ 5,	TF,	sys_pread,		"pread"		}, /* 180 */
-	{ 5,	TF,	sys_pwrite,		"pwrite"	}, /* 181 */
+	{ 6,	TF,	sys_pread,		"pread"		}, /* 180 */
+	{ 6,	TF,	sys_pwrite,		"pwrite"	}, /* 181 */
 	{ 3,	TF,	sys_chown,		"chown"		}, /* 182 */
 	{ 2,	TF,	sys_getcwd,		"getcwd"	}, /* 183 */
 	{ 2,	0,	sys_capget,		"capget"	}, /* 184 */
@@ -222,8 +222,8 @@
 	{ 0,	TP,	sys_vfork,		"vfork"		}, /* 190 */
 	{ 2,	0,	sys_getrlimit,		"getrlimit"	}, /* 191 */
 	{ 6,	TD,	sys_mmap,		"mmap2"		}, /* 192 */
-	{ 3,	TF,	sys_truncate64,		"truncate64"	}, /* 193 */
-	{ 3,	TF,	sys_ftruncate64,	"ftruncate64"	}, /* 194 */
+	{ 4,	TF,	sys_truncate64,		"truncate64"	}, /* 193 */
+	{ 4,	TF,	sys_ftruncate64,	"ftruncate64"	}, /* 194 */
 	{ 2,	TF,	sys_stat64,		"stat64"	}, /* 195 */
 	{ 2,	TF,	sys_lstat64,		"lstat64"	}, /* 196 */
 	{ 2,	TF,	sys_fstat64,		"fstat64"	}, /* 197 */
@@ -255,7 +255,7 @@
 	{ 5,	0,	printargs,		"SYS_222"	}, /* 222 */
 	{ 5,	0,	printargs,		"SYS_223"	}, /* 223 */
 	{ 0,	0,	printargs,		"gettid"	}, /* 224 */
-	{ 4,	0,	sys_readahead,		"readahead"	}, /* 225 */
+	{ 5,	0,	sys_readahead,		"readahead"	}, /* 225 */
 	{ 5,	TF,	sys_setxattr,		"setxattr"	}, /* 226 */
 	{ 5,	TF,	sys_setxattr,		"lsetxattr"	}, /* 227 */
 	{ 5,	0,	sys_fsetxattr,		"fsetxattr"	}, /* 228 */
@@ -391,8 +391,8 @@
 	{ 3,	TD,	sys_dup3,		"dup3"		}, /* 358 */
 	{ 2,	TD,	sys_pipe2,		"pipe2"		}, /* 359 */
 	{ 1,	TD,	sys_inotify_init1,	"inotify_init1"	}, /* 360 */
-	{ 5,	TD,	sys_preadv,		"preadv"	}, /* 361 */
-	{ 5,	TD,	sys_pwritev,		"pwritev"	}, /* 362 */
+	{ 6,	TD,	sys_preadv,		"preadv"	}, /* 361 */
+	{ 6,	TD,	sys_pwritev,		"pwritev"	}, /* 362 */
 	{ 4,	TP|TS,	printargs,		"rt_tgsigqueueinfo"}, /* 363 */
 	{ 5,	TD,	printargs,		"perf_event_open"}, /* 364 */
 	{ 5,	TN,	sys_recvmmsg,		"recvmmsg"	}, /* 365 */
diff --git a/util.c b/util.c
index 8704a46..a6c91ab 100644
--- a/util.c
+++ b/util.c
@@ -252,7 +252,8 @@ printllval(struct tcb *tcp, const char *format, int llarg)
 {
 # if defined(FREEBSD) \
      || (defined(LINUX) && defined(POWERPC) && !defined(POWERPC64)) \
-     || defined (LINUX_MIPSO32)
+     || defined(LINUX_MIPSO32) \
+     || defined(__ARM_EABI__)
 	/* Align 64bit argument to 64bit boundary.  */
 	if (llarg % 2) llarg++;
 # endif


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20110529/4bd43eea/attachment.bin>


More information about the Strace-devel mailing list