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