Commit Graph

9 Commits

Author SHA1 Message Date
Viktor Malik d8268df287
selftests/bpf: add tests for the "module: Function" syntax
JIRA: https://issues.redhat.com/browse/RHEL-30773

commit 960635887c967338fd567def3e7905a294f5002b
Author: Viktor Malik <vmalik@redhat.com>
Date:   Tue Apr 30 11:38:07 2024 +0200

    selftests/bpf: add tests for the "module: Function" syntax
    
    The previous patch added support for the "module:function" syntax for
    tracing programs. This adds tests for explicitly specifying the module
    name via the SEC macro and via the bpf_program__set_attach_target call.
    
    Signed-off-by: Viktor Malik <vmalik@redhat.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Acked-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/8a076168ed847f7c8a6c25715737b1fea84e38be.1714469650.git.vmalik@redhat.com

Signed-off-by: Viktor Malik <vmalik@redhat.com>
2024-11-13 09:39:08 +01:00
Viktor Malik 499cb041c5
selftests/bpf: Use un/load_bpf_testmod functions in tests
JIRA: https://issues.redhat.com/browse/RHEL-9957

commit 11642eb92b3bc67171b23abff0d062758c5a4730
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Mon May 15 15:37:52 2023 +0200

    selftests/bpf: Use un/load_bpf_testmod functions in tests
    
    Now that we have un/load_bpf_testmod helpers in testing_helpers.h,
    we can use it in other tests and save some lines.
    
    Acked-by: David Vernet <void@manifault.com>
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/r/20230515133756.1658301-7-jolsa@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Signed-off-by: Viktor Malik <vmalik@redhat.com>
2023-10-12 11:41:07 +02:00
Jerome Marchand d6df22d689 selftests/bpf: Add kprobe_multi check to module attach test
Bugzilla: https://bugzilla.redhat.com/2177177

commit e697d8dcebd2f557fa5e5ed57aaf0a9992ce9df8
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Tue Oct 25 15:41:47 2022 +0200

    selftests/bpf: Add kprobe_multi check to module attach test

    Adding test that makes sure the kernel module won't be removed
    if there's kprobe multi link defined on top of it.

    Acked-by: Song Liu <song@kernel.org>
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/r/20221025134148.3300700-8-jolsa@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
2023-04-28 11:42:57 +02:00
Yauheni Kaliuta e79d260fcb bpf/selftests: Add test for writable bare tracepoint
Bugzilla: http://bugzilla.redhat.com/2069045

Conflicts: context changed due to RH-only 3f0f8a96c9 ("selftests: bpf: define SO_RCVTIMEO and SO_SNDTIMEO properly for ppc64le")

commit fa7f17d066bd0996b930b664aa0ed1f213fc1828
Author: Hou Tao <houtao1@huawei.com>
Date:   Mon Oct 4 17:48:57 2021 +0800

    bpf/selftests: Add test for writable bare tracepoint

    Add a writable bare tracepoint in bpf_testmod module, and
    trigger its calling when reading /sys/kernel/bpf_testmod
    with a specific buffer length. The reading will return
    the value in writable context if the early return flag
    is enabled in writable context.

    Signed-off-by: Hou Tao <houtao1@huawei.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Acked-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20211004094857.30868-4-hotforest@gmail.com

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-06-03 17:23:41 +03:00
Yauheni Kaliuta 6aaea00f83 selftests/bpf: Add test for bpf_get_branch_snapshot
Bugzilla: http://bugzilla.redhat.com/2069045

commit 025bd7c753aab18cd594924a46ab46ac47209df9
Author: Song Liu <songliubraving@fb.com>
Date:   Fri Sep 10 11:33:52 2021 -0700

    selftests/bpf: Add test for bpf_get_branch_snapshot
    
    This test uses bpf_get_branch_snapshot from a fexit program. The test uses
    a target function (bpf_testmod_loop_test) and compares the record against
    kallsyms. If there isn't enough record matching kallsyms, the test fails.
    
    Signed-off-by: Song Liu <songliubraving@fb.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Acked-by: Andrii Nakryiko <andrii@kernel.org>
    Acked-by: John Fastabend <john.fastabend@gmail.com>
    Link: https://lore.kernel.org/bpf/20210910183352.3151445-4-songliubraving@fb.com

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-06-03 17:16:11 +03:00
Jiri Olsa a1c05c3b09 selftests/bpf: Test that module can't be unloaded with attached trampoline
Adding test to verify that once we attach module's trampoline,
the module can't be unloaded.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210414195147.1624932-7-jolsa@kernel.org
2021-04-25 21:09:02 -07:00
Qais Yousef 407be92206 selftests: bpf: Add a new test for bare tracepoints
Reuse module_attach infrastructure to add a new bare tracepoint to check
we can attach to it as a raw tracepoint.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210119122237.2426878-3-qais.yousef@arm.com
2021-01-20 14:14:05 -08:00
Andrii Nakryiko 2e33f831fc selftests/bpf: Add set_attach_target() API selftest for module target
Add test for bpf_program__set_attach_target() API, validating it can find
kernel module fentry target.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20201211215825.3646154-3-andrii@kernel.org
2020-12-14 16:39:42 +01:00
Andrii Nakryiko 1e38abefcf selftests/bpf: Add fentry/fexit/fmod_ret selftest for kernel module
Add new selftest checking attachment of fentry/fexit/fmod_ret (and raw
tracepoint ones for completeness) BPF programs to kernel module function.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201203204634.1325171-15-andrii@kernel.org
2020-12-03 17:38:21 -08:00