From: Dmitry V. Levin Date: Fri, 13 May 2016 02:33:33 +0000 (+0000) Subject: ptrace: decode data argument of PTRACE_PEEKSIGINFO request X-Git-Tag: v4.12~170 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76b4c33c7f5e353c43ba5e4c7dd8222b13e4c6d1;p=strace ptrace: decode data argument of PTRACE_PEEKSIGINFO request The data argument of PTRACE_PEEKSIGINFO request is a pointer to siginfo_t array. * printsiginfo.c (print_siginfo_t): New function. (print_siginfo_array): New mpers printer. * process.c (SYS_FUNC(ptrace)): Print data argument of PTRACE_PEEKSIGINFO request using print_siginfo_array. --- diff --git a/printsiginfo.c b/printsiginfo.c index 240fd65e..596d958a 100644 --- a/printsiginfo.c +++ b/printsiginfo.c @@ -242,3 +242,21 @@ MPERS_PRINTER_DECL(void, printsiginfo_at)(struct tcb *tcp, long addr) if (!umove_or_printaddr(tcp, addr, &si)) printsiginfo(&si, verbose(tcp)); } + +static bool +print_siginfo_t(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) +{ + const siginfo_t *si = elem_buf; + + printsiginfo(si, verbose(tcp)); + + return true; +} + +MPERS_PRINTER_DECL(void, print_siginfo_array)(struct tcb *tcp, unsigned long addr, unsigned long len) +{ + siginfo_t si; + + print_array(tcp, addr, len, &si, sizeof(si), + umoven_or_printaddr, print_siginfo_t, 0); +} diff --git a/process.c b/process.c index 19b616d0..3aecf088 100644 --- a/process.c +++ b/process.c @@ -212,6 +212,7 @@ SYS_FUNC(ptrace) case PTRACE_GETREGSET: case PTRACE_GETSIGINFO: case PTRACE_GETSIGMASK: + case PTRACE_PEEKSIGINFO: case PTRACE_SECCOMP_GET_FILTER: if (verbose(tcp)) { /* print data on exiting syscall */ @@ -245,6 +246,12 @@ SYS_FUNC(ptrace) case PTRACE_GETSIGMASK: print_sigset_addr_len(tcp, data, addr); break; + case PTRACE_PEEKSIGINFO: + if (syserror(tcp)) + printaddr(data); + else + print_siginfo_array(tcp, data, tcp->u_rval); + break; case PTRACE_SECCOMP_GET_FILTER: if (syserror(tcp)) printaddr(data);