case IOV_DECODE_STR:
if (len > c->data_size)
len = c->data_size;
- c->data_size -= len;
+ if (c->data_size != -1UL)
+ c->data_size -= len;
printstr(tcp, iov[0], len);
break;
case IOV_DECODE_NETLINK:
if (len > c->data_size)
len = c->data_size;
- c->data_size -= len;
+ if (c->data_size != -1UL)
+ c->data_size -= len;
decode_netlink(tcp, iov[0], iov[1]);
break;
default:
* Example: recvmsg returing a short read.
*/
void
-tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr,
- enum iov_decode decode_iov, unsigned long data_size)
+tprint_iov_upto(struct tcb *const tcp, const unsigned long len,
+ const kernel_ureg_t addr, const enum iov_decode decode_iov,
+ const unsigned long data_size)
{
unsigned long iov[2];
struct print_iovec_config config =
{ .decode_iov = decode_iov, .data_size = data_size };
print_array(tcp, addr, len, iov, current_wordsize * 2,
- umoven_or_printaddr, print_iovec, &config);
-}
-
-void
-tprint_iov(struct tcb *tcp, unsigned long len, unsigned long addr,
- enum iov_decode decode_iov)
-{
- tprint_iov_upto(tcp, len, addr, decode_iov, (unsigned long) -1L);
+ umoven_or_printaddr_ignore_syserror, print_iovec, &config);
}
SYS_FUNC(readv)
tprints(", ");
} else {
tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1],
+ syserror(tcp) ? IOV_DECODE_ADDR :
IOV_DECODE_STR, tcp->u_rval);
tprintf(", %lu", tcp->u_arg[2]);
}
print_lld_from_low_high_val(struct tcb *tcp, int arg)
{
#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
-# if SUPPORTED_PERSONALITIES > 1
-# ifdef X86_64
- if (current_personality != 1)
-# else
- if (current_wordsize == sizeof(long))
-# endif
-# endif
+# ifndef current_klongsize
+ if (current_klongsize < SIZEOF_LONG) {
+ tprintf("%ld", (tcp->u_arg[arg + 1] << current_wordsize * 8)
+ | tcp->u_arg[arg]);
+ } else
+# endif /* !current_klongsize */
+ {
tprintf("%ld", tcp->u_arg[arg]);
-# if SUPPORTED_PERSONALITIES > 1
- else
- tprintf("%ld",
- ((unsigned long) tcp->u_arg[arg + 1] << current_wordsize * 8)
- | (unsigned long) tcp->u_arg[arg]);
-# endif
+ }
#elif SIZEOF_LONG > 4
# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
#elif HAVE_STRUCT_TCB_EXT_ARG
-# if SUPPORTED_PERSONALITIES > 1
- if (current_personality == 1) {
+# ifndef current_klongsize
+ if (current_klongsize < SIZEOF_LONG_LONG) {
tprintf("%lld",
(zero_extend_signed_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
| zero_extend_signed_to_ull(tcp->u_arg[arg]));
} else
-# endif
+# endif /* !current_klongsize */
{
tprintf("%lld", tcp->ext_arg[arg]);
}
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
- tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR,
- tcp->u_rval);
- tprintf(", %lu, ", tcp->u_arg[2]);
+ 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, ", len);
print_lld_from_low_high_val(tcp, 3);
if (flags_arg >= 0) {
tprints(", ");
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(", ");