From 8ff5e7bbe3a43e93afe4db34ed9fc3802ad86890 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 3 Jan 2017 08:21:49 +0100 Subject: [PATCH] PR20333/setns --- tapset/linux/nd_syscalls2.stp | 16 ------------ tapset/linux/sysc_setns.stp | 48 +++++++++++++++++++++++++++++++++++ tapset/linux/syscalls2.stp | 15 ----------- 3 files changed, 48 insertions(+), 31 deletions(-) create mode 100644 tapset/linux/sysc_setns.stp diff --git a/tapset/linux/nd_syscalls2.stp b/tapset/linux/nd_syscalls2.stp index 8bcc2d768..ca57143d3 100644 --- a/tapset/linux/nd_syscalls2.stp +++ b/tapset/linux/nd_syscalls2.stp @@ -1,20 +1,4 @@ -# setns ______________________________________________________ -# SYSCALL_DEFINE2(setns, int, fd, int, nstype) -probe nd_syscall.setns = kprobe.function("sys_setns") ? -{ - name = "setns" - asmlinkage() - fd = int_arg(1) - nstype = int_arg(2) - argstr = sprintf("%d, %s", fd, __fork_flags(nstype)); -} -probe nd_syscall.setns.return = kprobe.function("sys_setns").return ? -{ - name = "setns" - retstr = returnstr(1) -} - # set_mempolicy ______________________________________________ # long sys_set_mempolicy(int mode, # unsigned long __user *nmask, diff --git a/tapset/linux/sysc_setns.stp b/tapset/linux/sysc_setns.stp new file mode 100644 index 000000000..7d4d068a0 --- /dev/null +++ b/tapset/linux/sysc_setns.stp @@ -0,0 +1,48 @@ +# setns ______________________________________________________ +# SYSCALL_DEFINE2(setns, int, fd, int, nstype) + +@define _SYSCALL_SETNS_NAME +%( + name = "setns" +%) + +@define _SYSCALL_SETNS_ARGSTR +%( + argstr = sprintf("%d, %s", fd, nstype_str); +%) + +probe syscall.setns = dw_syscall.setns !, nd_syscall.setns {} +probe syscall.setns.return = dw_syscall.setns.return !, nd_syscall.setns.return {} + +# dw_setns _____________________________________________________ + +probe dw_syscall.setns = kernel.function("sys_setns") ? +{ + @_SYSCALL_SETNS_NAME + fd = __int32($fd) + nstype = __int32($nstype) + nstype_str = __fork_flags(nstype) + @_SYSCALL_SETNS_ARGSTR +} +probe dw_syscall.setns.return = kernel.function("sys_setns").return ? +{ + @_SYSCALL_SETNS_NAME + retstr = return_str(1, $return) +} + +# nd_setns _____________________________________________________ + +probe nd_syscall.setns = kprobe.function("sys_setns") ? +{ + @_SYSCALL_SETNS_NAME + asmlinkage() + fd = int_arg(1) + nstype = int_arg(2) + nstype_str = __fork_flags(nstype) + @_SYSCALL_SETNS_ARGSTR +} +probe nd_syscall.setns.return = kprobe.function("sys_setns").return ? +{ + @_SYSCALL_SETNS_NAME + retstr = returnstr(1) +} diff --git a/tapset/linux/syscalls2.stp b/tapset/linux/syscalls2.stp index 7264fa6c1..7dd0a1990 100644 --- a/tapset/linux/syscalls2.stp +++ b/tapset/linux/syscalls2.stp @@ -1,19 +1,4 @@ -# setns ______________________________________________________ -# SYSCALL_DEFINE2(setns, int, fd, int, nstype) -probe syscall.setns = kernel.function("sys_setns") ? -{ - name = "setns" - fd = __int32($fd) - nstype = __int32($nstype) - argstr = sprintf("%d, %s", fd, __fork_flags(nstype)); -} -probe syscall.setns.return = kernel.function("sys_setns").return ? -{ - name = "setns" - retstr = return_str(1, $return) -} - # set_mempolicy ______________________________________________ # long sys_set_mempolicy(int mode, # unsigned long __user *nmask, -- 2.43.5