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