@@ -168,6 +168,39 @@ static void test_attach_uprobe_long_event_name(void)
168
168
test_attach_probe_manual__destroy (skel );
169
169
}
170
170
171
+ /* attach kprobe/kretprobe long event name testings */
172
+ static void test_attach_kprobe_long_event_name (void )
173
+ {
174
+ DECLARE_LIBBPF_OPTS (bpf_kprobe_opts , kprobe_opts );
175
+ struct bpf_link * kprobe_link , * kretprobe_link ;
176
+ struct test_attach_probe_manual * skel ;
177
+
178
+ skel = test_attach_probe_manual__open_and_load ();
179
+ if (!ASSERT_OK_PTR (skel , "skel_kprobe_manual_open_and_load" ))
180
+ return ;
181
+
182
+ /* manual-attach kprobe/kretprobe */
183
+ kprobe_opts .attach_mode = PROBE_ATTACH_MODE_LEGACY ;
184
+ kprobe_opts .retprobe = false;
185
+ kprobe_link = bpf_program__attach_kprobe_opts (skel -> progs .handle_kprobe ,
186
+ "bpf_testmod_looooooooooooooooooooooooooooooong_name" ,
187
+ & kprobe_opts );
188
+ if (!ASSERT_OK_PTR (kprobe_link , "attach_kprobe_long_event_name" ))
189
+ goto cleanup ;
190
+ skel -> links .handle_kprobe = kprobe_link ;
191
+
192
+ kprobe_opts .retprobe = true;
193
+ kretprobe_link = bpf_program__attach_kprobe_opts (skel -> progs .handle_kretprobe ,
194
+ "bpf_testmod_looooooooooooooooooooooooooooooong_name" ,
195
+ & kprobe_opts );
196
+ if (!ASSERT_OK_PTR (kretprobe_link , "attach_kretprobe_long_event_name" ))
197
+ goto cleanup ;
198
+ skel -> links .handle_kretprobe = kretprobe_link ;
199
+
200
+ cleanup :
201
+ test_attach_probe_manual__destroy (skel );
202
+ }
203
+
171
204
static void test_attach_probe_auto (struct test_attach_probe * skel )
172
205
{
173
206
struct bpf_link * uprobe_err_link ;
@@ -371,6 +404,8 @@ void test_attach_probe(void)
371
404
372
405
if (test__start_subtest ("uprobe-long_name" ))
373
406
test_attach_uprobe_long_event_name ();
407
+ if (test__start_subtest ("kprobe-long_name" ))
408
+ test_attach_kprobe_long_event_name ();
374
409
375
410
cleanup :
376
411
test_attach_probe__destroy (skel );
0 commit comments