Fix spelling mistakes in the comments.
Signed-off-by: Saurav Shah <sauravshah.31(a)gmail.com>
---
tools/testing/selftests/memfd/fuse_test.c | 2 +-
tools/testing/selftests/memfd/memfd_test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/memfd/fuse_test.c b/tools/testing/selftests/memfd/fuse_test.c
index 93798c8c5d54..dbc171a3806d 100644
--- a/tools/testing/selftests/memfd/fuse_test.c
+++ b/tools/testing/selftests/memfd/fuse_test.c
@@ -306,7 +306,7 @@ int main(int argc, char **argv)
* then the kernel did a page-replacement or canceled the read() (or
* whatever magic it did..). In that case, the memfd object is still
* all zero.
- * In case the memfd-object was *not* sealed, the read() was successfull
+ * In case the memfd-object was *not* sealed, the read() was successful
* and the memfd object must *not* be all zero.
* Note that in real scenarios, there might be a mixture of both, but
* in this test-cases, we have explicit 200ms delays which should be
diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index 18f585684e20..95af2d78fd31 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -1528,7 +1528,7 @@ static void test_share_open(char *banner, char *b_suffix)
/*
* Test sharing via fork()
- * Test whether seal-modifications work as expected with forked childs.
+ * Test whether seal-modifications work as expected with forked children.
*/
static void test_share_fork(char *banner, char *b_suffix)
{
--
2.34.1
This patch series adds test coverage for BPF sockaddr hooks and their
interactions with kernel socket functions (i.e. kernel_bind(),
kernel_connect(), kernel_sendmsg(), sock_sendmsg(),
kernel_getpeername(), and kernel_getsockname()) while also rounding out
IPv4 and IPv6 sockaddr hook coverage in prog_tests/sock_addr.c.
As with v1 of this patch series, we add regression coverage for the
issues addressed by these patches,
- commit 0bdf399342c5("net: Avoid address overwrite in kernel_connect")
- commit 86a7e0b69bd5("net: prevent rewrite of msg_name in sock_sendmsg()")
- commit c889a99a21bf("net: prevent address rewrite in kernel_bind()")
- commit 01b2885d9415("net: Save and restore msg_namelen in sock_sendmsg")
but broaden the focus a bit.
In order to extend prog_tests/sock_addr.c to test these kernel
functions, we add a set of new kfuncs that wrap individual socket
operations to bpf_testmod and invoke them through set of corresponding
SYSCALL programs (progs/sock_addr_kern.c). Each test case can be
configured to use a different set of "sock_ops" depending on whether it
is testing kernel calls (kernel_bind(), kernel_connect(), etc.) or
system calls (bind(), connect(), etc.).
=======
Patches
=======
* Patch 1 fixes the sock_addr bind test program to work for big endian
architectures such as s390x.
* Patch 2 introduces the new kfuncs to bpf_testmod.
* Patch 3 introduces the BPF program which allows us to invoke these
kfuncs invividually from the test program.
* Patch 4 lays the groundwork for IPv4 and IPv6 sockaddr hook coverage
by migrating much of the environment setup logic from
bpf/test_sock_addr.sh into prog_tests/sock_addr.c and adds test cases
to cover bind4/6, connect4/6, sendmsg4/6 and recvmsg4/6 hooks.
* Patch 5 makes the set of socket operations for each test case
configurable, laying the groundwork for Patch 6.
* Patch 6 introduces two sets of sock_ops that invoke the kernel
equivalents of connect(), bind(), etc. and uses these to add coverage
for the kernel socket functions.
=======
Changes
=======
v1->v2
------
* Dropped test_progs/sock_addr_kern.c and the sock_addr_kern test module
in favor of simply expanding bpf_testmod and test_progs/sock_addr.c.
* Migrated environment setup logic from bpf/test_sock_addr.sh into
prog_tests/sock_addr.c rather than invoking the script from the test
program.
* Added kfuncs to bpf_testmod as well as the sock_addr_kern BPF program
to enable us to invoke kernel socket functions from
test_progs/sock_addr.c.
* Added test coverage for kernel socket functions to
test_progs/sock_addr.c.
Link: https://lore.kernel.org/bpf/20240329191907.1808635-1-jrife@google.com/T/#u
Jordan Rife (6):
selftests/bpf: Fix bind program for big endian systems
selftests/bpf: Implement socket kfuncs for bpf_testmod
selftests/bpf: Implement BPF programs for kernel socket operations
selftests/bpf: Add IPv4 and IPv6 sockaddr test cases
selftests/bpf: Make sock configurable for each test case
selftests/bpf: Add kernel socket operation tests
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 139 +++
.../bpf/bpf_testmod/bpf_testmod_kfunc.h | 27 +
.../selftests/bpf/prog_tests/sock_addr.c | 940 +++++++++++++++---
.../testing/selftests/bpf/progs/bind4_prog.c | 18 +-
.../testing/selftests/bpf/progs/bind6_prog.c | 18 +-
tools/testing/selftests/bpf/progs/bind_prog.h | 19 +
.../selftests/bpf/progs/sock_addr_kern.c | 65 ++
7 files changed, 1077 insertions(+), 149 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/bind_prog.h
create mode 100644 tools/testing/selftests/bpf/progs/sock_addr_kern.c
--
2.44.0.478.gd926399ef9-goog
In order to build with clang at all, in order to see these symptoms, one
must first apply Valentin Obst's build fix for LLVM [1]. Once that is
done, then when building with clang, via:
make LLVM=1 -C tools/testing/selftests
...clang emits a "format string is empty" warning. (gcc also emits a
similar warning.)
Fix by passing NULL, instead of "", for the msg argument to
ksft_test_result_code(). This removes dozens of warnings and a few
errors (some tests have -Werror set).
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1…
Cc: Valentin Obst <kernel(a)valentinobst.de>
Cc: Kees Cook <keescook(a)chromium.org>
Cc: Nick Desaulniers <ndesaulniers(a)google.com>
Cc: Nathan Chancellor <nathan(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: Justin Stitt <justinstitt(a)google.com>
Cc: Bill Wendling <morbo(a)google.com>
Signed-off-by: John Hubbard <jhubbard(a)nvidia.com>
---
tools/testing/selftests/kselftest_harness.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index d98702b6955d..456b8694e678 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -1207,8 +1207,10 @@ void __run_test(struct __fixture_metadata *f,
else
diagnostic = "unknown";
- ksft_test_result_code(t->exit_code, test_name,
- diagnostic ? "%s" : NULL, diagnostic);
+ if (diagnostic)
+ ksft_test_result_code(t->exit_code, test_name, "%s", diagnostic);
+ else
+ ksft_test_result_code(t->exit_code, test_name, NULL);
free(test_name);
}
base-commit: 18daea77cca626f590fb140fc11e3a43c5d41354
prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
--
2.45.0
From: Geliang Tang <tanggeliang(a)kylinos.cn>
This patchset adds opts argument for __start_server, and adds setsockopt
pointer together with optval and optlen into struct network_helper_opts
to make start_server_addr helper more flexible. With these modifications,
many duplicate codes can be dropped.
Patch 4 addresses comments of Martin and Eduard in the previous series.
Geliang Tang (6):
selftests/bpf: Add opts argument for __start_server
selftests/bpf: Make start_mptcp_server static
selftests/bpf: Drop start_server_proto helper
selftests/bpf: Add setsockopt for network_helper_opts
selftests/bpf: Use start_server_addr in sockopt_inherit
selftests/bpf: Use start_server_addr in test_tcp_check_syncookie
tools/testing/selftests/bpf/Makefile | 1 +
tools/testing/selftests/bpf/network_helpers.c | 53 ++++++++-------
tools/testing/selftests/bpf/network_helpers.h | 5 +-
.../testing/selftests/bpf/prog_tests/mptcp.c | 16 +++++
.../bpf/prog_tests/sockopt_inherit.c | 34 ++++------
.../bpf/test_tcp_check_syncookie_user.c | 64 ++++++-------------
6 files changed, 78 insertions(+), 95 deletions(-)
--
2.40.1
Fixes clang compiler warnings by adding parentheses:
parse_vdso.c:65:9: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
if (g = h & 0xf0000000)
~~^~~~~~~~~~~~~~~~
parse_vdso.c:65:9: note: place parentheses around the assignment to
silence this warning
if (g = h & 0xf0000000)
^
( )
parse_vdso.c:65:9: note: use '==' to turn this assignment into an
equality comparison
if (g = h & 0xf0000000)
^
==
Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser")
Reviewed-by: Justin Stitt <justinstitt(a)google.com>
Signed-off-by: Edward Liaw <edliaw(a)google.com>
---
v2: separated assignment from predicate
---
tools/testing/selftests/vDSO/parse_vdso.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 413f75620a35..fdd38f7e0e43 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -62,7 +62,8 @@ static unsigned long elf_hash(const unsigned char *name)
while (*name)
{
h = (h << 4) + *name++;
- if (g = h & 0xf0000000)
+ g = h & 0xf0000000;
+ if (g)
h ^= g >> 24;
h &= ~g;
}
--
2.45.0.rc0.197.gbae5840b3b-goog
This patch captures the return value of the ./safesetid-test execution
by assigning it to the variable errcode. This change ensures that the
script properly handles the exit status of the safesetid-test.
Signed-off-by: Shengyu Li <shengyu.li.evgeny(a)gmail.com>
---
tools/testing/selftests/safesetid/safesetid-test.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/safesetid/safesetid-test.sh b/tools/testing/selftests/safesetid/safesetid-test.sh
index e4fdce675c54..0ebc6ddc4b6c 100755
--- a/tools/testing/selftests/safesetid/safesetid-test.sh
+++ b/tools/testing/selftests/safesetid/safesetid-test.sh
@@ -19,6 +19,7 @@ main_function()
{
check_root
./safesetid-test
+ errcode=$?
}
main_function
--
2.25.1