From d945a07eecee9851173365459d196bcd22c3e636 Mon Sep 17 00:00:00 2001 From: David Smith Date: Tue, 23 Feb 2010 15:57:25 -0600 Subject: Fixed PR 11269 by properly handling mmap syscall 'fd' argument. * testsuite/systemtap.syscall/mmap.c (main): Added mprotect and mremap testing (along with testing of anonymous maps). * tapset/i386/syscalls.stp: In mmap probes, handle the fact that the kernel gets an unsigned long 'fd', but the user-side passes a signed int. * tapset/i386/nd_syscalls.stp: Ditto. * tapset/ia64/syscalls.stp: Ditto. * tapset/powerpc/nd_syscalls.stp: Ditto. * tapset/powerpc/syscalls.stp: Ditto. * tapset/x86_64/nd_syscalls.stp: Ditto. * tapset/x86_64/syscalls.stp: Ditto. --- tapset/powerpc/syscalls.stp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tapset/powerpc/syscalls.stp') diff --git a/tapset/powerpc/syscalls.stp b/tapset/powerpc/syscalls.stp index 0518d486..aa90eb92 100644 --- a/tapset/powerpc/syscalls.stp +++ b/tapset/powerpc/syscalls.stp @@ -511,10 +511,13 @@ probe syscall.mmap = kernel.function("sys_mmap") ? len = $len prot = $prot flags = $flags - fd = $fd + # Although the kernel gets an unsigned long fd, on the + # user-side it is a signed int. Fix this. + fd = __int32($fd) offset = $offset argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr, $len, - _mprotect_prot_str($prot), _mmap_flags($flags), $fd, $offset) + _mprotect_prot_str($prot), _mmap_flags($flags), + __int32($fd), $offset) } probe syscall.mmap.return = kernel.function("sys_mmap").return ? @@ -539,11 +542,13 @@ probe syscall.mmap2 = kernel.function("sys_mmap2") ?, length = $len prot = $prot flags = $flags - fd = $fd + # Although the kernel gets an unsigned long fd, on the + # user-side it is a signed int. Fix this. + fd = __int32($fd) pgoffset = $pgoff argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr, $len, _mprotect_prot_str($prot), _mmap_flags($flags), - $fd, $pgoff) + __int32($fd), $pgoff) } probe syscall.mmap2.return = kernel.function("sys_mmap2").return ?, kernel.function("compat_sys_mmap2").return ? -- cgit