]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Don't check the fifth argument of mremap() unless MREMAP_FIXED is set
authorTom Hughes <tom@compton.nu>
Mon, 8 May 2006 11:58:06 +0000 (11:58 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 8 May 2006 11:58:06 +0000 (11:58 +0000)
in the fourth argument. Fix to bug #123535.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5886

coregrind/m_syswrap/syswrap-generic.c

index 3054738318d7ee52b3cebe89eac16f31e58b69cc..b25c161db7ea3045e22bb71372cab79428882147 100644 (file)
@@ -2109,12 +2109,20 @@ PRE(sys_mremap)
 {
    // Nb: this is different to the glibc version described in the man pages,
    // which lacks the fifth 'new_address' argument.
-   PRINT("sys_mremap ( %p, %llu, %d, 0x%x, %p )", 
-         ARG1, (ULong)ARG2, ARG3, ARG4, ARG5);
-   PRE_REG_READ5(unsigned long, "mremap",
-                 unsigned long, old_addr, unsigned long, old_size,
-                 unsigned long, new_size, unsigned long, flags,
-                 unsigned long, new_addr);
+   if (ARG4 & VKI_MREMAP_FIXED) {
+      PRINT("sys_mremap ( %p, %llu, %d, 0x%x, %p )", 
+            ARG1, (ULong)ARG2, ARG3, ARG4, ARG5);
+      PRE_REG_READ5(unsigned long, "mremap",
+                    unsigned long, old_addr, unsigned long, old_size,
+                    unsigned long, new_size, unsigned long, flags,
+                    unsigned long, new_addr);
+   } else {
+      PRINT("sys_mremap ( %p, %llu, %d, 0x%x )", 
+            ARG1, (ULong)ARG2, ARG3, ARG4);
+      PRE_REG_READ4(unsigned long, "mremap",
+                    unsigned long, old_addr, unsigned long, old_size,
+                    unsigned long, new_size, unsigned long, flags);
+   }
    SET_STATUS_from_SysRes( 
       do_mremap((Addr)ARG1, ARG2, (Addr)ARG5, ARG3, ARG4, tid) 
    );