This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix bug of mremap's flags


Hi, all
  In the current tapset, syscall.mremap is using _mmap_flags
to get string of flags. It's not right, because mremap's flags
bit-mask argument may be 0, or include MREMAP_MAYMOVE and
MREMAP_FIXED. It's very different from mmap's flags. So I added
a function _mremap_flags for this kind of situation.

I fixed it with the following patch.

diff -Nur /usr/share/systemtap/tapset/aux_syscalls.stp tapset/aux_syscalls.stp
--- /usr/share/systemtap/tapset/aux_syscalls.stp	2007-09-18 10:11:15.000000000 +0900
+++ tapset/aux_syscalls.stp	2007-09-18 11:26:39.000000000 +0900
@@ -1343,6 +1343,12 @@
	return substr(msg,0,strlen(msg)-1)
}

+function _mremap_flags(flags) {
+	if (flags & 1) msg="MREMAP_MAYMOVE|"
+	if (flags & 2) msg="MREMAP_FIXED|".msg
+	return substr(msg,0,strlen(msg)-1)
+}
+
function _mprotect_prot_str(prot) {
	if (prot) {
		if(prot & 1) ps="PROT_READ|"
diff -Nur /usr/share/systemtap/tapset/syscalls.stp tapset/syscalls.stp
--- /usr/share/systemtap/tapset/syscalls.stp	2007-09-18 10:11:15.000000000 +0900
+++ tapset/syscalls.stp	2007-09-18 11:41:44.000000000 +0900
@@ -2554,7 +2554,7 @@
	flags = $flags
	new_address = $new_addr
	argstr = sprintf("%p, %d, %d, %s, %p", $addr, $old_len, $new_len,
-		_mmap_flags($flags), $new_addr)
+		_mremap_flags($flags), $new_addr)
}
probe syscall.mremap.return = kernel.function("sys_mremap").return {
	name = "mremap"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]