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