In tests/mlock2.c, the address argument for the mlock2 syscall is passed
through a vararg using the "syscall" function. On 64-bit systems, while the
input argument is treated as an unsigned int, the argument is read as a
void* (64-bits wide). On mips64, writes to the lower 32-bits of a register
are by default sign extended to the upper 32-bits, so the pointer is read by
the syscall function as 0xffffffffdeadbeef causing the test to fail.
Fix by casting the integer to a void* before passing it.

* tests/mlock2.c: add void* cast to address argument of mlock2
---
 tests/mlock2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/mlock2.c b/tests/mlock2.c
index af63917..59f1bf9 100644
--- a/tests/mlock2.c
+++ b/tests/mlock2.c
@@ -36,7 +36,7 @@
 int
 main(void)
 {
-       long rc = syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff);
+       long rc = syscall(__NR_mlock2, (void*) 0xdeadbeef, 0xdefaced, 0xffff);
        printf("mlock2(0xdeadbeef, 233811181, MLOCK_ONFAULT|0xfffe)"
               " = %ld %s (%m)\n", rc, errno2name());
 
-- 
2.8.1


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to