From e56b532e2bc13c3ffc7be905b98f9e30904c5b16 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Thu, 22 Dec 2016 16:29:15 +0100 Subject: [PATCH] PR20333/epoll_ctl --- tapset/linux/nd_syscalls.stp | 25 -------------- tapset/linux/sysc_epoll_ctl.stp | 60 +++++++++++++++++++++++++++++++++ tapset/linux/syscalls.stp | 24 ------------- 3 files changed, 60 insertions(+), 49 deletions(-) create mode 100644 tapset/linux/sysc_epoll_ctl.stp diff --git a/tapset/linux/nd_syscalls.stp b/tapset/linux/nd_syscalls.stp index 1d199f811..329a47019 100644 --- a/tapset/linux/nd_syscalls.stp +++ b/tapset/linux/nd_syscalls.stp @@ -1,29 +1,4 @@ -# epoll_ctl __________________________________________________ -# -# long sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event) -# long compat_sys_epoll_ctl(int epfd, int op, int fd, -# struct compat_epoll_event __user *event) -# -probe nd_syscall.epoll_ctl = kprobe.function("compat_sys_epoll_ctl") ?, - kprobe.function("sys_epoll_ctl") ? -{ - name = "epoll_ctl" - asmlinkage() - epfd = int_arg(1) - op = int_arg(2) - op_str = _opoll_op_str(op) - fd = int_arg(3) - event_uaddr = pointer_arg(4) - argstr = sprintf("%d, %s, %d, %p", epfd, op_str, fd, event_uaddr) -} -probe nd_syscall.epoll_ctl.return = kprobe.function("compat_sys_epoll_ctl").return ?, - kprobe.function("sys_epoll_ctl").return ? -{ - name = "epoll_ctl" - retstr = returnstr(1) -} - # epoll_pwait _________________________________________________ # # long sys_epoll_pwait(int epfd, struct epoll_event __user *events, diff --git a/tapset/linux/sysc_epoll_ctl.stp b/tapset/linux/sysc_epoll_ctl.stp new file mode 100644 index 000000000..f0cceecfe --- /dev/null +++ b/tapset/linux/sysc_epoll_ctl.stp @@ -0,0 +1,60 @@ +# epoll_ctl __________________________________________________ +# +# long sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event) +# long compat_sys_epoll_ctl(int epfd, int op, int fd, +# struct compat_epoll_event __user *event) +# + +@define _SYSCALL_EPOLL_CTL_NAME +%( + name = "epoll_ctl" +%) + +@define _SYSCALL_EPOLL_CTL_ARGSTR +%( + argstr = sprintf("%d, %s, %d, %p", epfd, op_str, fd, event_uaddr) +%) + +probe syscall.epoll_ctl = dw_syscall.epoll_ctl !, nd_syscall.epoll_ctl {} +probe syscall.epoll_ctl.return = dw_syscall.epoll_ctl.return !, nd_syscall.epoll_ctl.return {} + +# dw_epoll_ctl _____________________________________________________ + +probe dw_syscall.epoll_ctl = kernel.function("compat_sys_epoll_ctl").call ?, + kernel.function("sys_epoll_ctl").call ? +{ + @_SYSCALL_EPOLL_CTL_NAME + epfd = __int32($epfd) + op = $op + op_str = _opoll_op_str($op) + fd = __int32($fd) + event_uaddr = $event + @_SYSCALL_EPOLL_CTL_ARGSTR +} +probe dw_syscall.epoll_ctl.return = kernel.function("compat_sys_epoll_ctl").return ?, + kernel.function("sys_epoll_ctl").return ? +{ + @_SYSCALL_EPOLL_CTL_NAME + retstr = return_str(1, $return) +} + +# nd_epoll_ctl _____________________________________________________ + +probe nd_syscall.epoll_ctl = kprobe.function("compat_sys_epoll_ctl") ?, + kprobe.function("sys_epoll_ctl") ? +{ + @_SYSCALL_EPOLL_CTL_NAME + asmlinkage() + epfd = int_arg(1) + op = int_arg(2) + op_str = _opoll_op_str(op) + fd = int_arg(3) + event_uaddr = pointer_arg(4) + @_SYSCALL_EPOLL_CTL_ARGSTR +} +probe nd_syscall.epoll_ctl.return = kprobe.function("compat_sys_epoll_ctl").return ?, + kprobe.function("sys_epoll_ctl").return ? +{ + @_SYSCALL_EPOLL_CTL_NAME + retstr = returnstr(1) +} diff --git a/tapset/linux/syscalls.stp b/tapset/linux/syscalls.stp index bd1419bbf..6fd55443b 100644 --- a/tapset/linux/syscalls.stp +++ b/tapset/linux/syscalls.stp @@ -1,28 +1,4 @@ -# epoll_ctl __________________________________________________ -# -# long sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event) -# long compat_sys_epoll_ctl(int epfd, int op, int fd, -# struct compat_epoll_event __user *event) -# -probe syscall.epoll_ctl = kernel.function("compat_sys_epoll_ctl").call ?, - kernel.function("sys_epoll_ctl").call ? -{ - name = "epoll_ctl" - epfd = __int32($epfd) - op = $op - op_str = _opoll_op_str($op) - fd = __int32($fd) - event_uaddr = $event - argstr = sprintf("%d, %s, %d, %p", epfd, _opoll_op_str($op), fd, $event) -} -probe syscall.epoll_ctl.return = kernel.function("compat_sys_epoll_ctl").return ?, - kernel.function("sys_epoll_ctl").return ? -{ - name = "epoll_ctl" - retstr = return_str(1, $return) -} - # epoll_pwait _________________________________________________ # # long sys_epoll_pwait(int epfd, struct epoll_event __user *events, -- 2.43.5