Debian Codegraph @

tapset/linux/sysc_utimensat.stp

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