On Wed, Aug 10, 2016 at 11:38:42AM +0100, James Cowgill wrote: > 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());
I think 0xdeadbeefUL would also fix this test failure. I'd even extended this test to const unsigned long addr = (unsigned long) 0xfacefeeddeadbeefULL; const unsigned long len = (unsigned long) 0xcafef00dbadc0dedULL; long rc = syscall(__NR_mlock2, addr, len, -1UL); printf("mlock2(%#lx, %lu, MLOCK_ONFAULT|0xfffffffe)" " = %ld %s (%m)\n", addr, len, rc, errno2name()); -- ldv
pgpD1nxMJ6Oqr.pgp
Description: PGP signature
------------------------------------------------------------------------------ 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