| 1 |
# rt_sigaction _______________________________________________ |
| 2 |
# |
| 3 |
# sys_rt_sigaction(int sig, |
| 4 |
# const struct sigaction __user *act, |
| 5 |
# struct sigaction __user *oact, |
| 6 |
# size_t sigsetsize) |
| 7 |
# |
| 8 |
|
| 9 |
@define _SYSCALL_RT_SIGACTION_NAME |
| 10 |
%( |
| 11 |
name = "rt_sigaction" |
| 12 |
%) |
| 13 |
|
| 14 |
@define _SYSCALL_RT_SIGACTION_ARGSTR |
| 15 |
%( |
| 16 |
argstr = sprintf("%s, {%s}, %p, %d", sig_str, act_str, oact_uaddr, sigsetsize) |
| 17 |
%) |
| 18 |
|
| 19 |
@define _SYSCALL_RT_SIGACTION_REGARGS |
| 20 |
%( |
| 21 |
sig = int_arg(1) |
| 22 |
sig_str = _signal_name(sig) |
| 23 |
act_uaddr = pointer_arg(2) |
| 24 |
act_str = _struct_sigaction_u(act_uaddr) |
| 25 |
oact_uaddr = pointer_arg(3) |
| 26 |
sigsetsize = ulong_arg(4) |
| 27 |
%) |
| 28 |
|
| 29 |
@define _SYSCALL_RT_SIGACTION_REGARGS_STORE |
| 30 |
%( |
| 31 |
if (@probewrite(sig)) |
| 32 |
set_int_arg(1, sig) |
| 33 |
|
| 34 |
if (@probewrite(act_uaddr)) |
| 35 |
set_pointer_arg(2, act_uaddr) |
| 36 |
|
| 37 |
if (@probewrite(oact_uaddr)) |
| 38 |
set_pointer_arg(3, oact_uaddr) |
| 39 |
|
| 40 |
if (@probewrite(sigsetsize)) |
| 41 |
set_ulong_arg(4, sigsetsize) |
| 42 |
%) |
| 43 |
|
| 44 |
@define _SYSCALL_RT_SIGACTION32_REGARGS |
| 45 |
%( |
| 46 |
sig = int_arg(1) |
| 47 |
sig_str = _signal_name(sig) |
| 48 |
act_uaddr = pointer_arg(2) |
| 49 |
act_str = _struct_sigaction32_u(act_uaddr) |
| 50 |
oact_uaddr = pointer_arg(3) |
| 51 |
sigsetsize = uint_arg(4) |
| 52 |
%) |
| 53 |
|
| 54 |
probe syscall.rt_sigaction = dw_syscall.rt_sigaction !, nd_syscall.rt_sigaction ? {} |
| 55 |
probe syscall.rt_sigaction.return = dw_syscall.rt_sigaction.return !, |
| 56 |
nd_syscall.rt_sigaction.return ? {} |
| 57 |
|
| 58 |
# dw_rt_sigaction _____________________________________________________ |
| 59 |
|
| 60 |
probe dw_syscall.rt_sigaction = kernel.function("sys_rt_sigaction").call ? |
| 61 |
{ |
| 62 |
@_SYSCALL_RT_SIGACTION_NAME |
| 63 |
sig = __int32($sig) |
| 64 |
sig_str = _signal_name(sig) |
| 65 |
act_uaddr = $act |
| 66 |
act_str = _struct_sigaction_u(act_uaddr) |
| 67 |
oact_uaddr = $oact |
| 68 |
sigsetsize = $sigsetsize |
| 69 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 70 |
} |
| 71 |
probe dw_syscall.rt_sigaction.return = kernel.function("sys_rt_sigaction").return ? |
| 72 |
{ |
| 73 |
@_SYSCALL_RT_SIGACTION_NAME |
| 74 |
@SYSC_RETVALSTR($return) |
| 75 |
} |
| 76 |
|
| 77 |
# nd_rt_sigaction _____________________________________________________ |
| 78 |
|
| 79 |
probe nd_syscall.rt_sigaction = nd1_syscall.rt_sigaction!, nd2_syscall.rt_sigaction!, tp_syscall.rt_sigaction |
| 80 |
{ } |
| 81 |
|
| 82 |
probe nd1_syscall.rt_sigaction = kprobe.function("sys_rt_sigaction") ? |
| 83 |
{ |
| 84 |
@_SYSCALL_RT_SIGACTION_NAME |
| 85 |
asmlinkage() |
| 86 |
@_SYSCALL_RT_SIGACTION_REGARGS |
| 87 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 88 |
} |
| 89 |
|
| 90 |
/* kernel 4.17+ */ |
| 91 |
probe nd2_syscall.rt_sigaction = kprobe.function(@arch_syscall_prefix "sys_rt_sigaction") ? |
| 92 |
{ |
| 93 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 94 |
@_SYSCALL_RT_SIGACTION_NAME |
| 95 |
@_SYSCALL_RT_SIGACTION_REGARGS |
| 96 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 97 |
}, |
| 98 |
{ |
| 99 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_RT_SIGACTION_REGARGS_STORE %) |
| 100 |
} |
| 101 |
|
| 102 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 103 |
probe tp_syscall.rt_sigaction = kernel.trace("sys_enter") |
| 104 |
{ |
| 105 |
__set_syscall_pt_regs($regs) |
| 106 |
@__syscall_gate(@const("__NR_rt_sigaction")) |
| 107 |
@_SYSCALL_RT_SIGACTION_NAME |
| 108 |
@_SYSCALL_RT_SIGACTION_REGARGS |
| 109 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 110 |
}, |
| 111 |
{ |
| 112 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_RT_SIGACTION_REGARGS_STORE %) |
| 113 |
} |
| 114 |
|
| 115 |
probe nd_syscall.rt_sigaction.return = nd1_syscall.rt_sigaction.return!, nd2_syscall.rt_sigaction.return!, tp_syscall.rt_sigaction.return |
| 116 |
{ } |
| 117 |
|
| 118 |
probe nd1_syscall.rt_sigaction.return = |
| 119 |
kprobe.function("sys_rt_sigaction").return ? |
| 120 |
{ |
| 121 |
@_SYSCALL_RT_SIGACTION_NAME |
| 122 |
@SYSC_RETVALSTR(returnval()) |
| 123 |
} |
| 124 |
|
| 125 |
/* kernel 4.17+ */ |
| 126 |
probe nd2_syscall.rt_sigaction.return = kprobe.function(@arch_syscall_prefix "sys_rt_sigaction").return ? |
| 127 |
{ |
| 128 |
@_SYSCALL_RT_SIGACTION_NAME |
| 129 |
@SYSC_RETVALSTR(returnval()) |
| 130 |
} |
| 131 |
|
| 132 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 133 |
probe tp_syscall.rt_sigaction.return = kernel.trace("sys_exit") |
| 134 |
{ |
| 135 |
__set_syscall_pt_regs($regs) |
| 136 |
@__syscall_gate(@const("__NR_rt_sigaction")) |
| 137 |
@_SYSCALL_RT_SIGACTION_NAME |
| 138 |
@SYSC_RETVALSTR($ret) |
| 139 |
} |
| 140 |
|
| 141 |
# long sys32_rt_sigaction(int sig, |
| 142 |
# struct sigaction32 __user *act, |
| 143 |
# struct sigaction32 __user *oact, |
| 144 |
# unsigned int sigsetsize) |
| 145 |
# ppc only |
| 146 |
# compat_sys_rt_sigaction(int sig, |
| 147 |
# const struct sigaction32 __user *act, |
| 148 |
# struct sigaction32 __user *oact, |
| 149 |
# size_t sigsetsize) |
| 150 |
|
| 151 |
probe syscall.rt_sigaction32 = dw_syscall.rt_sigaction32 !, |
| 152 |
nd_syscall.rt_sigaction32 ? {} |
| 153 |
probe syscall.rt_sigaction32.return = dw_syscall.rt_sigaction32.return !, |
| 154 |
nd_syscall.rt_sigaction32.return ? {} |
| 155 |
|
| 156 |
# dw_rt_sigaction32 _____________________________________________________ |
| 157 |
|
| 158 |
probe dw_syscall.rt_sigaction32 = kernel.function("sys32_rt_sigaction").call ?, |
| 159 |
kernel.function("compat_sys_rt_sigaction").call ? |
| 160 |
{ |
| 161 |
@_SYSCALL_RT_SIGACTION_NAME |
| 162 |
sig = __int32($sig) |
| 163 |
sig_str = _signal_name(sig) |
| 164 |
act_uaddr = @__pointer($act) |
| 165 |
act_str = _struct_sigaction32_u(act_uaddr) |
| 166 |
oact_uaddr = $oact |
| 167 |
sigsetsize = $sigsetsize |
| 168 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 169 |
} |
| 170 |
probe dw_syscall.rt_sigaction32.return = |
| 171 |
kernel.function("sys32_rt_sigaction").return ?, |
| 172 |
kernel.function("compat_sys_rt_sigaction").return ? |
| 173 |
{ |
| 174 |
@_SYSCALL_RT_SIGACTION_NAME |
| 175 |
@SYSC_RETVALSTR($return) |
| 176 |
} |
| 177 |
|
| 178 |
# nd_rt_sigaction32 _____________________________________________________ |
| 179 |
|
| 180 |
probe nd_syscall.rt_sigaction32 = nd1_syscall.rt_sigaction32!, nd2_syscall.rt_sigaction32!, tp_syscall.rt_sigaction32 |
| 181 |
{ } |
| 182 |
|
| 183 |
probe nd1_syscall.rt_sigaction32 = kprobe.function("sys32_rt_sigaction") ?, |
| 184 |
kprobe.function("compat_sys_rt_sigaction") ? |
| 185 |
{ |
| 186 |
@_SYSCALL_RT_SIGACTION_NAME |
| 187 |
asmlinkage() |
| 188 |
@_SYSCALL_RT_SIGACTION32_REGARGS |
| 189 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 190 |
} |
| 191 |
|
| 192 |
/* kernel 4.17+ */ |
| 193 |
probe nd2_syscall.rt_sigaction32 = |
| 194 |
kprobe.function(@arch_syscall_prefix "compat_sys_rt_sigaction") ? |
| 195 |
{ |
| 196 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 197 |
@_SYSCALL_RT_SIGACTION_NAME |
| 198 |
@_SYSCALL_RT_SIGACTION32_REGARGS |
| 199 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 200 |
}, |
| 201 |
{ |
| 202 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_RT_SIGACTION_REGARGS_STORE %) |
| 203 |
} |
| 204 |
|
| 205 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 206 |
probe tp_syscall.rt_sigaction32 = kernel.trace("sys_enter") |
| 207 |
{ |
| 208 |
__set_syscall_pt_regs($regs) |
| 209 |
@__compat_syscall_gate(@const("__NR_compat_rt_sigaction")) |
| 210 |
@_SYSCALL_RT_SIGACTION_NAME |
| 211 |
@_SYSCALL_RT_SIGACTION32_REGARGS |
| 212 |
@_SYSCALL_RT_SIGACTION_ARGSTR |
| 213 |
}, |
| 214 |
{ |
| 215 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_RT_SIGACTION_REGARGS_STORE %) |
| 216 |
} |
| 217 |
|
| 218 |
probe nd_syscall.rt_sigaction32.return = nd1_syscall.rt_sigaction32.return!, nd2_syscall.rt_sigaction32.return!, tp_syscall.rt_sigaction32.return |
| 219 |
{ } |
| 220 |
|
| 221 |
probe nd1_syscall.rt_sigaction32.return = |
| 222 |
kprobe.function("sys32_rt_sigaction").return ?, |
| 223 |
kprobe.function("compat_sys_rt_sigaction").return ? |
| 224 |
{ |
| 225 |
@_SYSCALL_RT_SIGACTION_NAME |
| 226 |
@SYSC_RETVALSTR(returnval()) |
| 227 |
} |
| 228 |
|
| 229 |
/* kernel 4.17+ */ |
| 230 |
probe nd2_syscall.rt_sigaction32.return = |
| 231 |
kprobe.function(@arch_syscall_prefix "compat_sys_rt_sigaction").return ? |
| 232 |
{ |
| 233 |
@_SYSCALL_RT_SIGACTION_NAME |
| 234 |
@SYSC_RETVALSTR(returnval()) |
| 235 |
} |
| 236 |
|
| 237 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 238 |
probe tp_syscall.rt_sigaction32.return = kernel.trace("sys_exit") |
| 239 |
{ |
| 240 |
__set_syscall_pt_regs($regs) |
| 241 |
@__compat_syscall_gate(@const("__NR_compat_rt_sigaction")) |
| 242 |
@_SYSCALL_RT_SIGACTION_NAME |
| 243 |
@SYSC_RETVALSTR($ret) |
| 244 |
} |