| 1 |
# getpgid ____________________________________________________ |
| 2 |
# long sys_getpgid(pid_t pid) |
| 3 |
|
| 4 |
@define _SYSCALL_GETPGID_NAME |
| 5 |
%( |
| 6 |
name = "getpgid" |
| 7 |
%) |
| 8 |
|
| 9 |
@define _SYSCALL_GETPGID_ARGSTR |
| 10 |
%( |
| 11 |
argstr = sprintf("%d", pid) |
| 12 |
%) |
| 13 |
|
| 14 |
@define _SYSCALL_GETPGID_REGARGS |
| 15 |
%( |
| 16 |
pid = int_arg(1) |
| 17 |
%) |
| 18 |
|
| 19 |
@define _SYSCALL_GETPGID_REGARGS_STORE |
| 20 |
%( |
| 21 |
if (@probewrite(pid)) |
| 22 |
set_int_arg(1, pid) |
| 23 |
%) |
| 24 |
|
| 25 |
probe syscall.getpgid = dw_syscall.getpgid !, nd_syscall.getpgid ? {} |
| 26 |
probe syscall.getpgid.return = dw_syscall.getpgid.return !, nd_syscall.getpgid.return ? {} |
| 27 |
|
| 28 |
# dw_getpgid _____________________________________________________ |
| 29 |
|
| 30 |
probe dw_syscall.getpgid = kernel.function("sys_getpgid").call |
| 31 |
{ |
| 32 |
@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) |
| 33 |
@_SYSCALL_GETPGID_NAME |
| 34 |
pid = __int32($pid) |
| 35 |
@_SYSCALL_GETPGID_ARGSTR |
| 36 |
} |
| 37 |
probe dw_syscall.getpgid.return = kernel.function("sys_getpgid").return |
| 38 |
{ |
| 39 |
@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) |
| 40 |
@_SYSCALL_GETPGID_NAME |
| 41 |
@SYSC_RETVALSTR($return) |
| 42 |
} |
| 43 |
|
| 44 |
# nd_getpgid _____________________________________________________ |
| 45 |
|
| 46 |
probe nd_syscall.getpgid = nd1_syscall.getpgid!, nd2_syscall.getpgid!, tp_syscall.getpgid |
| 47 |
{ } |
| 48 |
|
| 49 |
probe nd1_syscall.getpgid = kprobe.function("sys_getpgid") ? |
| 50 |
{ |
| 51 |
@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) |
| 52 |
@_SYSCALL_GETPGID_NAME |
| 53 |
asmlinkage() |
| 54 |
@_SYSCALL_GETPGID_REGARGS |
| 55 |
@_SYSCALL_GETPGID_ARGSTR |
| 56 |
} |
| 57 |
|
| 58 |
/* kernel 4.17+ */ |
| 59 |
probe nd2_syscall.getpgid = kprobe.function(@arch_syscall_prefix "sys_getpgid") ? |
| 60 |
{ |
| 61 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 62 |
@_SYSCALL_GETPGID_NAME |
| 63 |
@_SYSCALL_GETPGID_REGARGS |
| 64 |
@_SYSCALL_GETPGID_ARGSTR |
| 65 |
}, |
| 66 |
{ |
| 67 |
@_SYSCALL_GETPGID_REGARGS_STORE |
| 68 |
} |
| 69 |
|
| 70 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 71 |
probe tp_syscall.getpgid = kernel.trace("sys_enter") |
| 72 |
{ |
| 73 |
__set_syscall_pt_regs($regs) |
| 74 |
@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) |
| 75 |
@_SYSCALL_GETPGID_NAME |
| 76 |
@_SYSCALL_GETPGID_REGARGS |
| 77 |
@_SYSCALL_GETPGID_ARGSTR |
| 78 |
}, |
| 79 |
{ |
| 80 |
@_SYSCALL_GETPGID_REGARGS_STORE |
| 81 |
} |
| 82 |
|
| 83 |
probe nd_syscall.getpgid.return = nd1_syscall.getpgid.return!, nd2_syscall.getpgid.return!, tp_syscall.getpgid.return |
| 84 |
{ } |
| 85 |
|
| 86 |
probe nd1_syscall.getpgid.return = kprobe.function("sys_getpgid").return ? |
| 87 |
{ |
| 88 |
@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) |
| 89 |
@_SYSCALL_GETPGID_NAME |
| 90 |
@SYSC_RETVALSTR(returnval()) |
| 91 |
} |
| 92 |
|
| 93 |
/* kernel 4.17+ */ |
| 94 |
probe nd2_syscall.getpgid.return = kprobe.function(@arch_syscall_prefix "sys_getpgid").return ? |
| 95 |
{ |
| 96 |
@_SYSCALL_GETPGID_NAME |
| 97 |
@SYSC_RETVALSTR(returnval()) |
| 98 |
} |
| 99 |
|
| 100 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 101 |
probe tp_syscall.getpgid.return = kernel.trace("sys_exit") |
| 102 |
{ |
| 103 |
__set_syscall_pt_regs($regs) |
| 104 |
@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid")) |
| 105 |
@_SYSCALL_GETPGID_NAME |
| 106 |
@SYSC_RETVALSTR($ret) |
| 107 |
} |