관리-도구
편집 파일: sysc_timerfd_settime.stp
# timerfd_settime ____________________________________________ # # SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, # const struct itimerspec __user *, utmr, # struct itimerspec __user *, otmr) # COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, # const struct compat_itimerspec __user *, utmr, # struct compat_itimerspec __user *, otmr) @define _SYSCALL_TIMERFD_SETTIME_NAME %( name = "timerfd_settime" %) @define _SYSCALL_TIMERFD_SETTIME_ARGSTR %( argstr = sprintf("%d, %s, %s, %p", fd, flags_str, value_str, ovalue_uaddr) %) @define _SYSCALL_TIMERFD_SETTIME_REGARGS %( fd = int_arg(1) flags = int_arg(2) flags_str = _stp_timerfd_flags_str(flags) value_uaddr = pointer_arg(3) %( CONFIG_COMPAT == "y" %? value_str = (@__compat_task ? _struct_compat_itimerspec_u(value_uaddr) : _struct_itimerspec_u(value_uaddr)) %: value_str = _struct_itimerspec_u(value_uaddr) %) ovalue_uaddr = pointer_arg(4) %) probe syscall.timerfd_settime = dw_syscall.timerfd_settime !, nd_syscall.timerfd_settime ? {} probe syscall.timerfd_settime.return = dw_syscall.timerfd_settime.return !, nd_syscall.timerfd_settime.return ? {} # dw_timerfd_settime _____________________________________________________ probe dw_syscall.timerfd_settime = __syscall.timerfd_settime ?, kernel.function("compat_sys_timerfd_settime").call ? { @_SYSCALL_TIMERFD_SETTIME_NAME fd = __int32($ufd) flags = __int32($flags) flags_str = _stp_timerfd_flags_str(flags) value_uaddr = @__pointer($utmr) ovalue_uaddr = @__pointer($otmr) %( CONFIG_COMPAT == "y" %? value_str = (@__compat_task ? _struct_compat_itimerspec_u(value_uaddr) : _struct_itimerspec_u(value_uaddr)) %: value_str = _struct_itimerspec_u(value_uaddr) %) @_SYSCALL_TIMERFD_SETTIME_ARGSTR } probe __syscall.timerfd_settime = kernel.function("sys_timerfd_settime").call ? { @__syscall_gate_compat_simple } probe dw_syscall.timerfd_settime.return = __syscall.timerfd_settime.return ?, kernel.function("compat_sys_timerfd_settime").return ? { @_SYSCALL_TIMERFD_SETTIME_NAME @SYSC_RETVALSTR($return) } probe __syscall.timerfd_settime.return = kernel.function("sys_timerfd_settime").return ? { @__syscall_gate_compat_simple } # nd_timerfd_settime _____________________________________________________ probe nd_syscall.timerfd_settime = nd1_syscall.timerfd_settime!, nd2_syscall.timerfd_settime!, tp_syscall.timerfd_settime { } probe nd1_syscall.timerfd_settime = __nd1_syscall.timerfd_settime ?, __nd1_syscall.compat_timerfd_settime ? { @_SYSCALL_TIMERFD_SETTIME_NAME } probe __nd1_syscall.timerfd_settime = kprobe.function("sys_timerfd_settime").call ? { @__syscall_gate_compat_simple asmlinkage() @_SYSCALL_TIMERFD_SETTIME_REGARGS @_SYSCALL_TIMERFD_SETTIME_ARGSTR } probe __nd1_syscall.compat_timerfd_settime = kprobe.function("compat_sys_timerfd_settime").call ? { asmlinkage() @_SYSCALL_TIMERFD_SETTIME_REGARGS @_SYSCALL_TIMERFD_SETTIME_ARGSTR } /* kernel 4.17+ */ probe nd2_syscall.timerfd_settime = kprobe.function(@arch_syscall_prefix "sys_timerfd_settime") ?, kprobe.function(@arch_syscall_prefix "compat_sys_timerfd_settime") ? { __set_syscall_pt_regs(pointer_arg(1)) @_SYSCALL_TIMERFD_SETTIME_NAME @_SYSCALL_TIMERFD_SETTIME_REGARGS @_SYSCALL_TIMERFD_SETTIME_ARGSTR } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.timerfd_settime = kernel.trace("sys_enter") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_timerfd_settime"), @const("__NR_compat_timerfd_settime")) @_SYSCALL_TIMERFD_SETTIME_NAME @_SYSCALL_TIMERFD_SETTIME_REGARGS @_SYSCALL_TIMERFD_SETTIME_ARGSTR } probe nd_syscall.timerfd_settime.return = nd1_syscall.timerfd_settime.return!, nd2_syscall.timerfd_settime.return!, tp_syscall.timerfd_settime.return { } probe nd1_syscall.timerfd_settime.return = __nd1_syscall.timerfd_settime.return ?, kprobe.function("compat_sys_timerfd_settime").return ? { @_SYSCALL_TIMERFD_SETTIME_NAME @SYSC_RETVALSTR(returnval()) } probe __nd1_syscall.timerfd_settime.return = kprobe.function("sys_timerfd_settime").return ? { @__syscall_gate_compat_simple } /* kernel 4.17+ */ probe nd2_syscall.timerfd_settime.return = kprobe.function(@arch_syscall_prefix "sys_timerfd_settime").return ?, kprobe.function(@arch_syscall_prefix "compat_sys_timerfd_settime").return ? { @_SYSCALL_TIMERFD_SETTIME_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.timerfd_settime.return = kernel.trace("sys_exit") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_timerfd_settime"), @const("__NR_compat_timerfd_settime")) @_SYSCALL_TIMERFD_SETTIME_NAME @SYSC_RETVALSTR($ret) }