On Fri, Mar 29, 2024 at 12:20 PM Jordan Rife <jrife@xxxxxxxxxx> wrote: > > sock_addr_testmod provides a mechanism for the sock_addr_kern prog_test > to drive socket operations in kernel space. On init, one of the > following socket operations is performed based on the module parameters: > kernel_bind(), kernel_connect(), or sock_sendmsg()/kernel_sendmsg() and > results are exposed through debugfs. > > Signed-off-by: Jordan Rife <jrife@xxxxxxxxxx> > --- > tools/testing/selftests/bpf/Makefile | 11 +- > .../bpf/sock_addr_testmod/.gitignore | 6 + > .../selftests/bpf/sock_addr_testmod/Makefile | 20 ++ > .../bpf/sock_addr_testmod/sock_addr_testmod.c | 256 ++++++++++++++++++ > 4 files changed, 292 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/bpf/sock_addr_testmod/.gitignore > create mode 100644 tools/testing/selftests/bpf/sock_addr_testmod/Makefile > create mode 100644 tools/testing/selftests/bpf/sock_addr_testmod/sock_addr_testmod.c > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index 3b9eb40d63436..b5d02ff724957 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -132,7 +132,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ > flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \ > test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \ > xskxceiver xdp_redirect_multi xdp_synproxy veristat xdp_hw_metadata \ > - xdp_features bpf_test_no_cfi.ko > + xdp_features bpf_test_no_cfi.ko sock_addr_testmod.ko > Do we need yet another kernel module? Can this be done as part of existing bpf_testmod module? > TEST_GEN_FILES += liburandom_read.so urandom_read sign-file uprobe_multi > > @@ -160,6 +160,7 @@ override define CLEAN > $(Q)$(RM) -r $(TEST_GEN_FILES) > $(Q)$(RM) -r $(EXTRA_CLEAN) > $(Q)$(MAKE) -C bpf_testmod clean > + $(Q)$(MAKE) -C sock_addr_testmod clean > $(Q)$(MAKE) docs-clean > endef > [...]