Debian Codegraph @

tapset/linux/sysc_utime.stp

raw
1 # utime ______________________________________________________
2 # long sys_utime(char __user * filename, struct utimbuf __user * times)
3
4 @define _SYSCALL_UTIME_NAME
5 %(
6 name = "utime"
7 %)
8
9 @define _SYSCALL_UTIME_ARGSTR
10 %(
11 argstr = sprintf("%s, [%s, %s]", filename,
12 ctime(actime), ctime(modtime))
13 %)
14
15 @define _SYSCALL_UTIME_REGARGS
16 %(
17 filename_uaddr = pointer_arg(1)
18 filename = user_string_quoted(filename_uaddr)
19 filename_unquoted = user_string_nofault(pointer_arg(1))
20 buf_uaddr = pointer_arg(2)
21 actime = _struct_utimbuf_actime(buf_uaddr)
22 modtime = _struct_utimbuf_modtime(buf_uaddr)
23 %)
24
25 @define _SYSCALL_UTIME_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(buf_uaddr))
34 set_pointer_arg(2, buf_uaddr)
35 %)
36
37 @define _SYSCALL_COMPAT_UTIME_REGARGS
38 %(
39 filename_uaddr = pointer_arg(1)
40 filename = user_string_quoted(filename_uaddr)
41 filename_unquoted = user_string_nofault(pointer_arg(1))
42 buf_uaddr = pointer_arg(2)
43 actime = _struct_compat_utimbuf_actime(buf_uaddr)
44 modtime = _struct_compat_utimbuf_modtime(buf_uaddr)
45 %)
46
47 probe syscall.utime = dw_syscall.utime !, nd_syscall.utime ? {}
48 probe syscall.utime.return = dw_syscall.utime.return !,
49 nd_syscall.utime.return ? {}
50
51 # dw_utime _____________________________________________________
52
53 probe dw_syscall.utime = kernel.function("sys_utime").call ?
54 {
55 @_SYSCALL_UTIME_NAME
56 filename_uaddr = $filename
57 filename = user_string_quoted($filename)
58 buf_uaddr = $times
59 # On s390, '$times' is a long, so the @cast() is needed.
60 actime = user_long(&@cast($times, "utimbuf")->actime)
61 modtime = user_long(&@cast($times, "utimbuf")->modtime)
62 @_SYSCALL_UTIME_ARGSTR
63 }
64 probe dw_syscall.utime.return = kernel.function("sys_utime").return ?
65 {
66 @_SYSCALL_UTIME_NAME
67 @SYSC_RETVALSTR($return)
68 }
69
70 # nd_utime _____________________________________________________
71
72 probe nd_syscall.utime = nd1_syscall.utime!, nd2_syscall.utime!, tp_syscall.utime
73 { }
74
75 probe nd1_syscall.utime = kprobe.function("sys_utime") ?
76 {
77 @_SYSCALL_UTIME_NAME
78 asmlinkage()
79 @_SYSCALL_UTIME_REGARGS
80 @_SYSCALL_UTIME_ARGSTR
81 }
82
83 /* kernel 4.17+ */
84 probe nd2_syscall.utime = kprobe.function(@arch_syscall_prefix "sys_utime") ?
85 {
86 __set_syscall_pt_regs(pointer_arg(1))
87 @_SYSCALL_UTIME_NAME
88 @_SYSCALL_UTIME_REGARGS
89 @_SYSCALL_UTIME_ARGSTR
90 },
91 {
92 %( @_IS_SREG_KERNEL %? @_SYSCALL_UTIME_REGARGS_STORE %)
93 }
94
95 /* kernel 3.5+, but undesirable because it affects all syscalls */
96 probe tp_syscall.utime = kernel.trace("sys_enter")
97 {
98 __set_syscall_pt_regs($regs)
99 @__syscall_gate(@const("__NR_utime"))
100 @_SYSCALL_UTIME_NAME
101 @_SYSCALL_UTIME_REGARGS
102 @_SYSCALL_UTIME_ARGSTR
103 },
104 {
105 %( @_IS_SREG_KERNEL %? @_SYSCALL_UTIME_REGARGS_STORE %)
106 }
107
108 probe nd_syscall.utime.return = nd1_syscall.utime.return!, nd2_syscall.utime.return!, tp_syscall.utime.return
109 { }
110
111 probe nd1_syscall.utime.return = kprobe.function("sys_utime").return ?
112 {
113 @_SYSCALL_UTIME_NAME
114 @SYSC_RETVALSTR(returnval())
115 }
116
117 /* kernel 4.17+ */
118 probe nd2_syscall.utime.return = kprobe.function(@arch_syscall_prefix "sys_utime").return ?
119 {
120 @_SYSCALL_UTIME_NAME
121 @SYSC_RETVALSTR(returnval())
122 }
123
124 /* kernel 3.5+, but undesirable because it affects all syscalls */
125 probe tp_syscall.utime.return = kernel.trace("sys_exit")
126 {
127 __set_syscall_pt_regs($regs)
128 @__syscall_gate(@const("__NR_utime"))
129 @_SYSCALL_UTIME_NAME
130 @SYSC_RETVALSTR($ret)
131 }
132
133 # long compat_sys_utime(char __user *filename, struct compat_utimbuf __user *t)
134
135 probe syscall.compat_utime = dw_syscall.compat_utime !,
136 nd_syscall.compat_utime ? {}
137 probe syscall.compat_utime.return = dw_syscall.compat_utime.return !,
138 nd_syscall.compat_utime.return ? {}
139
140 # dw_compat_utime _____________________________________________________
141
142 probe dw_syscall.compat_utime = kernel.function("compat_sys_utime").call ?
143 {
144 @_SYSCALL_UTIME_NAME
145 filename_uaddr = @__pointer($filename)
146 filename = user_string_quoted(filename_uaddr)
147 buf_uaddr = @__pointer($t)
148 actime = _struct_compat_utimbuf_actime(buf_uaddr)
149 modtime = _struct_compat_utimbuf_modtime(buf_uaddr)
150 @_SYSCALL_UTIME_ARGSTR
151 }
152 probe dw_syscall.compat_utime.return = kernel.function("compat_sys_utime").return ?
153 {
154 @_SYSCALL_UTIME_NAME
155 @SYSC_RETVALSTR($return)
156 }
157
158 # nd_compat_utime _____________________________________________________
159
160 probe nd_syscall.compat_utime = nd1_syscall.compat_utime!, nd2_syscall.compat_utime!, tp_syscall.compat_utime
161 { }
162
163 probe nd1_syscall.compat_utime = kprobe.function("compat_sys_utime") ?
164 {
165 @_SYSCALL_UTIME_NAME
166 asmlinkage()
167 @_SYSCALL_COMPAT_UTIME_REGARGS
168 @_SYSCALL_UTIME_ARGSTR
169 }
170
171 /* kernel 4.17+ */
172 probe nd2_syscall.compat_utime = kprobe.function(@arch_syscall_prefix "compat_sys_utime") ?
173 {
174 __set_syscall_pt_regs(pointer_arg(1))
175 @_SYSCALL_UTIME_NAME
176 @_SYSCALL_COMPAT_UTIME_REGARGS
177 @_SYSCALL_UTIME_ARGSTR
178 },
179 {
180 %( @_IS_SREG_KERNEL %? @_SYSCALL_UTIME_REGARGS_STORE %)
181 }
182
183 /* kernel 3.5+, but undesirable because it affects all syscalls */
184 probe tp_syscall.compat_utime = kernel.trace("sys_enter")
185 {
186 __set_syscall_pt_regs($regs)
187 @__compat_syscall_gate(@const("__NR_compat_utime"))
188 @_SYSCALL_UTIME_NAME
189 @_SYSCALL_COMPAT_UTIME_REGARGS
190 @_SYSCALL_UTIME_ARGSTR
191 },
192 {
193 %( @_IS_SREG_KERNEL %? @_SYSCALL_UTIME_REGARGS_STORE %)
194 }
195
196 probe nd_syscall.compat_utime.return = nd1_syscall.compat_utime.return!, nd2_syscall.compat_utime.return!, tp_syscall.compat_utime.return
197 { }
198
199 probe nd1_syscall.compat_utime.return = kprobe.function("compat_sys_utime").return ?
200 {
201 @_SYSCALL_UTIME_NAME
202 @SYSC_RETVALSTR(returnval())
203 }
204
205 /* kernel 4.17+ */
206 probe nd2_syscall.compat_utime.return = kprobe.function(@arch_syscall_prefix "compat_sys_utime").return ?
207 {
208 @_SYSCALL_UTIME_NAME
209 @SYSC_RETVALSTR(returnval())
210 }
211
212 /* kernel 3.5+, but undesirable because it affects all syscalls */
213 probe tp_syscall.compat_utime.return = kernel.trace("sys_exit")
214 {
215 __set_syscall_pt_regs($regs)
216 @__compat_syscall_gate(@const("__NR_compat_utime"))
217 @_SYSCALL_UTIME_NAME
218 @SYSC_RETVALSTR($ret)
219 }