diff --git a/systemtap-s390x-mmap-tapset.diff b/systemtap-s390x-mmap-tapset.diff new file mode 100644 index 0000000..22d2f96 --- /dev/null +++ b/systemtap-s390x-mmap-tapset.diff @@ -0,0 +1,193 @@ +diff -Naur stap_co_200702222256/src/tapset/s390x/syscalls.stp stap_co_200702222241/src/tapset/s390x/syscalls.stp +--- stap_co_200702222256/src/tapset/s390x/syscalls.stp 1969-12-31 16:00:00.000000000 -0800 ++++ stap_co_200702222241/src/tapset/s390x/syscalls.stp 2007-02-22 14:48:37.527534944 -0800 +@@ -0,0 +1,169 @@ ++%(arch == "s390x" %? ++ ++# mmap - s390x version of the syscall.mmap probes ++# ++# long old_mmap(struct mmap_arg_struct __user *arg) ++# long old32_mmap(struct mmap_arg_struct_emu31 __user *arg) ++# ++ ++probe syscall.mmap = kernel.function("old_mmap"), ++ kernel.function("old32_mmap") ++{ ++ name = "mmap" ++ ++ if ( probefunc() == "old_mmap" ){ ++ argstr = get_mmap_args($arg); ++ }else{ ++ argstr = get_32mmap_args($arg); ++ } ++ ++ argstr = get_mmap_args($arg); ++} ++ ++probe syscall.mmap.return = kernel.function("old_mmap").return, ++ kernel.function("old32_mmap").return ++{ ++ name = "mmap" ++ retstr = returnstr(2) ++} ++ ++ ++# mmap2 - s390x version of the syscall.mmap2 probes ++# ++# long sys_mmap2(struct mmap_arg_struct __user *arg) ++# long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) ++# ++probe syscall.mmap2 = kernel.function("sys_mmap2"), ++ kernel.function("sys32_mmap2") ++{ ++ name = "mmap2" ++ ++ if ( probefunc() == "sys_mmap2" ){ ++ argstr = get_mmap_args($arg); ++ }else{ ++ argstr = get_32mmap_args($arg); ++ } ++ ++ argstr = get_mmap_args($arg); ++} ++ ++probe syscall.mmap2.return = kernel.function("sys_mmap2").return, ++ kernel.function("sys32_mmap2").return ++{ ++ name = "mmap2" ++ retstr = returnstr(2) ++} ++ ++function get_mmap_args:string (args:long) ++%{ ++ struct mmap_arg_struct { ++ unsigned long addr; ++ unsigned long len; ++ unsigned long prot; ++ unsigned long flags; ++ unsigned long fd; ++ unsigned long offset; ++ }a; ++ ++ char proto[60]; ++ char flags[256]; ++ ++ if(_stp_copy_from_user((char *)&a, ++ (char *)THIS->args, sizeof(a))== 0){ ++ ++ /* _mprotect_prot_str */ ++ proto[0] = '\0'; ++ if(a.prot){ ++ if(a.prot & 1) strcat (proto, "PROT_READ|"); ++ if(a.prot & 2) strcat (proto, "PROT_WRITE|"); ++ if(a.prot & 4) strcat (proto, "PROT_EXEC|"); ++ } else { ++ strcat (proto, "PROT_NONE"); ++ } ++ if (proto[0] != '\0') proto[strlen(proto)-1] = '\0'; ++ ++ /* _mmap_flags */ ++ flags[0]='\0'; ++ if (a.flags & 1) strcat (flags, "MAP_SHARED|"); ++ if (a.flags & 2) strcat (flags, "MAP_PRIVATE|"); ++ if (a.flags & 0x10) strcat (flags, "MAP_FIXED|"); ++ if (a.flags & 0x20) strcat (flags, "MAP_ANONYMOUS|"); ++ if (a.flags & 0x100) strcat (flags, "MAP_GROWSDOWN|"); ++ if (a.flags & 0x800) strcat (flags, "MAP_DENYWRITE|"); ++ if (a.flags & 0x1000) strcat (flags, "MAP_EXECUTABLE|"); ++ if (a.flags & 0x2000) strcat (flags, "MAP_LOCKED|"); ++ if (a.flags & 0x4000) strcat (flags, "MAP_NORESERVE|"); ++ if (a.flags & 0x8000) strcat (flags, "MAP_POPULATE|"); ++ if (a.flags & 0x10000) strcat (flags, "MAP_NONBLOCK|"); ++ if (flags[0] != '\0') flags[strlen(flags)-1] = '\0'; ++ ++ sprintf(THIS->__retvalue,"0x%lx, %ld, %s, %s, %ld, %ld", ++ a.addr, ++ a.len, ++ proto, ++ flags, ++ a.fd, ++ a.offset); ++ }else{ ++ strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN); ++ } ++%} ++ ++/* compat */ ++function get_32mmap_args:string (args:long) ++%{ ++ struct mmap_arg_struct_emu31 { ++ u32 addr; ++ u32 len; ++ u32 prot; ++ u32 flags; ++ u32 fd; ++ u32 offset; ++ }a; ++ ++ ++ char proto[60]; ++ char flags[256]; ++ ++ if(_stp_copy_from_user((char *)&a, ++ (char *)THIS->args, sizeof(a))== 0){ ++ ++ /* _mprotect_prot_str */ ++ proto[0] = '\0'; ++ if(a.prot){ ++ if(a.prot & 1) strcat (proto, "PROT_READ|"); ++ if(a.prot & 2) strcat (proto, "PROT_WRITE|"); ++ if(a.prot & 4) strcat (proto, "PROT_EXEC|"); ++ } else { ++ strcat (proto, "PROT_NONE"); ++ } ++ if (proto[0] != '\0') proto[strlen(proto)-1] = '\0'; ++ ++ /* _mmap_flags */ ++ flags[0]='\0'; ++ if (a.flags & 1) strcat (flags, "MAP_SHARED|"); ++ if (a.flags & 2) strcat (flags, "MAP_PRIVATE|"); ++ if (a.flags & 0x10) strcat (flags, "MAP_FIXED|"); ++ if (a.flags & 0x20) strcat (flags, "MAP_ANONYMOUS|"); ++ if (a.flags & 0x100) strcat (flags, "MAP_GROWSDOWN|"); ++ if (a.flags & 0x800) strcat (flags, "MAP_DENYWRITE|"); ++ if (a.flags & 0x1000) strcat (flags, "MAP_EXECUTABLE|"); ++ if (a.flags & 0x2000) strcat (flags, "MAP_LOCKED|"); ++ if (a.flags & 0x4000) strcat (flags, "MAP_NORESERVE|"); ++ if (a.flags & 0x8000) strcat (flags, "MAP_POPULATE|"); ++ if (a.flags & 0x10000) strcat (flags, "MAP_NONBLOCK|"); ++ if (flags[0] != '\0') flags[strlen(flags)-1] = '\0'; ++ ++ sprintf(THIS->__retvalue,"0x%x, %d, %s, %s, %d, %d", ++ a.addr, ++ a.len, ++ proto, ++ flags, ++ a.fd, ++ a.offset); ++ }else{ ++ strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN); ++ } ++%} ++ ++%) +diff -Naur stap_co_200702222256/src/tapset/syscalls.stp stap_co_200702222241/src/tapset/syscalls.stp +--- stap_co_200702222256/src/tapset/syscalls.stp 2007-02-06 18:54:31.000000000 -0800 ++++ stap_co_200702222241/src/tapset/syscalls.stp 2007-02-22 14:50:38.292175928 -0800 +@@ -1942,6 +1942,8 @@ + name = "mlockall" + retstr = returnstr(1) + } ++ ++%(arch != "s390x" %? + # mmap + # long sys_mmap(unsigned long addr, unsigned long len, + # unsigned long prot, unsigned long flags, +@@ -1997,6 +1999,7 @@ + name = "mmap2" + retstr = returnstr(2) + } ++%) + + # modify_ldt _________________________________________________ + # int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) diff --git a/systemtap.changes b/systemtap.changes index 7dabdbf..108db8e 100644 --- a/systemtap.changes +++ b/systemtap.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Feb 23 16:43:53 CET 2007 - tiwai@suse.de + +- fix mmap syscall on s390x (#248110) + ------------------------------------------------------------------- Thu Feb 15 13:20:32 CET 2007 - tiwai@suse.de diff --git a/systemtap.spec b/systemtap.spec index 15cde60..c8fc8ea 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -16,7 +16,7 @@ BuildRequires: gcc-c++ %define elfutils_version 0.125 License: GNU General Public License (GPL) Version: 0.5.8 -Release: 31 +Release: 32 Summary: Instrumentation System Group: Development/Tools/Debuggers URL: http://sourceware.org/systemtap/ @@ -29,6 +29,7 @@ Patch1: elfutils-portability.patch Patch2: elfutils-0.125-build-fix.diff Patch3: systemtap-s390x-probe-at-function-entry.diff Patch4: systemtap-s390x-store_deref-fix.diff +Patch5: systemtap-s390x-mmap-tapset.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -51,6 +52,7 @@ Authors: %patch %patch3 %patch4 -p1 +%patch5 -p2 autoreconf -fi cd elfutils-%{elfutils_version} %patch1 -p1 @@ -78,7 +80,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_datadir}/systemtap %dir %attr(0755,root,root) /var/cache/systemtap -%changelog -n systemtap +%changelog +* Fri Feb 23 2007 - tiwai@suse.de +- fix mmap syscall on s390x (#248110) * Thu Feb 15 2007 - tiwai@suse.de - fix a wrong name of store_deref definition (#245544) * Wed Feb 14 2007 - tiwai@suse.de