| 1 |
# setitimer __________________________________________________ |
| 2 |
# |
| 3 |
# long sys_setitimer(int which, |
| 4 |
# struct itimerval __user *value, |
| 5 |
# struct itimerval __user *ovalue) |
| 6 |
# |
| 7 |
|
| 8 |
@define _SYSCALL_SETITIMER_NAME |
| 9 |
%( |
| 10 |
name = "setitimer" |
| 11 |
%) |
| 12 |
|
| 13 |
@define _SYSCALL_SETITIMER_ARGSTR |
| 14 |
%( |
| 15 |
argstr = sprintf("%s, %s, %p", which_str, value_str, ovalue_uaddr) |
| 16 |
%) |
| 17 |
|
| 18 |
@define _SYSCALL_SETITIMER_REGARGS |
| 19 |
%( |
| 20 |
which = int_arg(1) |
| 21 |
which_str = _itimer_which_str(which) |
| 22 |
value_uaddr = pointer_arg(2) |
| 23 |
ovalue_uaddr = pointer_arg(3) |
| 24 |
%) |
| 25 |
|
| 26 |
@define _SYSCALL_SETITIMER_REGARGS_STORE |
| 27 |
%( |
| 28 |
if (@probewrite(which)) |
| 29 |
set_int_arg(1, which) |
| 30 |
|
| 31 |
if (@probewrite(value_uaddr)) |
| 32 |
set_pointer_arg(2, value_uaddr) |
| 33 |
|
| 34 |
if (@probewrite(ovalue_uaddr)) |
| 35 |
set_pointer_arg(3, ovalue_uaddr) |
| 36 |
%) |
| 37 |
|
| 38 |
probe syscall.setitimer = dw_syscall.setitimer !, nd_syscall.setitimer ? {} |
| 39 |
probe syscall.setitimer.return = dw_syscall.setitimer.return !, |
| 40 |
nd_syscall.setitimer.return ? {} |
| 41 |
|
| 42 |
# dw_setitimer _____________________________________________________ |
| 43 |
|
| 44 |
probe dw_syscall.setitimer = kernel.function("sys_setitimer").call |
| 45 |
{ |
| 46 |
@_SYSCALL_SETITIMER_NAME |
| 47 |
which = __int32($which) |
| 48 |
which_str = _itimer_which_str(which) |
| 49 |
value_uaddr = $value |
| 50 |
value_str = _struct_itimerval_u(value_uaddr) |
| 51 |
ovalue_uaddr = $ovalue |
| 52 |
@_SYSCALL_SETITIMER_ARGSTR |
| 53 |
} |
| 54 |
probe dw_syscall.setitimer.return = kernel.function("sys_setitimer").return |
| 55 |
{ |
| 56 |
@_SYSCALL_SETITIMER_NAME |
| 57 |
@SYSC_RETVALSTR($return) |
| 58 |
} |
| 59 |
|
| 60 |
# nd_setitimer _____________________________________________________ |
| 61 |
|
| 62 |
probe nd_syscall.setitimer = nd1_syscall.setitimer!, nd2_syscall.setitimer!, tp_syscall.setitimer |
| 63 |
{ } |
| 64 |
|
| 65 |
probe nd1_syscall.setitimer = kprobe.function("sys_setitimer") ? |
| 66 |
{ |
| 67 |
@_SYSCALL_SETITIMER_NAME |
| 68 |
asmlinkage() |
| 69 |
@_SYSCALL_SETITIMER_REGARGS |
| 70 |
value_str = _struct_itimerval_u(value_uaddr) |
| 71 |
@_SYSCALL_SETITIMER_ARGSTR |
| 72 |
} |
| 73 |
|
| 74 |
/* kernel 4.17+ */ |
| 75 |
probe nd2_syscall.setitimer = kprobe.function(@arch_syscall_prefix "sys_setitimer") ? |
| 76 |
{ |
| 77 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 78 |
@_SYSCALL_SETITIMER_NAME |
| 79 |
@_SYSCALL_SETITIMER_REGARGS |
| 80 |
value_str = _struct_itimerval_u(value_uaddr) |
| 81 |
@_SYSCALL_SETITIMER_ARGSTR |
| 82 |
}, |
| 83 |
{ |
| 84 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SETITIMER_REGARGS_STORE %) |
| 85 |
} |
| 86 |
|
| 87 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 88 |
probe tp_syscall.setitimer = kernel.trace("sys_enter") |
| 89 |
{ |
| 90 |
__set_syscall_pt_regs($regs) |
| 91 |
@__syscall_gate(@const("__NR_setitimer")) |
| 92 |
@_SYSCALL_SETITIMER_NAME |
| 93 |
@_SYSCALL_SETITIMER_REGARGS |
| 94 |
value_str = _struct_itimerval_u(value_uaddr) |
| 95 |
@_SYSCALL_SETITIMER_ARGSTR |
| 96 |
}, |
| 97 |
{ |
| 98 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SETITIMER_REGARGS_STORE %) |
| 99 |
} |
| 100 |
|
| 101 |
probe nd_syscall.setitimer.return = nd1_syscall.setitimer.return!, nd2_syscall.setitimer.return!, tp_syscall.setitimer.return |
| 102 |
{ } |
| 103 |
|
| 104 |
probe nd1_syscall.setitimer.return = kprobe.function("sys_setitimer").return ? |
| 105 |
{ |
| 106 |
@_SYSCALL_SETITIMER_NAME |
| 107 |
@SYSC_RETVALSTR(returnval()) |
| 108 |
} |
| 109 |
|
| 110 |
/* kernel 4.17+ */ |
| 111 |
probe nd2_syscall.setitimer.return = kprobe.function(@arch_syscall_prefix "sys_setitimer").return ? |
| 112 |
{ |
| 113 |
@_SYSCALL_SETITIMER_NAME |
| 114 |
@SYSC_RETVALSTR(returnval()) |
| 115 |
} |
| 116 |
|
| 117 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 118 |
probe tp_syscall.setitimer.return = kernel.trace("sys_exit") |
| 119 |
{ |
| 120 |
__set_syscall_pt_regs($regs) |
| 121 |
@__syscall_gate(@const("__NR_setitimer")) |
| 122 |
@_SYSCALL_SETITIMER_NAME |
| 123 |
@SYSC_RETVALSTR($ret) |
| 124 |
} |
| 125 |
|
| 126 |
# long compat_sys_setitimer(int which, |
| 127 |
# struct compat_itimerval __user *in, |
| 128 |
# struct compat_itimerval __user *out) |
| 129 |
# |
| 130 |
|
| 131 |
probe syscall.compat_setitimer = dw_syscall.compat_setitimer !, |
| 132 |
nd_syscall.compat_setitimer ? {} |
| 133 |
probe syscall.compat_setitimer.return = dw_syscall.compat_setitimer.return !, |
| 134 |
nd_syscall.compat_setitimer.return ? {} |
| 135 |
|
| 136 |
# dw_compat_setitimer _____________________________________________________ |
| 137 |
|
| 138 |
probe dw_syscall.compat_setitimer = kernel.function("compat_sys_setitimer").call ? |
| 139 |
{ |
| 140 |
@_SYSCALL_SETITIMER_NAME |
| 141 |
which = __int32($which) |
| 142 |
which_str = _itimer_which_str(which) |
| 143 |
value_uaddr = @__pointer($in) |
| 144 |
value_str = _struct_compat_itimerval_u(value_uaddr) |
| 145 |
ovalue_uaddr = @__pointer($out) |
| 146 |
@_SYSCALL_SETITIMER_ARGSTR |
| 147 |
} |
| 148 |
probe dw_syscall.compat_setitimer.return = kernel.function("compat_sys_setitimer").return ? |
| 149 |
{ |
| 150 |
@_SYSCALL_SETITIMER_NAME |
| 151 |
@SYSC_RETVALSTR($return) |
| 152 |
} |
| 153 |
|
| 154 |
# nd_compat_setitimer _____________________________________________________ |
| 155 |
|
| 156 |
probe nd_syscall.compat_setitimer = nd1_syscall.compat_setitimer!, nd2_syscall.compat_setitimer!, tp_syscall.compat_setitimer |
| 157 |
{ } |
| 158 |
|
| 159 |
probe nd1_syscall.compat_setitimer = kprobe.function("compat_sys_setitimer") ? |
| 160 |
{ |
| 161 |
@_SYSCALL_SETITIMER_NAME |
| 162 |
asmlinkage() |
| 163 |
@_SYSCALL_SETITIMER_REGARGS |
| 164 |
value_str = _struct_compat_itimerval_u(value_uaddr) |
| 165 |
@_SYSCALL_SETITIMER_ARGSTR |
| 166 |
} |
| 167 |
|
| 168 |
/* kernel 4.17+ */ |
| 169 |
probe nd2_syscall.compat_setitimer = kprobe.function(@arch_syscall_prefix "compat_sys_setitimer") ? |
| 170 |
{ |
| 171 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 172 |
@_SYSCALL_SETITIMER_NAME |
| 173 |
@_SYSCALL_SETITIMER_REGARGS |
| 174 |
value_str = _struct_compat_itimerval_u(value_uaddr) |
| 175 |
@_SYSCALL_SETITIMER_ARGSTR |
| 176 |
}, |
| 177 |
{ |
| 178 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SETITIMER_REGARGS_STORE %) |
| 179 |
} |
| 180 |
|
| 181 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 182 |
probe tp_syscall.compat_setitimer = kernel.trace("sys_enter") |
| 183 |
{ |
| 184 |
__set_syscall_pt_regs($regs) |
| 185 |
@__compat_syscall_gate(@const("__NR_compat_setitimer")) |
| 186 |
@_SYSCALL_SETITIMER_NAME |
| 187 |
@_SYSCALL_SETITIMER_REGARGS |
| 188 |
value_str = _struct_compat_itimerval_u(value_uaddr) |
| 189 |
@_SYSCALL_SETITIMER_ARGSTR |
| 190 |
}, |
| 191 |
{ |
| 192 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SETITIMER_REGARGS_STORE %) |
| 193 |
} |
| 194 |
|
| 195 |
probe nd_syscall.compat_setitimer.return = nd1_syscall.compat_setitimer.return!, nd2_syscall.compat_setitimer.return!, tp_syscall.compat_setitimer.return |
| 196 |
{ } |
| 197 |
|
| 198 |
probe nd1_syscall.compat_setitimer.return = kprobe.function("compat_sys_setitimer").return ? |
| 199 |
{ |
| 200 |
@_SYSCALL_SETITIMER_NAME |
| 201 |
@SYSC_RETVALSTR(returnval()) |
| 202 |
} |
| 203 |
|
| 204 |
/* kernel 4.17+ */ |
| 205 |
probe nd2_syscall.compat_setitimer.return = kprobe.function(@arch_syscall_prefix "compat_sys_setitimer").return ? |
| 206 |
{ |
| 207 |
@_SYSCALL_SETITIMER_NAME |
| 208 |
@SYSC_RETVALSTR(returnval()) |
| 209 |
} |
| 210 |
|
| 211 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 212 |
probe tp_syscall.compat_setitimer.return = kernel.trace("sys_exit") |
| 213 |
{ |
| 214 |
__set_syscall_pt_regs($regs) |
| 215 |
@__compat_syscall_gate(@const("__NR_compat_setitimer")) |
| 216 |
@_SYSCALL_SETITIMER_NAME |
| 217 |
@SYSC_RETVALSTR($ret) |
| 218 |
} |