Debian Codegraph @

tapset/linux/sysc_pwritev2.stp

raw
1 # pwritev2 __________________________________________________
2 #
3 # SYSCALL_DEFINE6(pwritev2, unsigned long, fd, const struct iovec __user *, vec,
4 # unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h,
5 # int, flags)
6 # COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
7 # const struct compat_iovec __user *,vec,
8 # compat_ulong_t, vlen, u32, pos_low, u32, pos_high, int, flags)
9
10 @define _SYSCALL_PWRITEV2_NAME
11 %(
12 name = "pwritev2"
13 %)
14
15 @define _SYSCALL_PWRITEV2_ARGSTR
16 %(
17 argstr = sprintf("%d, %p, %d, 0x%x, %s", fd, vector_uaddr,
18 count, offset, flags_str)
19 %)
20
21 @define _SYSCALL_PWRITEV2_REGARGS
22 %(
23 fd = int_arg(1)
24 vector_uaddr = pointer_arg(2)
25 count = int_arg(3)
26 offset = @__pos_from_hilo(ulong_arg(5), ulong_arg(4))
27 flags = int_arg(6)
28 flags_str = _preadv2_flags_str(flags)
29 %)
30
31 @define _SYSCALL_PWRITEV2_REGARGS_STORE
32 %(
33 if (@probewrite(fd))
34 set_int_arg(1, fd)
35
36 if (@probewrite(vector_uaddr))
37 set_pointer_arg(2, vector_uaddr)
38
39 if (@probewrite(count))
40 set_int_arg(3, count)
41
42 if (@probewrite(offset)) {
43 set_ulong_arg(4, __ulong(offset & 0xffffffff))
44 set_ulong_arg(5, __ulong(offset >> 32))
45 }
46
47 if (@probewrite(flags))
48 set_int_arg(6, flags)
49 %)
50
51 @define _SYSCALL_COMPAT_PWRITEV2_REGARGS
52 %(
53 fd = int_arg(1)
54 vector_uaddr = pointer_arg(2)
55 count = int_arg(3)
56 offset = (u32_arg(5) << 32) + u32_arg(4)
57 flags = int_arg(6)
58 flags_str = _preadv2_flags_str(flags)
59 %)
60
61 @define _SYSCALL_COMPAT_PWRITEV2_REGARGS_STORE
62 %(
63 if (@probewrite(fd))
64 set_int_arg(1, fd)
65
66 if (@probewrite(vector_uaddr))
67 set_pointer_arg(2, vector_uaddr)
68
69 if (@probewrite(count))
70 set_int_arg(3, count)
71
72 if (@probewrite(offset)) {
73 set_u32_arg(4, offset & 0xffffffff)
74 set_u32_arg(5, offset >> 32)
75 }
76
77 if (@probewrite(flags))
78 set_int_arg(6, flags)
79 %)
80 probe syscall.pwritev2 = dw_syscall.pwritev2 !, nd_syscall.pwritev2 ? {}
81 probe syscall.pwritev2.return = dw_syscall.pwritev2.return !,
82 nd_syscall.pwritev2.return ? {}
83
84 # dw_pwritev2 _____________________________________________________
85
86 probe dw_syscall.pwritev2 = __syscall.pwritev2 ?, __syscall.compat_pwritev2 ?
87 {
88 @_SYSCALL_PWRITEV2_NAME
89 }
90 probe __syscall.pwritev2 = kernel.function("sys_pwritev2").call ?
91 {
92 fd = __int32($fd)
93 vector_uaddr = $vec
94 count = __int32($vlen)
95 offset = @__pos_from_hilo($pos_h, $pos_l)
96 flags = $flags
97 flags_str = _preadv2_flags_str(flags)
98 @_SYSCALL_PWRITEV2_ARGSTR
99 }
100 probe __syscall.compat_pwritev2 = kernel.function("compat_sys_pwritev2").call ?
101 {
102 fd = __int32($fd)
103 vector_uaddr = $vec
104 count = __int32($vlen)
105 offset = ($pos_high << 32) + $pos_low
106 flags = $flags
107 flags_str = _preadv2_flags_str(flags)
108 @_SYSCALL_PWRITEV2_ARGSTR
109 }
110 probe dw_syscall.pwritev2.return = kernel.function("sys_pwritev2").return ?,
111 kernel.function("compat_sys_pwritev2").return ?
112 {
113 @_SYSCALL_PWRITEV2_NAME
114 @SYSC_RETVALSTR($return)
115 }
116
117 # nd_pwritev2 _____________________________________________________
118
119 probe nd_syscall.pwritev2 = nd1_syscall.pwritev2!, nd2_syscall.pwritev2!, tp_syscall.pwritev2
120 { }
121
122 probe nd1_syscall.pwritev2 = __nd1_syscall.pwritev2 ?,
123 __nd1_syscall.compat_pwritev2 ?
124 {
125 @_SYSCALL_PWRITEV2_NAME
126 }
127 probe __nd1_syscall.pwritev2 = kprobe.function("sys_pwritev2").call
128 {
129 asmlinkage()
130 @_SYSCALL_PWRITEV2_REGARGS
131 @_SYSCALL_PWRITEV2_ARGSTR
132 }
133 probe __nd1_syscall.compat_pwritev2 =
134 kprobe.function("compat_sys_pwritev2").call
135 {
136 asmlinkage()
137 @_SYSCALL_COMPAT_PWRITEV2_REGARGS
138 @_SYSCALL_PWRITEV2_ARGSTR
139 }
140
141 /* kernel 4.17+ */
142 probe nd2_syscall.pwritev2 = __nd2_syscall.pwritev2 ?,
143 __nd2_syscall.compat_pwritev2 ?
144 {
145 @_SYSCALL_PWRITEV2_NAME
146 }
147 probe __nd2_syscall.pwritev2 = kprobe.function(@arch_syscall_prefix "sys_pwritev2").call
148 {
149 __set_syscall_pt_regs(pointer_arg(1))
150 @_SYSCALL_PWRITEV2_REGARGS
151 @_SYSCALL_PWRITEV2_ARGSTR
152 },
153 {
154 %( @_IS_SREG_KERNEL %? @_SYSCALL_PWRITEV2_REGARGS_STORE %)
155 }
156 probe __nd2_syscall.compat_pwritev2 =
157 kprobe.function(@arch_syscall_prefix "compat_sys_pwritev2").call
158 {
159 __set_syscall_pt_regs(pointer_arg(1))
160 @_SYSCALL_COMPAT_PWRITEV2_REGARGS
161 @_SYSCALL_PWRITEV2_ARGSTR
162 },
163 {
164 %( @_IS_SREG_KERNEL %? @_SYSCALL_COMPAT_PWRITEV2_REGARGS_STORE %)
165 }
166
167 /* kernel 3.5+, but undesirable because it affects all syscalls */
168 probe tp_syscall.pwritev2 = __tp_syscall.pwritev2 ?,
169 __tp_syscall.compat_pwritev2 ?
170 {
171 @_SYSCALL_PWRITEV2_NAME
172 }
173 probe __tp_syscall.pwritev2 = kernel.trace("sys_enter")
174 {
175 __set_syscall_pt_regs($regs)
176 @__syscall_gate(@const("__NR_pwritev2"))
177 @_SYSCALL_PWRITEV2_REGARGS
178 @_SYSCALL_PWRITEV2_ARGSTR
179 },
180 {
181 %( @_IS_SREG_KERNEL %? @_SYSCALL_PWRITEV2_REGARGS_STORE %)
182 }
183 probe __tp_syscall.compat_pwritev2 = kernel.trace("sys_enter")
184 {
185 __set_syscall_pt_regs($regs)
186 @__compat_syscall_gate(@const("__NR_compat_pwritev2"))
187 @_SYSCALL_COMPAT_PWRITEV2_REGARGS
188 @_SYSCALL_PWRITEV2_ARGSTR
189 },
190 {
191 %( @_IS_SREG_KERNEL %? @_SYSCALL_COMPAT_PWRITEV2_REGARGS_STORE %)
192 }
193
194 probe nd_syscall.pwritev2.return = nd1_syscall.pwritev2.return!, nd2_syscall.pwritev2.return!, tp_syscall.pwritev2.return
195 { }
196
197 probe nd1_syscall.pwritev2.return = kprobe.function("sys_pwritev2").return ?,
198 kprobe.function("compat_sys_pwritev2").return ?
199 {
200 @_SYSCALL_PWRITEV2_NAME
201 @SYSC_RETVALSTR(returnval())
202 }
203
204 /* kernel 4.17+ */
205 probe nd2_syscall.pwritev2.return = kprobe.function(@arch_syscall_prefix "sys_pwritev2").return ?,
206 kprobe.function(@arch_syscall_prefix "compat_sys_pwritev2").return ?
207 {
208 @_SYSCALL_PWRITEV2_NAME
209 @SYSC_RETVALSTR(returnval())
210 }
211
212 /* kernel 3.5+, but undesirable because it affects all syscalls */
213 probe tp_syscall.pwritev2.return = kernel.trace("sys_exit")
214 {
215 __set_syscall_pt_regs($regs)
216 @__syscall_compat_gate(@const("__NR_pwritev2"), @const("__NR_compat_pwritev2"))
217 @_SYSCALL_PWRITEV2_NAME
218 @SYSC_RETVALSTR($ret)
219 }