]> granicus.if.org Git - strace/commitdiff
s390: fix decoding of mmap2 syscall when arguments are not available
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 19 Dec 2016 12:34:51 +0000 (12:34 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 19 Dec 2016 12:34:51 +0000 (12:34 +0000)
* mem.c [S390] (SYS_FUNC(old_mmap_pgoff)): Use umove_or_printaddr
instead of umoven to fetch mmap arguments, fix return value when this
fetch fails.

mem.c

diff --git a/mem.c b/mem.c
index 1ce4d92e17b811ca4acae3661fe980bec741da3f..453a64e33e6748990652a0f4a3ff3bf072a6c25e 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -112,7 +112,7 @@ SYS_FUNC(old_mmap)
 }
 #endif /* old_mmap architectures */
 
-#if defined(S390)
+#ifdef S390
 /* Params are pointed to by u_arg[0], offset is in pages */
 SYS_FUNC(old_mmap_pgoff)
 {
@@ -120,8 +120,8 @@ SYS_FUNC(old_mmap_pgoff)
        int i;
        unsigned narrow_arg[6];
        unsigned long long offset;
-       if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
-               return 0;
+       if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg))
+               return RVAL_DECODED | RVAL_HEX;
        for (i = 0; i < 5; i++)
                u_arg[i] = (unsigned long) narrow_arg[i];
        offset = narrow_arg[5];
@@ -130,7 +130,7 @@ SYS_FUNC(old_mmap_pgoff)
 
        return RVAL_DECODED | RVAL_HEX;
 }
-#endif
+#endif /* S390 */
 
 /* Params are passed directly, offset is in bytes */
 SYS_FUNC(mmap)