Commit Graph

5 Commits

Author SHA1 Message Date
Yauheni Kaliuta 37339a769b selftests/bpf: Drop duplicate max/min definitions
Bugzilla: https://bugzilla.redhat.com/2120968

commit f4fd706f738338e78f413db36d0a483a11c53cd1
Author: Geliang Tang <geliang.tang@suse.com>
Date:   Sat Apr 9 07:58:17 2022 +0800

    selftests/bpf: Drop duplicate max/min definitions
    
    Drop duplicate macros min() and MAX() definitions in prog_tests and use
    MIN() or MAX() in sys/param.h instead.
    
    Signed-off-by: Geliang Tang <geliang.tang@suse.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Song Liu <songliubraving@fb.com>
    Link: https://lore.kernel.org/bpf/1ae276da9925c2de59b5bdc93b693b4c243e692e.1649462033.git.geliang.tang@suse.com

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-11-28 16:48:59 +02:00
Yauheni Kaliuta 9fadf05d2f selftests/bpf: Normalize selftest entry points
Bugzilla: http://bugzilla.redhat.com/2069045

commit 6972dc3b8778ce0d9ce819c6f1e3d32ce2bc3dd9
Author: Andrii Nakryiko <andrii@kernel.org>
Date:   Fri Oct 22 15:32:25 2021 -0700

    selftests/bpf: Normalize selftest entry points
    
    Ensure that all test entry points are global void functions with no
    input arguments. Mark few subtest entry points as static.
    
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20211022223228.99920-2-andrii@kernel.org

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-06-03 17:23:45 +03:00
Jerome Marchand 5286a6b330 selftest/bpf: Extend the bpf_snprintf() test for "%c".
Bugzilla: http://bugzilla.redhat.com/2041365

commit ce547335d4a42e645320402b24aeadb39531f73c
Author: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Date:   Sat Aug 14 10:57:18 2021 +0900

    selftest/bpf: Extend the bpf_snprintf() test for "%c".

    This patch adds various "positive" patterns for "%c" and two "negative"
    patterns for wide character.

    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20210814015718.42704-5-kuniyu@amazon.co.jp

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
2022-04-29 18:14:40 +02:00
Florent Revest f80f88f0e2 selftests/bpf: Fix the snprintf test
The BPF program for the snprintf selftest runs on all syscall entries.
On busy multicore systems this can cause concurrency issues.

For example it was observed that sometimes the userspace part of the
test reads "    4 0000" instead of "    4 000" (extra '0' at the end)
which seems to happen just before snprintf on another core sets
end[-1] = '\0'.

This patch adds a pid filter to the test to ensure that no
bpf_snprintf() will write over the test's output buffers while the
userspace reads the values.

Fixes: c2e39c6bdc ("selftests/bpf: Add a series of tests for bpf_snprintf")
Reported-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Florent Revest <revest@chromium.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210428152501.1024509-1-revest@chromium.org
2021-04-30 10:36:59 -07:00
Florent Revest c2e39c6bdc selftests/bpf: Add a series of tests for bpf_snprintf
The "positive" part tests all format specifiers when things go well.

The "negative" part makes sure that incorrect format strings fail at
load time.

Signed-off-by: Florent Revest <revest@chromium.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210419155243.1632274-7-revest@chromium.org
2021-04-19 15:27:37 -07:00