]> granicus.if.org Git - strace/commitdiff
Fix printing of invalid arguments of memory mapping related syscalls
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 22:58:45 +0000 (22:58 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 23:47:34 +0000 (23:47 +0000)
* mem.c (print_mmap): Print 3rd and 4th arguments of syscall
using printflags_long.
(SYS_FUNC(mprotect)): Print 3rd argument of syscall using
printflags_long.
(SYS_FUNC(mremap)): Print 4th argument of syscall using printflags_long.
(SYS_FUNC(remap_file_pages)): Print 3rd and 4th arguments of syscall
using printflags_long.
* tests/remap_file_pages.c (main): Update.

mem.c
tests/remap_file_pages.c

diff --git a/mem.c b/mem.c
index 2d7db443591cf9fd1367f60d149cfa994713bf86..b2c7abbc76043bc16b13d459f8cf50d0c584a1a9 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -65,13 +65,13 @@ print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset)
 
        printaddr(addr);
        tprintf(", %lu, ", len);
-       printflags(mmap_prot, prot, "PROT_???");
+       printflags_long(mmap_prot, prot, "PROT_???");
        tprints(", ");
 #ifdef MAP_TYPE
-       printxval(mmap_flags, flags & MAP_TYPE, "MAP_???");
+       printxval_long(mmap_flags, flags & MAP_TYPE, "MAP_???");
        addflags(mmap_flags, flags & ~MAP_TYPE);
 #else
-       printflags(mmap_flags, flags, "MAP_???");
+       printflags_long(mmap_flags, flags, "MAP_???");
 #endif
        tprints(", ");
        printfd(tcp, fd);
@@ -185,7 +185,7 @@ SYS_FUNC(mprotect)
 {
        printaddr(tcp->u_arg[0]);
        tprintf(", %lu, ", tcp->u_arg[1]);
-       printflags(mmap_prot, tcp->u_arg[2], "PROT_???");
+       printflags_long(mmap_prot, tcp->u_arg[2], "PROT_???");
 
        return RVAL_DECODED;
 }
@@ -196,7 +196,7 @@ SYS_FUNC(mremap)
 {
        printaddr(tcp->u_arg[0]);
        tprintf(", %lu, %lu, ", tcp->u_arg[1], tcp->u_arg[2]);
-       printflags(mremap_flags, tcp->u_arg[3], "MREMAP_???");
+       printflags_long(mremap_flags, tcp->u_arg[3], "MREMAP_???");
 #ifdef MREMAP_FIXED
        if ((tcp->u_arg[3] & (MREMAP_MAYMOVE | MREMAP_FIXED)) ==
            (MREMAP_MAYMOVE | MREMAP_FIXED)) {
@@ -303,13 +303,13 @@ SYS_FUNC(remap_file_pages)
 
        printaddr(addr);
        tprintf(", %lu, ", size);
-       printflags(mmap_prot, prot, "PROT_???");
+       printflags_long(mmap_prot, prot, "PROT_???");
        tprintf(", %lu, ", pgoff);
 #ifdef MAP_TYPE
-       printxval(mmap_flags, flags & MAP_TYPE, "MAP_???");
+       printxval_long(mmap_flags, flags & MAP_TYPE, "MAP_???");
        addflags(mmap_flags, flags & ~MAP_TYPE);
 #else
-       printflags(mmap_flags, flags, "MAP_???");
+       printflags_long(mmap_flags, flags, "MAP_???");
 #endif
 
        return RVAL_DECODED;
index 8626e7f032f8ee4bb913e44f0af662fed982bebb..8aa099ea3812a684deca666f916eea8dfe348981 100644 (file)
@@ -41,8 +41,7 @@ main(void)
 {
        const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef;
        const unsigned long size = (unsigned long) 0xdefaced1bad2f00d;
-       const unsigned long prot = (unsigned long) 0xacedcafe00000000
-                                  | PROT_READ|PROT_WRITE|PROT_EXEC;
+       const unsigned long prot = PROT_READ|PROT_WRITE|PROT_EXEC;
        const unsigned long pgoff = (unsigned long) 0xcaf3babebad4deed;
        const unsigned long flags = MAP_PRIVATE|MAP_ANONYMOUS;