]> granicus.if.org Git - strace/commitdiff
Fix oldselect decoding on 64-bit architectures
authorElvira Khabirova <lineprinter0@gmail.com>
Wed, 29 Jul 2015 18:38:54 +0000 (21:38 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 30 Jul 2015 22:02:56 +0000 (22:02 +0000)
As struct sel_arg_struct is an array of 32-bit values,
fetch it using an intermediate array on 64-bit architectures.

* desc.c (sys_oldselect): Rename args to long_args.
[SIZEOF_LONG == 4] Alias oldselect_args to long_args.
[SIZEOF_LONG != 4] Introduce oldselect_args to fetch oldselect args.
* linux/sh64/syscallent.h (oldselect): Remove.

desc.c
linux/sh64/syscallent.h

diff --git a/desc.c b/desc.c
index d9e88b1550e80d2458a4d93e3a38f262bb12a43f..32327c264db2cf3aba41b2b8e5dfea6b32c1dcdb 100644 (file)
--- a/desc.c
+++ b/desc.c
@@ -410,13 +410,26 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
 
 SYS_FUNC(oldselect)
 {
-       long args[5];
+       long long_args[5];
+#undef oldselect_args
+#if SIZEOF_LONG == 4
+# define oldselect_args long_args
+#else
+       unsigned int oldselect_args[5];
+       unsigned int i;
+#endif
 
-       if (umove(tcp, tcp->u_arg[0], &args) < 0) {
+       if (umove(tcp, tcp->u_arg[0], &oldselect_args) < 0) {
                printaddr(tcp->u_arg[0]);
                return 0;
        }
-       return decode_select(tcp, args, BITNESS_CURRENT);
+#ifndef oldselect_args
+       for (i = 0; i < 5; i++) {
+               long_args[i] = oldselect_args[i];
+       }
+#endif
+       return decode_select(tcp, long_args, BITNESS_CURRENT);
+#undef oldselect_args
 }
 
 #ifdef ALPHA
index 852c03fdc9aa7eda1258a622b8cc354c4e63abc7..4caf6b9c41a9769c06350e693d912e67ee481fee 100644 (file)
 [ 79] = { 2,   0,              SEN(settimeofday),              "settimeofday"          },
 [ 80] = { 2,   0,              SEN(getgroups16),               "getgroups"             },
 [ 81] = { 2,   0,              SEN(setgroups16),               "setgroups"             },
-[ 82] = { 1,   TD,             SEN(oldselect),                 "oldselect"             },
+[ 82] = { },
 [ 83] = { 2,   TF,             SEN(symlink),                   "symlink"               },
 [ 84] = { 2,   TF,             SEN(oldlstat),                  "oldlstat"              },
 [ 85] = { 3,   TF,             SEN(readlink),                  "readlink"              },