]> granicus.if.org Git - strace/commitdiff
x32: fix decoding of mprotect and pkey_mprotect syscall arguments
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 20 Dec 2016 01:11:53 +0000 (01:11 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 20 Dec 2016 05:09:13 +0000 (05:09 +0000)
As there are no compat versions of mprotect or pkey_mprotect syscalls
in x32 personality, "addr", "len", and "prot" syscall arguments have
kernel_ulong_t type and should be printed accordingly.

* mem.c (do_mprotect): Retrieve 1st, 2nd and 3rd arguments using
getarg_klu, print them using printaddr_klu, PRI_klu format,
and printflags64, correspondingly.

mem.c

diff --git a/mem.c b/mem.c
index 437b8ea560df7d946fa91d254bd46c32a1571dea..b683a095ddd00ee33012ff7ec72b2ea06d397b63 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -185,9 +185,9 @@ SYS_FUNC(munmap)
 static int
 do_mprotect(struct tcb *tcp, bool has_pkey)
 {
-       printaddr(tcp->u_arg[0]);
-       tprintf(", %lu, ", tcp->u_arg[1]);
-       printflags_long(mmap_prot, tcp->u_arg[2], "PROT_???");
+       printaddr_klu(getarg_klu(tcp, 0));
+       tprintf(", %" PRI_klu ", ", getarg_klu(tcp, 1));
+       printflags64(mmap_prot, getarg_klu(tcp, 2), "PROT_???");
 
        if (has_pkey)
                tprintf(", %d", (int) tcp->u_arg[3]);