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