[PATCH] sys_semtimedop(): fix timeval argument index in wrapped call

Stanislav Brabec sbrabec at suse.cz
Fri Dec 7 20:30:51 UTC 2012


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]. For unknown reason, tcp->u_arg[5]
works correctly as well.

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

Index: strace-4.7/ipc.c
===================================================================
--- strace-4.7.orig/ipc.c
+++ strace-4.7/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]);


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec at suse.cz
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/





More information about the Strace-devel mailing list