관리-도구
편집 파일: sysc_getpgid.stp
# getpgid ____________________________________________________ # long sys_getpgid(pid_t pid) @define _SYSCALL_GETPGID_NAME %( name = "getpgid" %) @define _SYSCALL_GETPGID_ARGSTR %( argstr = sprintf("%d", pid) %) @define _SYSCALL_GETPGID_REGARGS %( pid = int_arg(1) %) probe syscall.getpgid = dw_syscall.getpgid !, nd_syscall.getpgid ? {} probe syscall.getpgid.return = dw_syscall.getpgid.return !, nd_syscall.getpgid.return ? {} # dw_getpgid _____________________________________________________ probe dw_syscall.getpgid = kernel.function("sys_getpgid").call { @__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) @_SYSCALL_GETPGID_NAME pid = __int32($pid) @_SYSCALL_GETPGID_ARGSTR } probe dw_syscall.getpgid.return = kernel.function("sys_getpgid").return { @__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) @_SYSCALL_GETPGID_NAME @SYSC_RETVALSTR($return) } # nd_getpgid _____________________________________________________ probe nd_syscall.getpgid = nd1_syscall.getpgid!, nd2_syscall.getpgid!, tp_syscall.getpgid { } probe nd1_syscall.getpgid = kprobe.function("sys_getpgid") ? { @__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) @_SYSCALL_GETPGID_NAME asmlinkage() @_SYSCALL_GETPGID_REGARGS @_SYSCALL_GETPGID_ARGSTR } /* kernel 4.17+ */ probe nd2_syscall.getpgid = kprobe.function(@arch_syscall_prefix "sys_getpgid") ? { __set_syscall_pt_regs(pointer_arg(1)) @_SYSCALL_GETPGID_NAME @_SYSCALL_GETPGID_REGARGS @_SYSCALL_GETPGID_ARGSTR } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.getpgid = kernel.trace("sys_enter") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) @_SYSCALL_GETPGID_NAME @_SYSCALL_GETPGID_REGARGS @_SYSCALL_GETPGID_ARGSTR } probe nd_syscall.getpgid.return = nd1_syscall.getpgid.return!, nd2_syscall.getpgid.return!, tp_syscall.getpgid.return { } probe nd1_syscall.getpgid.return = kprobe.function("sys_getpgid").return ? { @__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) @_SYSCALL_GETPGID_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 4.17+ */ probe nd2_syscall.getpgid.return = kprobe.function(@arch_syscall_prefix "sys_getpgid").return ? { @_SYSCALL_GETPGID_NAME @SYSC_RETVALSTR(returnval()) } /* kernel 3.5+, but undesirable because it affects all syscalls */ probe tp_syscall.getpgid.return = kernel.trace("sys_exit") { __set_syscall_pt_regs($regs) @__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) @_SYSCALL_GETPGID_NAME @SYSC_RETVALSTR($ret) }