Debian Codegraph @

tapset/linux/sysc_eventfd.stp

raw
1 # eventfd _____________________________________________________
2 # long sys_eventfd(unsigned int count)
3 # SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
4
5 probe syscall.eventfd = dw_syscall.eventfd !, nd_syscall.eventfd ? {}
6 probe syscall.eventfd.return = dw_syscall.eventfd.return !, nd_syscall.eventfd.return ? {}
7
8 # dw_eventfd _____________________________________________________
9
10 probe dw_syscall.eventfd = __syscall.eventfd2 ?, __syscall.eventfd ?
11 {
12 }
13 probe __syscall.eventfd2 = kernel.function("sys_eventfd2").call
14 {
15 @__syscall_compat_gate(@const("__NR_eventfd2"), @const("__NR_compat_eventfd2"))
16 name = "eventfd2"
17 count = __uint32($count)
18 flags = __int32($flags)
19 flags_str = _eventfd2_flag_str(flags)
20 argstr = sprintf("%u, %s", count, _eventfd2_flag_str(flags))
21 }
22 probe __syscall.eventfd = kernel.function("sys_eventfd").call
23 {
24 name = "eventfd"
25 count = __uint32($count)
26 flags = 0
27 flags_str = "0x0"
28 argstr = sprint(count)
29 }
30 probe dw_syscall.eventfd.return = __syscall.eventfd2.return ?,
31 __syscall.eventfd.return ?
32 {
33 @SYSC_RETVALSTR($return)
34 }
35 probe __syscall.eventfd2.return = kernel.function("sys_eventfd2").return
36 {
37 @__syscall_compat_gate(@const("__NR_eventfd2"), @const("__NR_compat_eventfd2"))
38 name = "eventfd2"
39 }
40 probe __syscall.eventfd.return = kernel.function("sys_eventfd").return
41 {
42 name = "eventfd"
43 }
44
45 # nd_eventfd _____________________________________________________
46
47 probe nd_syscall.eventfd = nd1_syscall.eventfd!, nd2_syscall.eventfd!, tp_syscall.eventfd
48 { }
49
50 probe nd1_syscall.eventfd = __nd1_syscall.eventfd2 ?, __nd1_syscall.eventfd ?
51 {
52 }
53 probe __nd1_syscall.eventfd2 = kprobe.function("sys_eventfd2")
54 {
55 @__syscall_compat_gate(@const("__NR_eventfd2"), @const("__NR_compat_eventfd2"))
56 name = "eventfd2"
57 asmlinkage()
58 count = uint_arg(1)
59 flags = int_arg(2)
60 flags_str = _eventfd2_flag_str(flags)
61 argstr = sprintf("%u, %s", count, flags_str)
62 }
63 probe __nd1_syscall.eventfd = kprobe.function("sys_eventfd")
64 {
65 name = "eventfd"
66 asmlinkage()
67 count = uint_arg(1)
68 flags = 0
69 flags_str = "0x0"
70 argstr = sprint(count)
71 }
72
73 /* kernel 4.17+ */
74 probe nd2_syscall.eventfd = __nd2_syscall.eventfd2 ?, __nd2_syscall.eventfd ?
75 {
76 }
77 probe __nd2_syscall.eventfd2 = kprobe.function(@arch_syscall_prefix "sys_eventfd2") ?
78 {
79 __set_syscall_pt_regs(pointer_arg(1))
80 name = "eventfd2"
81 count = uint_arg(1)
82 flags = int_arg(2)
83 flags_str = _eventfd2_flag_str(flags)
84 argstr = sprintf("%u, %s", count, flags_str)
85 },
86 {
87 %( @_IS_SREG_KERNEL %?
88 if (@probewrite(count))
89 set_uint_arg(1, count)
90
91 if (@probewrite(flags))
92 set_int_arg(2, flags)
93 %)
94 }
95 probe __nd2_syscall.eventfd = kprobe.function(@arch_syscall_prefix "sys_eventfd")
96 {
97 __set_syscall_pt_regs(pointer_arg(1))
98 name = "eventfd"
99 count = uint_arg(1)
100 flags = 0
101 flags_str = "0x0"
102 argstr = sprint(count)
103 },
104 {
105 %( @_IS_SREG_KERNEL %?
106 if (@probewrite(count))
107 set_uint_arg(1, count)
108 %)
109 }
110
111 /* kernel 3.5+, but undesirable because it affects all syscalls */
112 probe tp_syscall.eventfd = __tp_syscall.eventfd2 ?, __tp_syscall.eventfd ?
113 {
114 }
115 probe __tp_syscall.eventfd2 = kernel.trace("sys_enter")
116 {
117 __set_syscall_pt_regs($regs)
118 @__syscall_compat_gate(@const("__NR_eventfd2"), @const("__NR_compat_eventfd2"))
119 name = "eventfd2"
120 count = uint_arg(1)
121 flags = int_arg(2)
122 flags_str = _eventfd2_flag_str(flags)
123 argstr = sprintf("%u, %s", count, flags_str)
124 },
125 {
126 %( @_IS_SREG_KERNEL %?
127 if (@probewrite(count))
128 set_uint_arg(1, count)
129
130 if (@probewrite(flags))
131 set_int_arg(2, flags)
132 %)
133 }
134 probe __tp_syscall.eventfd = kernel.trace("sys_enter")
135 {
136 __set_syscall_pt_regs($regs)
137 @__syscall_compat_gate(@const("__NR_eventfd"), @const("__NR_compat_eventfd"))
138 name = "eventfd"
139 count = uint_arg(1)
140 flags = 0
141 flags_str = "0x0"
142 argstr = sprint(count)
143 },
144 {
145 %( @_IS_SREG_KERNEL %?
146 if (@probewrite(count))
147 set_uint_arg(1, count)
148 %)
149 }
150
151 probe nd_syscall.eventfd.return = nd1_syscall.eventfd.return!, nd2_syscall.eventfd.return!, tp_syscall.eventfd.return
152 { }
153
154 probe nd1_syscall.eventfd.return = __nd1_syscall.eventfd2.return ?,
155 __nd1_syscall.eventfd.return ?
156 {
157 @SYSC_RETVALSTR(returnval())
158 }
159 probe __nd1_syscall.eventfd2.return = kprobe.function("sys_eventfd2").return
160 {
161 @__syscall_compat_gate(@const("__NR_eventfd2"), @const("__NR_compat_eventfd2"))
162 name = "eventfd2"
163 }
164 probe __nd1_syscall.eventfd.return = kprobe.function("sys_eventfd").return
165 {
166 name = "eventfd"
167 }
168
169 /* kernel 4.17+ */
170 probe nd2_syscall.eventfd.return = __nd2_syscall.eventfd2.return ?,
171 __nd2_syscall.eventfd.return ?
172 {
173 @SYSC_RETVALSTR(returnval())
174 }
175 probe __nd2_syscall.eventfd2.return = kprobe.function(@arch_syscall_prefix "sys_eventfd2").return
176 {
177 name = "eventfd2"
178 }
179 probe __nd2_syscall.eventfd.return = kprobe.function(@arch_syscall_prefix "sys_eventfd").return
180 {
181 name = "eventfd"
182 }
183
184 /* kernel 3.5+, but undesirable because it affects all syscalls */
185 probe tp_syscall.eventfd.return = __tp_syscall.eventfd2.return ?,
186 __tp_syscall.eventfd.return ?
187 {
188 __set_syscall_pt_regs($regs)
189 @SYSC_RETVALSTR($ret)
190 }
191 probe __tp_syscall.eventfd2.return = kernel.trace("sys_exit")
192 {
193 @__syscall_compat_gate(@const("__NR_eventfd2"), @const("__NR_compat_eventfd2"))
194 name = "eventfd2"
195 }
196 probe __tp_syscall.eventfd.return = kernel.trace("sys_exit")
197 {
198 @__syscall_compat_gate(@const("__NR_eventfd"), @const("__NR_compat_eventfd"))
199 name = "eventfd"
200 }