관리-도구
편집 파일: sysc_sched_setscheduler.stp
# sched_setscheduler _________________________________________ # # long sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) # @define _SYSCALL_SCHED_SETSCHEDULER_NAME %( name = "sched_setscheduler" %) @define _SYSCALL_SCHED_SETSCHEDULER_ARGSTR %( argstr = sprintf("%d, %s, %p", pid, policy_str, p_uaddr) %) @define _SYSCALL_SCHED_SETSCHEDULER_REGARGS %( pid = int_arg(1) policy = int_arg(2) policy_str = _sched_policy_str(policy) p_uaddr = pointer_arg(3) %) probe syscall.sched_setscheduler = dw_syscall.sched_setscheduler !, nd_syscall.sched_setscheduler ? {} probe syscall.sched_setscheduler.return = dw_syscall.sched_setscheduler.return !, nd_syscall.sched_setscheduler.return ? {} # dw_sched_setscheduler _____________________________________________________ probe dw_syscall.sched_setscheduler = kernel.function("sys_sched_setscheduler").call ? { @_SYSCALL_SCHED_SETSCHEDULER_NAME pid = __int32($pid) policy = __int32($policy) policy_str = _sched_policy_str(policy) p_uaddr = $param @_SYSCALL_SCHED_SETSCHEDULER_ARGSTR } probe dw_syscall.sched_setscheduler.return = kernel.function("sys_sched_setscheduler").return ? { @_SYSCALL_SCHED_SETSCHEDULER_NAME @SYSC_RETVALSTR($return) } # nd_sched_setscheduler _____________________________________________________ probe nd_syscall.sched_setscheduler = nd1_syscall.sched_setscheduler!, nd2_syscall.sched_setscheduler!, tp_syscall.sched_setscheduler { } probe nd1_syscall.sched_setscheduler = kprobe.function("sys_sched_setscheduler") ? { @_SYSCALL_SCHED_SETSCHEDULER_NAME asmlinkage() @_SYSCALL_SCHED_SETSCHEDULER_REGARGS @_SYSCALL_SCHED_SETSCHEDULER_ARGSTR } /* kernel 4.17+ */ probe nd2_syscall.sched_setscheduler = kprobe.function(@arch_syscall_prefix "sys_sched_setscheduler") ? { __set_syscall_pt_regs(pointer_arg(1)) @_SYSCALL_SCHED_SETSCHEDULER_NAME @_SYSCALL_SCHED_SETSCHEDULER_REGARGS @_SYSCALL_SCHED_SETSCHEDULER_ARGSTR } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.sched_setscheduler = kernel.trace("sys_enter") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_sched_setscheduler"), @const("__NR_compat_sched_setscheduler")) @_SYSCALL_SCHED_SETSCHEDULER_NAME @_SYSCALL_SCHED_SETSCHEDULER_REGARGS @_SYSCALL_SCHED_SETSCHEDULER_ARGSTR } probe nd_syscall.sched_setscheduler.return = nd1_syscall.sched_setscheduler.return!, nd2_syscall.sched_setscheduler.return!, tp_syscall.sched_setscheduler.return { } probe nd1_syscall.sched_setscheduler.return = kprobe.function("sys_sched_setscheduler").return ? { @_SYSCALL_SCHED_SETSCHEDULER_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 4.17+ */ probe nd2_syscall.sched_setscheduler.return = kprobe.function(@arch_syscall_prefix "sys_sched_setscheduler").return ? { @_SYSCALL_SCHED_SETSCHEDULER_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.sched_setscheduler.return = kernel.trace("sys_exit") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_sched_setscheduler"), @const("__NR_compat_sched_setscheduler")) @_SYSCALL_SCHED_SETSCHEDULER_NAME @SYSC_RETVALSTR($ret) }