]> granicus.if.org Git - strace/commitdiff
sys_semtimedop: fix timeval argument index in wrapped call
authorStanislav Brabec <sbrabec@suse.cz>
Fri, 7 Dec 2012 20:30:51 +0000 (21:30 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 8 Dec 2012 00:17:59 +0000 (00:17 +0000)
Looking at the implementation of wrapped semtimedop() call inside glibc
and kernel, I started to believe that timeval should be located in
tcp->u_arg[4] and not tcp->u_arg[5].  Fortunately, tcp->u_arg[5] now
works correctly as well, due to side effects of decode_ipc_subcall().

declaration in header:
int semtimedop(semid, *sops, nsops, *timeout);
                 0      1      2        3

sys_ipc arguments in glibc on all patforms except s390*:
semid, (int) nsops, 0, CHECK_N (sops, nsops), timeout
  0            1    2            3                4
We have to use indexes: 0 3 1 4

sys_ipc arguments on s390*:
semid, (int) nsops, timeout, sops
  0            1       2       3
We have to use indexes: 0 3 1 2

* ipc.c (sys_semtimedop) [!S390]: Fix timeval argument index in
indirect_ipccall case.

ipc.c

diff --git a/ipc.c b/ipc.c
index 0bde1cf89a5aa1ca909f0796e23eb8f501f51fcf..859ee282e29d869a26e96bb98c03fba9964955cd 100644 (file)
--- a/ipc.c
+++ b/ipc.c
@@ -330,7 +330,7 @@ int sys_semtimedop(struct tcb *tcp)
 #if defined(S390)
                        printtv(tcp, tcp->u_arg[2]);
 #else
-                       printtv(tcp, tcp->u_arg[5]);
+                       printtv(tcp, tcp->u_arg[4]);
 #endif
                } else {
                        tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);