From 077aa702444403161522f9998a6f2fc8c6b0fe8d Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Mon, 2 Jan 2017 06:56:42 +0100 Subject: [PATCH] PR20333/mkdir --- tapset/linux/nd_syscalls.stp | 17 ------------- tapset/linux/sysc_mkdir.stp | 48 ++++++++++++++++++++++++++++++++++++ tapset/linux/syscalls.stp | 17 ------------- 3 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 tapset/linux/sysc_mkdir.stp diff --git a/tapset/linux/nd_syscalls.stp b/tapset/linux/nd_syscalls.stp index 3550ac148..5673c0493 100644 --- a/tapset/linux/nd_syscalls.stp +++ b/tapset/linux/nd_syscalls.stp @@ -1,21 +1,4 @@ -# mkdir ______________________________________________________ -# long sys_mkdir(const char __user * pathname, int mode) -probe nd_syscall.mkdir = kprobe.function("sys_mkdir") ? -{ - name = "mkdir" - asmlinkage() - pathname_uaddr = pointer_arg(1) - pathname = user_string_quoted(pathname_uaddr) - mode = uint_arg(2) - argstr = sprintf("%s, %#o", user_string_quoted(pathname_uaddr), mode) -} -probe nd_syscall.mkdir.return = kprobe.function("sys_mkdir").return ? -{ - name = "mkdir" - retstr = returnstr(1) -} - # mkdirat ____________________________________________________ # new function with 2.6.16 # long sys_mkdirat(int dfd, const char __user *pathname, int mode) diff --git a/tapset/linux/sysc_mkdir.stp b/tapset/linux/sysc_mkdir.stp new file mode 100644 index 000000000..23a34d35e --- /dev/null +++ b/tapset/linux/sysc_mkdir.stp @@ -0,0 +1,48 @@ +# mkdir ______________________________________________________ +# long sys_mkdir(const char __user * pathname, int mode) + +@define _SYSCALL_MKDIR_NAME +%( + name = "mkdir" +%) + +@define _SYSCALL_MKDIR_ARGSTR +%( + argstr = sprintf("%s, %#o", pathname, mode) +%) + +probe syscall.mkdir = dw_syscall.mkdir !, nd_syscall.mkdir {} +probe syscall.mkdir.return = dw_syscall.mkdir.return !, nd_syscall.mkdir.return {} + +# dw_mkdir _____________________________________________________ + +probe dw_syscall.mkdir = kernel.function("sys_mkdir").call +{ + @_SYSCALL_MKDIR_NAME + pathname_uaddr = $pathname + pathname = user_string_quoted($pathname) + mode = __uint32($mode) + @_SYSCALL_MKDIR_ARGSTR +} +probe dw_syscall.mkdir.return = kernel.function("sys_mkdir").return +{ + @_SYSCALL_MKDIR_NAME + retstr = return_str(1, $return) +} + +# nd_mkdir _____________________________________________________ + +probe nd_syscall.mkdir = kprobe.function("sys_mkdir") ? +{ + @_SYSCALL_MKDIR_NAME + asmlinkage() + pathname_uaddr = pointer_arg(1) + pathname = user_string_quoted(pathname_uaddr) + mode = uint_arg(2) + @_SYSCALL_MKDIR_ARGSTR +} +probe nd_syscall.mkdir.return = kprobe.function("sys_mkdir").return ? +{ + @_SYSCALL_MKDIR_NAME + retstr = returnstr(1) +} diff --git a/tapset/linux/syscalls.stp b/tapset/linux/syscalls.stp index 24261e054..e601ec1fc 100644 --- a/tapset/linux/syscalls.stp +++ b/tapset/linux/syscalls.stp @@ -1,21 +1,4 @@ -# mkdir ______________________________________________________ -# long sys_mkdir(const char __user * pathname, int mode) -probe syscall.mkdir = kernel.function("sys_mkdir").call -{ - name = "mkdir" - pathname_uaddr = $pathname - pathname = user_string_quoted($pathname) - mode = __uint32($mode) - argstr = sprintf("%s, %#o", user_string_quoted($pathname), - __uint32($mode)) -} -probe syscall.mkdir.return = kernel.function("sys_mkdir").return -{ - name = "mkdir" - retstr = return_str(1, $return) -} - # mkdirat ____________________________________________________ # new function with 2.6.16 # long sys_mkdirat(int dfd, const char __user *pathname, int mode) -- 2.43.5