Debian Codegraph @

tapset/linux/sysc_preadv.stp

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