| 1 |
# rt_sigsuspend ______________________________________________ |
| 2 |
# |
| 3 |
# SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize) |
| 4 |
# |
| 5 |
|
| 6 |
@define _SYSCALL_RT_SIGSUSPEND_NAME |
| 7 |
%( |
| 8 |
name = "rt_sigsuspend" |
| 9 |
%) |
| 10 |
|
| 11 |
@define _SYSCALL_RT_SIGSUSPEND_ARGSTR |
| 12 |
%( |
| 13 |
argstr = sprintf("%s, %u", set_str, sigsetsize) |
| 14 |
%) |
| 15 |
|
| 16 |
@define _SYSCALL_RT_SIGSUSPEND_REGARGS |
| 17 |
%( |
| 18 |
set_uaddr = pointer_arg(1) |
| 19 |
sigsetsize = ulong_arg(2) |
| 20 |
set_str = (@__compat_task ? _stp_compat_sigset_u(set_uaddr) |
| 21 |
: _stp_sigset_u(set_uaddr)) |
| 22 |
%) |
| 23 |
|
| 24 |
@define _SYSCALL_RT_SIGSUSPEND_REGARGS_STORE |
| 25 |
%( |
| 26 |
if (@probewrite(set_uaddr)) |
| 27 |
set_pointer_arg(1, set_uaddr) |
| 28 |
|
| 29 |
if (@probewrite(sigsetsize)) |
| 30 |
set_ulong_arg(2, sigsetsize) |
| 31 |
%) |
| 32 |
|
| 33 |
probe syscall.rt_sigsuspend = dw_syscall.rt_sigsuspend !, nd_syscall.rt_sigsuspend ? {} |
| 34 |
probe syscall.rt_sigsuspend.return = dw_syscall.rt_sigsuspend.return !, |
| 35 |
nd_syscall.rt_sigsuspend.return ? {} |
| 36 |
|
| 37 |
# dw_rt_sigsuspend _____________________________________________________ |
| 38 |
|
| 39 |
probe dw_syscall.rt_sigsuspend = kernel.function("compat_sys_rt_sigsuspend").call ?, |
| 40 |
kernel.function("ia64_rt_sigsuspend").call ?, |
| 41 |
kernel.function("sys_rt_sigsuspend").call ? |
| 42 |
{ |
| 43 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 44 |
set_uaddr = @__pointer($unewset) |
| 45 |
sigsetsize = @__compat_ulong($sigsetsize) |
| 46 |
set_str = (@__compat_task ? _stp_compat_sigset_u(set_uaddr) |
| 47 |
: _stp_sigset_u(set_uaddr)) |
| 48 |
@_SYSCALL_RT_SIGSUSPEND_ARGSTR |
| 49 |
} |
| 50 |
probe dw_syscall.rt_sigsuspend.return = |
| 51 |
kernel.function("compat_sys_rt_sigsuspend").return ?, |
| 52 |
kernel.function("ia64_rt_sigsuspend").return ?, |
| 53 |
kernel.function("sys_rt_sigsuspend").return ? |
| 54 |
{ |
| 55 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 56 |
@SYSC_RETVALSTR($return) |
| 57 |
} |
| 58 |
|
| 59 |
# nd_rt_sigsuspend _____________________________________________________ |
| 60 |
|
| 61 |
probe nd_syscall.rt_sigsuspend = nd1_syscall.rt_sigsuspend!, nd2_syscall.rt_sigsuspend!, tp_syscall.rt_sigsuspend |
| 62 |
{ } |
| 63 |
|
| 64 |
probe nd1_syscall.rt_sigsuspend = kprobe.function("sys_rt_sigsuspend") ?, |
| 65 |
kprobe.function("ia64_rt_sigsuspend") ?, |
| 66 |
kprobe.function("compat_sys_rt_sigsuspend") ? |
| 67 |
{ |
| 68 |
asmlinkage() |
| 69 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 70 |
@_SYSCALL_RT_SIGSUSPEND_REGARGS |
| 71 |
@_SYSCALL_RT_SIGSUSPEND_ARGSTR |
| 72 |
} |
| 73 |
|
| 74 |
/* kernel 4.17+ */ |
| 75 |
probe nd2_syscall.rt_sigsuspend = kprobe.function(@arch_syscall_prefix "sys_rt_sigsuspend") ? |
| 76 |
{ |
| 77 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 78 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 79 |
@_SYSCALL_RT_SIGSUSPEND_REGARGS |
| 80 |
@_SYSCALL_RT_SIGSUSPEND_ARGSTR |
| 81 |
}, |
| 82 |
{ |
| 83 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_RT_SIGSUSPEND_REGARGS_STORE %) |
| 84 |
} |
| 85 |
|
| 86 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 87 |
probe tp_syscall.rt_sigsuspend = kernel.trace("sys_enter") |
| 88 |
{ |
| 89 |
__set_syscall_pt_regs($regs) |
| 90 |
@__syscall_compat_gate(@const("__NR_rt_sigsuspend"), @const("__NR_compat_rt_sigsuspend")) |
| 91 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 92 |
@_SYSCALL_RT_SIGSUSPEND_REGARGS |
| 93 |
@_SYSCALL_RT_SIGSUSPEND_ARGSTR |
| 94 |
}, |
| 95 |
{ |
| 96 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_RT_SIGSUSPEND_REGARGS_STORE %) |
| 97 |
} |
| 98 |
|
| 99 |
probe nd_syscall.rt_sigsuspend.return = nd1_syscall.rt_sigsuspend.return!, nd2_syscall.rt_sigsuspend.return!, tp_syscall.rt_sigsuspend.return |
| 100 |
{ } |
| 101 |
|
| 102 |
probe nd1_syscall.rt_sigsuspend.return = |
| 103 |
kprobe.function("sys_rt_sigsuspend").return ?, |
| 104 |
kprobe.function("ia64_rt_sigsuspend").return ?, |
| 105 |
kprobe.function("compat_sys_rt_sigsuspend").return ? |
| 106 |
{ |
| 107 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 108 |
@SYSC_RETVALSTR(returnval()) |
| 109 |
} |
| 110 |
|
| 111 |
/* kernel 4.17+ */ |
| 112 |
probe nd2_syscall.rt_sigsuspend.return = kprobe.function(@arch_syscall_prefix "sys_rt_sigsuspend").return ? |
| 113 |
{ |
| 114 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 115 |
@SYSC_RETVALSTR(returnval()) |
| 116 |
} |
| 117 |
|
| 118 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 119 |
probe tp_syscall.rt_sigsuspend.return = kernel.trace("sys_exit") |
| 120 |
{ |
| 121 |
__set_syscall_pt_regs($regs) |
| 122 |
@__syscall_compat_gate(@const("__NR_rt_sigsuspend"), @const("__NR_compat_rt_sigsuspend")) |
| 123 |
@_SYSCALL_RT_SIGSUSPEND_NAME |
| 124 |
@SYSC_RETVALSTR($ret) |
| 125 |
} |