summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2010-02-23 15:57:25 -0600
committerDavid Smith <dsmith@redhat.com>2010-02-23 15:57:25 -0600
commitd945a07eecee9851173365459d196bcd22c3e636 (patch)
treeacf0cf964c937f5a31216f3cfb38662252428851 /tapset
parent4d3c480990cdbbd3e0c405be03a195a040b4dc4a (diff)
downloadsystemtap-steved-d945a07eecee9851173365459d196bcd22c3e636.tar.gz
systemtap-steved-d945a07eecee9851173365459d196bcd22c3e636.tar.xz
systemtap-steved-d945a07eecee9851173365459d196bcd22c3e636.zip
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.
Diffstat (limited to 'tapset')
-rw-r--r--tapset/i386/nd_syscalls.stp8
-rw-r--r--tapset/i386/syscalls.stp6
-rw-r--r--tapset/ia64/syscalls.stp7
-rw-r--r--tapset/powerpc/nd_syscalls.stp18
-rw-r--r--tapset/powerpc/syscalls.stp13
-rw-r--r--tapset/x86_64/nd_syscalls.stp14
-rw-r--r--tapset/x86_64/syscalls.stp10
7 files changed, 51 insertions, 25 deletions
diff --git a/tapset/i386/nd_syscalls.stp b/tapset/i386/nd_syscalls.stp
index 92befeb5..2b13cbd7 100644
--- a/tapset/i386/nd_syscalls.stp
+++ b/tapset/i386/nd_syscalls.stp
@@ -79,17 +79,19 @@ probe nd_syscall.mmap2 = kprobe.function("sys_mmap2") ?
// length = $len
// prot = $prot
// flags = $flags
- // fd = $fd
+ // 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)
asmlinkage()
start = ulong_arg(1)
length = ulong_arg(2)
prot = ulong_arg(3)
flags = ulong_arg(4)
- fd = ulong_arg(5)
+ # Although the kernel gets an unsigned long fd, on the
+ # user-side it is a signed int. Fix this.
+ fd = int_arg(5)
pgoffset = ulong_arg(6)
argstr = sprintf("%p, %d, %s, %s, %d, %d", start,
length, _mprotect_prot_str(prot), _mmap_flags(flags),
diff --git a/tapset/i386/syscalls.stp b/tapset/i386/syscalls.stp
index 821d77d4..2d1a282b 100644
--- a/tapset/i386/syscalls.stp
+++ b/tapset/i386/syscalls.stp
@@ -68,11 +68,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 ?
{
diff --git a/tapset/ia64/syscalls.stp b/tapset/ia64/syscalls.stp
index c57ab7e6..9601ac08 100644
--- a/tapset/ia64/syscalls.stp
+++ b/tapset/ia64/syscalls.stp
@@ -10,10 +10,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 = $off
argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr, $len,
- _mprotect_prot_str($prot), _mmap_flags($flags), $fd, $off)
+ _mprotect_prot_str($prot), _mmap_flags($flags),
+ __int32($fd), $off)
}
probe syscall.mmap.return = kernel.function("sys_mmap").return ?
diff --git a/tapset/powerpc/nd_syscalls.stp b/tapset/powerpc/nd_syscalls.stp
index 46267507..0723c393 100644
--- a/tapset/powerpc/nd_syscalls.stp
+++ b/tapset/powerpc/nd_syscalls.stp
@@ -637,19 +637,23 @@ probe nd_syscall.mmap = kprobe.function("sys_mmap") ?
// len = $len
// prot = $prot
// flags = $flags
- // fd = $fd
+ // 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)
asmlinkage()
start = ulong_arg(1)
len = ulong_arg(2)
prot = ulong_arg(3)
flags = ulong_arg(4)
- fd = ulong_arg(5)
+ # Although the kernel gets an unsigned long fd, on the
+ # user-side it is a signed int. Fix this.
+ fd = int_arg(5)
offset = ulong_arg(6)
argstr = sprintf("%p, %d, %s, %s, %d, %d", start, len,
- _mprotect_prot_str(prot), _mmap_flags(flags), fd, offset)
+ _mprotect_prot_str(prot), _mmap_flags(flags),
+ fd, offset)
}
probe nd_syscall.mmap.return = kprobe.function("sys_mmap").return ?
{
@@ -673,7 +677,7 @@ probe nd_syscall.mmap2 = kprobe.function("sys_mmap2") ?,
// length = $len
// prot = $prot
// flags = $flags
- // fd = $fd
+ // fd = __int32($fd)
// pgoffset = $pgoff
// argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr,
// $len, _mprotect_prot_str($prot), _mmap_flags($flags),
@@ -683,7 +687,9 @@ probe nd_syscall.mmap2 = kprobe.function("sys_mmap2") ?,
length = ulong_arg(2)
prot = ulong_arg(3)
flags = ulong_arg(4)
- fd = ulong_arg(5)
+ # Although the kernel gets an unsigned long fd, on the
+ # user-side it is a signed int. Fix this.
+ fd = int_arg(5)
pgoffset = ulong_arg(6)
argstr = sprintf("%p, %d, %s, %s, %d, %d", start,
length, _mprotect_prot_str(prot), _mmap_flags(flags),
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 ?
diff --git a/tapset/x86_64/nd_syscalls.stp b/tapset/x86_64/nd_syscalls.stp
index a8157160..80c092a8 100644
--- a/tapset/x86_64/nd_syscalls.stp
+++ b/tapset/x86_64/nd_syscalls.stp
@@ -98,16 +98,19 @@ probe nd_syscall.mmap = kprobe.function("sys_mmap") ?
// len = $len
// prot = $prot
// flags = $flags
- // fd = $fd
+ // fd = __int32($fd)
// offset = $off
// argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr, $len,
- // _mprotect_prot_str($prot), _mmap_flags($flags), $fd, $off)
+ // _mprotect_prot_str($prot), _mmap_flags($flags),
+ // __int32($fd), $off)
asmlinkage()
start = ulong_arg(1)
len = ulong_arg(2)
prot = ulong_arg(3)
flags = ulong_arg(4)
- fd = ulong_arg(5)
+ # Although the kernel gets an unsigned long fd, on the
+ # user-side it is a signed int. Fix this.
+ fd = int_arg(5)
offset = ulong_arg(6)
argstr = sprintf("%p, %d, %s, %s, %d, %d", start, len,
_mprotect_prot_str(prot), _mmap_flags(flags), fd, offset)
@@ -142,11 +145,12 @@ probe nd_syscall.mmap2 = kprobe.function("sys32_mmap2")
{
name = "mmap2"
// argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr, $len,
- // _mprotect_prot_str($prot), _mmap_flags($flags), $fd, $pgoff)
+ // _mprotect_prot_str($prot), _mmap_flags($flags),
+ // __int32($fd), $pgoff)
asmlinkage()
argstr = sprintf("%p, %d, %s, %s, %d, %d", ulong_arg(1), ulong_arg(2),
_mprotect_prot_str(ulong_arg(3)), _mmap_flags(ulong_arg(4)),
- ulong_arg(5), ulong_arg(6))
+ int_arg(5), ulong_arg(6))
}
probe nd_syscall.mmap2.return = kprobe.function("sys32_mmap2").return
{
diff --git a/tapset/x86_64/syscalls.stp b/tapset/x86_64/syscalls.stp
index 5ad064a2..28fa2969 100644
--- a/tapset/x86_64/syscalls.stp
+++ b/tapset/x86_64/syscalls.stp
@@ -85,10 +85,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 = $off
argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr, $len,
- _mprotect_prot_str($prot), _mmap_flags($flags), $fd, $off)
+ _mprotect_prot_str($prot), _mmap_flags($flags),
+ __int32($fd), $off)
}
probe syscall.mmap.return = kernel.function("sys_mmap").return ?
@@ -119,7 +122,8 @@ probe syscall.mmap2 = kernel.function("sys32_mmap2") ?
{
name = "mmap2"
argstr = sprintf("%p, %d, %s, %s, %d, %d", $addr, $len,
- _mprotect_prot_str($prot), _mmap_flags($flags), $fd, $pgoff)
+ _mprotect_prot_str($prot), _mmap_flags($flags),
+ __int32($fd), $pgoff)
}
probe syscall.mmap2.return = kernel.function("sys32_mmap2").return ?