From 4d3722501a3a970903cc939460143328eb9cc3ef Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 23 Dec 2016 17:56:10 +0100 Subject: [PATCH] PR20333/mbind --- tapset/linux/nd_syscalls.stp | 50 ------------------ tapset/linux/sysc_mbind.stp | 100 +++++++++++++++++++++++++++++++++++ tapset/linux/syscalls.stp | 49 ----------------- 3 files changed, 100 insertions(+), 99 deletions(-) create mode 100644 tapset/linux/sysc_mbind.stp diff --git a/tapset/linux/nd_syscalls.stp b/tapset/linux/nd_syscalls.stp index 24fbd6413..28537564e 100644 --- a/tapset/linux/nd_syscalls.stp +++ b/tapset/linux/nd_syscalls.stp @@ -1,54 +1,4 @@ -# mbind ______________________________________________________ -# long sys_mbind(unsigned long start, -# unsigned long len, -# unsigned long mode, -# unsigned long __user *nmask, -# unsigned long maxnode, -# unsigned flags) -# -# long compat_sys_mbind(compat_ulong_t start, -# compat_ulong_t len, -# compat_ulong_t mode, -# compat_ulong_t __user *nmask, -# compat_ulong_t maxnode, -# compat_ulong_t flags) -# -probe nd_syscall.mbind = __nd_syscall.mbind ?, - kprobe.function("compat_sys_mbind") ? -{ - name = "mbind" - asmlinkage() - start = pointer_arg(1) - len = ulong_arg(2) - mode = int_arg(3) - mode_str = _mempolicy_mode_str(mode) - nmask_uaddr = pointer_arg(4) - maxnode = ulong_arg(5) - flags = uint_arg(6) - flags_str = _mempolicy_flags_str(flags) - argstr = sprintf("%p, %u, %s, %p, %u, %s", start, len, - mode_str, nmask_uaddr, maxnode, flags_str) -} -probe __nd_syscall.mbind = kprobe.function("sys_mbind") -{ -%( arch == "powerpc" %? - @__syscall_gate_compat_simple -%) -} -probe nd_syscall.mbind.return = __nd_syscall.mbind.return ?, - kprobe.function("compat_sys_mbind").return ? -{ - name = "mbind" - retstr = returnstr(1) -} -probe __nd_syscall.mbind.return = kprobe.function("sys_mbind").return -{ -%( arch == "powerpc" %? - @__syscall_gate_compat_simple -%) -} - # membarrier _______________________________________________________ # SYSCALL_DEFINE2(membarrier, int, cmd, int, flags) probe nd_syscall.membarrier = kprobe.function("sys_membarrier").call ? diff --git a/tapset/linux/sysc_mbind.stp b/tapset/linux/sysc_mbind.stp new file mode 100644 index 000000000..1e89847d6 --- /dev/null +++ b/tapset/linux/sysc_mbind.stp @@ -0,0 +1,100 @@ +# mbind ______________________________________________________ +# long sys_mbind(unsigned long start, +# unsigned long len, +# unsigned long mode, +# unsigned long __user *nmask, +# unsigned long maxnode, +# unsigned flags) +# +# long compat_sys_mbind(compat_ulong_t start, +# compat_ulong_t len, +# compat_ulong_t mode, +# compat_ulong_t __user *nmask, +# compat_ulong_t maxnode, +# compat_ulong_t flags) +# + +@define _SYSCALL_MBIND_NAME +%( + name = "mbind" +%) + +@define _SYSCALL_MBIND_ARGSTR +%( + argstr = sprintf("%p, %u, %s, %p, %u, %s", start, len, + mode_str, nmask_uaddr, maxnode, flags_str) +%) + +probe syscall.mbind = dw_syscall.mbind !, nd_syscall.mbind {} +probe syscall.mbind.return = dw_syscall.mbind.return !, nd_syscall.mbind.return {} + +# dw_mbind _____________________________________________________ + +probe dw_syscall.mbind = __syscall.mbind ?, + kernel.function("compat_sys_mbind").call ? +{ + @_SYSCALL_MBIND_NAME + start = $start + mode = __int32($mode) + mode_str = _mempolicy_mode_str(mode) + nmask_uaddr = $nmask + flags = __uint32($flags) + flags_str = _mempolicy_flags_str(flags) + len = @__compat_ulong($len) + maxnode = @__compat_ulong($maxnode) + @_SYSCALL_MBIND_ARGSTR +} +probe __syscall.mbind = kernel.function("sys_mbind").call +{ +%( arch == "powerpc" %? + @__syscall_gate_compat_simple +%) +} +probe dw_syscall.mbind.return = __syscall.mbind.return ?, + kernel.function("compat_sys_mbind").return ? +{ + @_SYSCALL_MBIND_NAME + retstr = return_str(1, $return) +} +probe __syscall.mbind.return = kernel.function("sys_mbind").return +{ +%( arch == "powerpc" %? + @__syscall_gate_compat_simple +%) +} + +# nd_mbind _____________________________________________________ + +probe nd_syscall.mbind = __nd_syscall.mbind ?, + kprobe.function("compat_sys_mbind") ? +{ + @_SYSCALL_MBIND_NAME + asmlinkage() + start = pointer_arg(1) + len = ulong_arg(2) + mode = int_arg(3) + mode_str = _mempolicy_mode_str(mode) + nmask_uaddr = pointer_arg(4) + maxnode = ulong_arg(5) + flags = uint_arg(6) + flags_str = _mempolicy_flags_str(flags) + @_SYSCALL_MBIND_ARGSTR +} +probe __nd_syscall.mbind = kprobe.function("sys_mbind") +{ +%( arch == "powerpc" %? + @__syscall_gate_compat_simple +%) +} +probe nd_syscall.mbind.return = __nd_syscall.mbind.return ?, + kprobe.function("compat_sys_mbind").return ? +{ + @_SYSCALL_MBIND_NAME + retstr = returnstr(1) +} +probe __nd_syscall.mbind.return = kprobe.function("sys_mbind").return +{ +%( arch == "powerpc" %? + @__syscall_gate_compat_simple +%) +} diff --git a/tapset/linux/syscalls.stp b/tapset/linux/syscalls.stp index 31024c6ee..a807f9130 100644 --- a/tapset/linux/syscalls.stp +++ b/tapset/linux/syscalls.stp @@ -1,53 +1,4 @@ -# mbind ______________________________________________________ -# long sys_mbind(unsigned long start, -# unsigned long len, -# unsigned long mode, -# unsigned long __user *nmask, -# unsigned long maxnode, -# unsigned flags) -# -# long compat_sys_mbind(compat_ulong_t start, -# compat_ulong_t len, -# compat_ulong_t mode, -# compat_ulong_t __user *nmask, -# compat_ulong_t maxnode, -# compat_ulong_t flags) -# -probe syscall.mbind = __syscall.mbind ?, - kernel.function("compat_sys_mbind").call ? -{ - name = "mbind" - start = $start - mode = __int32($mode) - mode_str = _mempolicy_mode_str(mode) - nmask_uaddr = $nmask - flags = __uint32($flags) - flags_str = _mempolicy_flags_str(flags) - len = @__compat_ulong($len) - maxnode = @__compat_ulong($maxnode) - argstr = sprintf("%p, %u, %s, %p, %u, %s", start, len, - mode_str, nmask_uaddr, maxnode, flags_str) -} -probe __syscall.mbind = kernel.function("sys_mbind").call -{ -%( arch == "powerpc" %? - @__syscall_gate_compat_simple -%) -} -probe syscall.mbind.return = __syscall.mbind.return ?, - kernel.function("compat_sys_mbind").return ? -{ - name = "mbind" - retstr = return_str(1, $return) -} -probe __syscall.mbind.return = kernel.function("sys_mbind").return -{ -%( arch == "powerpc" %? - @__syscall_gate_compat_simple -%) -} - # membarrier _______________________________________________________ # SYSCALL_DEFINE2(membarrier, int, cmd, int, flags) probe syscall.membarrier = kernel.function("sys_membarrier").call ? -- 2.43.5