| 1 |
# sigpending _________________________________________________ |
| 2 |
# SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set) |
| 3 |
# COMPAT_SYSCALL_DEFINE1(sigpending, compat_old_sigset_t __user *, set) |
| 4 |
# |
| 5 |
|
| 6 |
@define _SYSCALL_SIGPENDING_NAME |
| 7 |
%( |
| 8 |
name = "sigpending" |
| 9 |
%) |
| 10 |
|
| 11 |
@define _SYSCALL_SIGPENDING_ARGSTR |
| 12 |
%( |
| 13 |
argstr = sprintf("%p", set) |
| 14 |
%) |
| 15 |
|
| 16 |
@define _SYSCALL_SIGPENDING_REGARGS |
| 17 |
%( |
| 18 |
set = pointer_arg(1) |
| 19 |
%) |
| 20 |
|
| 21 |
@define _SYSCALL_SIGPENDING_REGARGS_STORE |
| 22 |
%( |
| 23 |
if (@probewrite(set)) |
| 24 |
set_pointer_arg(1, set) |
| 25 |
%) |
| 26 |
|
| 27 |
probe syscall.sigpending = dw_syscall.sigpending !, nd_syscall.sigpending ? {} |
| 28 |
probe syscall.sigpending.return = dw_syscall.sigpending.return !, |
| 29 |
nd_syscall.sigpending.return ? {} |
| 30 |
|
| 31 |
# dw_sigpending _____________________________________________________ |
| 32 |
|
| 33 |
probe dw_syscall.sigpending = __syscall.sigpending ?, |
| 34 |
kernel.function("compat_sys_sigpending").call ? |
| 35 |
{ |
| 36 |
@_SYSCALL_SIGPENDING_NAME |
| 37 |
/* Kernel commit d53238cd51a80f6f changed $set to $uset in kernel/signal.c */ |
| 38 |
if (@defined($set32)) { |
| 39 |
set = $set32 |
| 40 |
} else { |
| 41 |
set = @choose_defined($uset, $set) |
| 42 |
} |
| 43 |
@_SYSCALL_SIGPENDING_ARGSTR |
| 44 |
} |
| 45 |
probe __syscall.sigpending = kernel.function("sys_sigpending").call ? |
| 46 |
{ |
| 47 |
@__syscall_gate_compat_simple |
| 48 |
} |
| 49 |
probe dw_syscall.sigpending.return = __syscall.sigpending.return ?, |
| 50 |
kernel.function("compat_sys_sigpending").return ? |
| 51 |
{ |
| 52 |
@_SYSCALL_SIGPENDING_NAME |
| 53 |
@SYSC_RETVALSTR($return) |
| 54 |
} |
| 55 |
probe __syscall.sigpending.return = kernel.function("sys_sigpending").return ? |
| 56 |
{ |
| 57 |
@__syscall_gate_compat_simple |
| 58 |
} |
| 59 |
|
| 60 |
# nd_sigpending _____________________________________________________ |
| 61 |
|
| 62 |
probe nd_syscall.sigpending = nd1_syscall.sigpending!, nd2_syscall.sigpending!, tp_syscall.sigpending |
| 63 |
{ } |
| 64 |
|
| 65 |
probe nd1_syscall.sigpending = __nd1_syscall.sigpending ?, |
| 66 |
kprobe.function("compat_sys_sigpending") ? |
| 67 |
{ |
| 68 |
@_SYSCALL_SIGPENDING_NAME |
| 69 |
asmlinkage() |
| 70 |
@_SYSCALL_SIGPENDING_REGARGS |
| 71 |
@_SYSCALL_SIGPENDING_ARGSTR |
| 72 |
} |
| 73 |
probe __nd1_syscall.sigpending = kprobe.function("sys_sigpending") ? |
| 74 |
{ |
| 75 |
@__syscall_gate_compat_simple |
| 76 |
} |
| 77 |
|
| 78 |
/* kernel 4.17+ */ |
| 79 |
probe nd2_syscall.sigpending = |
| 80 |
kprobe.function(@arch_syscall_prefix "compat_sys_sigpending") ? |
| 81 |
{ |
| 82 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 83 |
@_SYSCALL_SIGPENDING_NAME |
| 84 |
@_SYSCALL_SIGPENDING_REGARGS |
| 85 |
@_SYSCALL_SIGPENDING_ARGSTR |
| 86 |
}, |
| 87 |
{ |
| 88 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SIGPENDING_REGARGS_STORE %) |
| 89 |
} |
| 90 |
|
| 91 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 92 |
probe tp_syscall.sigpending = kernel.trace("sys_enter") |
| 93 |
{ |
| 94 |
__set_syscall_pt_regs($regs) |
| 95 |
@__syscall_compat_gate(@const("__NR_sigpending"), @const("__NR_compat_sigpending")) |
| 96 |
@_SYSCALL_SIGPENDING_NAME |
| 97 |
@_SYSCALL_SIGPENDING_REGARGS |
| 98 |
@_SYSCALL_SIGPENDING_ARGSTR |
| 99 |
}, |
| 100 |
{ |
| 101 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SIGPENDING_REGARGS_STORE %) |
| 102 |
} |
| 103 |
|
| 104 |
probe nd_syscall.sigpending.return = nd1_syscall.sigpending.return!, nd2_syscall.sigpending.return!, tp_syscall.sigpending.return |
| 105 |
{ } |
| 106 |
|
| 107 |
probe nd1_syscall.sigpending.return = __nd1_syscall.sigpending.return ?, |
| 108 |
kprobe.function("compat_sys_sigpending").return ? |
| 109 |
{ |
| 110 |
@_SYSCALL_SIGPENDING_NAME |
| 111 |
@SYSC_RETVALSTR(returnval()) |
| 112 |
} |
| 113 |
probe __nd1_syscall.sigpending.return = |
| 114 |
kprobe.function("sys_sigpending").return ? |
| 115 |
{ |
| 116 |
@__syscall_gate_compat_simple |
| 117 |
} |
| 118 |
|
| 119 |
/* kernel 4.17+ */ |
| 120 |
probe nd2_syscall.sigpending.return = |
| 121 |
kprobe.function(@arch_syscall_prefix "compat_sys_sigpending").return ? |
| 122 |
{ |
| 123 |
@_SYSCALL_SIGPENDING_NAME |
| 124 |
@SYSC_RETVALSTR(returnval()) |
| 125 |
} |
| 126 |
|
| 127 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 128 |
probe tp_syscall.sigpending.return = kernel.trace("sys_exit") |
| 129 |
{ |
| 130 |
__set_syscall_pt_regs($regs) |
| 131 |
@__syscall_compat_gate(@const("__NR_sigpending"), @const("__NR_compat_sigpending")) |
| 132 |
@_SYSCALL_SIGPENDING_NAME |
| 133 |
@SYSC_RETVALSTR($ret) |
| 134 |
} |