From 9be913167f826d79e13c35a0b9fcdc737c290200 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 3 Jan 2017 11:49:57 +0100 Subject: [PATCH] PR20333/statfs --- tapset/linux/nd_syscalls2.stp | 20 ------------- tapset/linux/sysc_statfs.stp | 53 +++++++++++++++++++++++++++++++++++ tapset/linux/syscalls2.stp | 22 --------------- 3 files changed, 53 insertions(+), 42 deletions(-) create mode 100644 tapset/linux/sysc_statfs.stp diff --git a/tapset/linux/nd_syscalls2.stp b/tapset/linux/nd_syscalls2.stp index a2a591832..5fc1874dd 100644 --- a/tapset/linux/nd_syscalls2.stp +++ b/tapset/linux/nd_syscalls2.stp @@ -1,24 +1,4 @@ -# statfs _____________________________________________________ -# long sys_statfs(const char __user * path, struct statfs __user * buf) -# long compat_sys_statfs(const char __user *path, struct compat_statfs __user *buf) -# -probe nd_syscall.statfs = kprobe.function("compat_sys_statfs") ?, - kprobe.function("sys_statfs") ? -{ - name = "statfs" - asmlinkage() - path = user_string_quoted(pointer_arg(1)) - buf_uaddr = pointer_arg(2) - argstr = sprintf("%s, %p", user_string_quoted(pointer_arg(1)), buf_uaddr) -} -probe nd_syscall.statfs.return = kprobe.function("compat_sys_statfs").return ?, - kprobe.function("sys_statfs").return ? -{ - name = "statfs" - retstr = returnstr(1) -} - # statfs64 ___________________________________________________ # # long sys_statfs64(const char __user *path, size_t sz, struct statfs64 __user *buf) diff --git a/tapset/linux/sysc_statfs.stp b/tapset/linux/sysc_statfs.stp new file mode 100644 index 000000000..59ce861c9 --- /dev/null +++ b/tapset/linux/sysc_statfs.stp @@ -0,0 +1,53 @@ +# statfs _____________________________________________________ +# long sys_statfs(const char __user * path, struct statfs __user * buf) +# long compat_sys_statfs(const char __user *path, struct compat_statfs __user *buf) +# + +@define _SYSCALL_STATFS_NAME +%( + name = "statfs" +%) + +@define _SYSCALL_STATFS_ARGSTR +%( + argstr = sprintf("%s, %p", path, buf_uaddr) +%) + +probe syscall.statfs = dw_syscall.statfs !, nd_syscall.statfs {} +probe syscall.statfs.return = dw_syscall.statfs.return !, nd_syscall.statfs.return {} + +# dw_statfs _____________________________________________________ + +probe dw_syscall.statfs = kernel.function("compat_sys_statfs").call ?, + kernel.function("sys_statfs").call ? +{ + @_SYSCALL_STATFS_NAME + buf_uaddr = $buf + path = user_string_quoted(@choose_defined($pathname, $path)) + @_SYSCALL_STATFS_ARGSTR +} + +probe dw_syscall.statfs.return = kernel.function("compat_sys_statfs").return ?, + kernel.function("sys_statfs").return ? +{ + @_SYSCALL_STATFS_NAME + retstr = return_str(1, $return) +} + +# nd_statfs _____________________________________________________ + +probe nd_syscall.statfs = kprobe.function("compat_sys_statfs") ?, + kprobe.function("sys_statfs") ? +{ + @_SYSCALL_STATFS_NAME + asmlinkage() + path = user_string_quoted(pointer_arg(1)) + buf_uaddr = pointer_arg(2) + @_SYSCALL_STATFS_ARGSTR +} +probe nd_syscall.statfs.return = kprobe.function("compat_sys_statfs").return ?, + kprobe.function("sys_statfs").return ? +{ + @_SYSCALL_STATFS_NAME + retstr = returnstr(1) +} diff --git a/tapset/linux/syscalls2.stp b/tapset/linux/syscalls2.stp index 46db90506..8a05ff7d8 100644 --- a/tapset/linux/syscalls2.stp +++ b/tapset/linux/syscalls2.stp @@ -1,26 +1,4 @@ -# statfs _____________________________________________________ -# long sys_statfs(const char __user * path, struct statfs __user * buf) -# long compat_sys_statfs(const char __user *path, struct compat_statfs __user *buf) -# -probe syscall.statfs = kernel.function("compat_sys_statfs").call ?, - kernel.function("sys_statfs").call ? -{ - name = "statfs" - buf_uaddr = $buf - path = user_string_quoted(@choose_defined($pathname, $path)) - argstr = sprintf("%s, %p", - user_string_quoted(@choose_defined($pathname, $path)), - $buf) -} - -probe syscall.statfs.return = kernel.function("compat_sys_statfs").return ?, - kernel.function("sys_statfs").return ? -{ - name = "statfs" - retstr = return_str(1, $return) -} - # statfs64 ___________________________________________________ # # long sys_statfs64(const char __user *path, size_t sz, struct statfs64 __user *buf) -- 2.43.5