[PATCH 1/4] tests/mlock2.c: fix test failure on mips64
james410 at cowgill.org.uk
Wed Aug 10 10:38:42 UTC 2016
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
@@ -36,7 +36,7 @@
- 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());
More information about the Strace-devel