From: Eugene Syromyatnikov Date: Mon, 19 Dec 2016 22:13:21 +0000 (+0300) Subject: x32: fix decoding of 3rd argument of preadv* and pwritev* syscalls X-Git-Tag: v4.16~323 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c6f7555256a0eb0f3e728bed53964dcb565b2e7;p=strace x32: fix decoding of 3rd argument of preadv* and pwritev* syscalls In x32 personality these syscalls use compat type for the 3rd argument, therefore it has to be truncated there. * io.c (do_preadv, do_pwritev): Truncate tcp->u_arg[2] using widen_to_ulong. --- diff --git a/io.c b/io.c index 53419ed8..713a1ce4 100644 --- a/io.c +++ b/io.c @@ -222,10 +222,12 @@ do_preadv(struct tcb *tcp, const int flags_arg) printfd(tcp, tcp->u_arg[0]); tprints(", "); } else { - tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1], + unsigned long len = widen_to_ulong(tcp->u_arg[2]); + + tprint_iov_upto(tcp, len, tcp->u_arg[1], syserror(tcp) ? IOV_DECODE_ADDR : IOV_DECODE_STR, tcp->u_rval); - tprintf(", %lu, ", tcp->u_arg[2]); + tprintf(", %lu, ", len); print_lld_from_low_high_val(tcp, 3); if (flags_arg >= 0) { tprints(", "); @@ -248,10 +250,12 @@ SYS_FUNC(preadv2) static int do_pwritev(struct tcb *tcp, const int flags_arg) { + unsigned long len = widen_to_ulong(tcp->u_arg[2]); + printfd(tcp, tcp->u_arg[0]); tprints(", "); - tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR); - tprintf(", %lu, ", tcp->u_arg[2]); + tprint_iov(tcp, len, tcp->u_arg[1], IOV_DECODE_STR); + tprintf(", %lu, ", len); print_lld_from_low_high_val(tcp, 3); if (flags_arg >= 0) { tprints(", ");