관리-도구
편집 파일: sysc_lchown16.stp
# lchown16 ___________________________________________________ # long sys_lchown16(const char __user * filename, old_uid_t user, # old_gid_t group) # @define _SYSCALL_LCHOWN16_NAME %( name = "lchown16" %) @define _SYSCALL_LCHOWN16_ARGSTR %( argstr = sprintf("%s, %d, %d", path, owner, group) %) @define _SYSCALL_LCHOWN16_REGARGS %( path = user_string_quoted(pointer_arg(1)) owner = __short(uint_arg(2)) group = __short(uint_arg(3)) %) probe syscall.lchown16 = dw_syscall.lchown16 !, nd_syscall.lchown16 ? {} probe syscall.lchown16.return = dw_syscall.lchown16.return !, nd_syscall.lchown16.return ? {} # dw_lchown16 _____________________________________________________ probe dw_syscall.lchown16 = kernel.function("sys_lchown16").call ? { @_SYSCALL_LCHOWN16_NAME path = user_string_quoted($filename) owner = __short($user) group = __short($group) @_SYSCALL_LCHOWN16_ARGSTR } probe dw_syscall.lchown16.return = kernel.function("sys_lchown16").return ? { @_SYSCALL_LCHOWN16_NAME @SYSC_RETVALSTR($return) } # nd_lchown16 _____________________________________________________ probe nd_syscall.lchown16 = nd1_syscall.lchown16!, nd2_syscall.lchown16!, tp_syscall.lchown16 { } probe nd1_syscall.lchown16 = kprobe.function("sys_lchown16") ? { @_SYSCALL_LCHOWN16_NAME asmlinkage() @_SYSCALL_LCHOWN16_REGARGS @_SYSCALL_LCHOWN16_ARGSTR } /* kernel 4.17+ */ probe nd2_syscall.lchown16 = kprobe.function(@arch_syscall_prefix "sys_lchown16") ? { __set_syscall_pt_regs(pointer_arg(1)) @_SYSCALL_LCHOWN16_NAME @_SYSCALL_LCHOWN16_REGARGS @_SYSCALL_LCHOWN16_ARGSTR } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.lchown16 = kernel.trace("sys_enter") { __set_syscall_pt_regs($regs) %( CONFIG_64BIT == "y" %? @__compat_syscall_gate(@const("__NR_compat_lchown")) %: @__syscall_gate(@const("__NR_lchown")) %) @_SYSCALL_LCHOWN16_NAME @_SYSCALL_LCHOWN16_REGARGS @_SYSCALL_LCHOWN16_ARGSTR } probe nd_syscall.lchown16.return = nd1_syscall.lchown16.return!, nd2_syscall.lchown16.return!, tp_syscall.lchown16.return { } probe nd1_syscall.lchown16.return = kprobe.function("sys_lchown16").return ? { @_SYSCALL_LCHOWN16_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 4.17+ */ probe nd2_syscall.lchown16.return = kprobe.function(@arch_syscall_prefix "sys_lchown16").return ? { @_SYSCALL_LCHOWN16_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.lchown16.return = kernel.trace("sys_exit") { __set_syscall_pt_regs($regs) %( CONFIG_64BIT == "y" %? @__compat_syscall_gate(@const("__NR_compat_lchown")) %: @__syscall_gate(@const("__NR_lchown")) %) @_SYSCALL_LCHOWN16_NAME @SYSC_RETVALSTR($ret) }