관리-도구
편집 파일: sysc_timer_delete.stp
# timer_delete _______________________________________________ # # long sys_timer_delete(timer_t timer_id) # @define _SYSCALL_TIMER_DELETE_NAME %( name = "timer_delete" %) @define _SYSCALL_TIMER_DELETE_ARGSTR %( argstr = sprint(timerid) %) @define _SYSCALL_TIMER_DELETE_REGARGS %( timerid = int_arg(1) %) probe syscall.timer_delete = dw_syscall.timer_delete !, nd_syscall.timer_delete ? {} probe syscall.timer_delete.return = dw_syscall.timer_delete.return !, nd_syscall.timer_delete.return ? {} # dw_timer_delete _____________________________________________________ probe dw_syscall.timer_delete = kernel.function("sys_timer_delete").call { @_SYSCALL_TIMER_DELETE_NAME timerid = __int32($timer_id) @_SYSCALL_TIMER_DELETE_ARGSTR } probe dw_syscall.timer_delete.return = kernel.function("sys_timer_delete").return { @_SYSCALL_TIMER_DELETE_NAME @SYSC_RETVALSTR($return) } # nd_timer_delete _____________________________________________________ probe nd_syscall.timer_delete = nd1_syscall.timer_delete!, nd2_syscall.timer_delete!, tp_syscall.timer_delete { } probe nd1_syscall.timer_delete = kprobe.function("sys_timer_delete") ? { @_SYSCALL_TIMER_DELETE_NAME asmlinkage() @_SYSCALL_TIMER_DELETE_REGARGS @_SYSCALL_TIMER_DELETE_ARGSTR } /* kernel 4.17+ */ probe nd2_syscall.timer_delete = kprobe.function(@arch_syscall_prefix "sys_timer_delete") ? { __set_syscall_pt_regs(pointer_arg(1)) @_SYSCALL_TIMER_DELETE_NAME @_SYSCALL_TIMER_DELETE_REGARGS @_SYSCALL_TIMER_DELETE_ARGSTR } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.timer_delete = kernel.trace("sys_enter") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_timer_delete"), @const("__NR_compat_timer_delete")) @_SYSCALL_TIMER_DELETE_NAME @_SYSCALL_TIMER_DELETE_REGARGS @_SYSCALL_TIMER_DELETE_ARGSTR } probe nd_syscall.timer_delete.return = nd1_syscall.timer_delete.return!, nd2_syscall.timer_delete.return!, tp_syscall.timer_delete.return { } probe nd1_syscall.timer_delete.return = kprobe.function("sys_timer_delete").return ? { @_SYSCALL_TIMER_DELETE_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 4.17+ */ probe nd2_syscall.timer_delete.return = kprobe.function(@arch_syscall_prefix "sys_timer_delete").return ? { @_SYSCALL_TIMER_DELETE_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.timer_delete.return = kernel.trace("sys_exit") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_timer_delete"), @const("__NR_compat_timer_delete")) @_SYSCALL_TIMER_DELETE_NAME @SYSC_RETVALSTR($ret) }