Re: [PATCH bpf v1] selftests/bpf: Fix cross-compiling urandom_read
Hello: This patch was applied to bpf/bpf.git (master) by Andrii Nakryiko : On Tue, 8 Oct 2024 21:07:20 -0700 you wrote: > Linking of urandom_read and liburandom_read.so prefers LLVM's 'ld.lld' but > falls back to using 'ld' if unsupported. However, this fallback discards > any existing makefile macro for LD and can break cross-compilation. > > Fix by changing the fallback to use the target linker $(LD), passed via > '-fuse-ld=' using an absolute path rather than a linker "flavour". > > [...] Here is the summary with links: - [bpf,v1] selftests/bpf: Fix cross-compiling urandom_read https://git.kernel.org/bpf/bpf/c/fd526e121c4d You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
[bpf-next 3/4] samples/bpf: remove obsolete cgroup related tests
This patch removes the obsolete cgroup related tests. These tests are now redundant because their functionality is already covered by more modern and comprehensive tests under selftests/bpf. The following files are removed: - test_current_task_under_cgroup: tests bpf_current_task_under_cgroup() to check if a task belongs to a cgroup. Already covered by task_under_cgroup at selftest and other cgroup ID tests. - test_cgrp2_tc: tests bpf_skb_under_cgroup() to filter packets based on cgroup. This behavior is now validated by cgroup_skb_sk_lookup, which uses bpf_skb_cgroup_id, making this test redundant. By removing these outdated tests, this patch helps streamline and modernize the test suite, avoiding duplication of test coverage. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 9 - samples/bpf/test_cgrp2_array_pin.c| 106 -- samples/bpf/test_cgrp2_attach.c | 177 - samples/bpf/test_cgrp2_tc.bpf.c | 56 -- samples/bpf/test_cgrp2_tc.sh | 187 -- .../bpf/test_current_task_under_cgroup.bpf.c | 43 .../bpf/test_current_task_under_cgroup_user.c | 115 --- 7 files changed, 693 deletions(-) delete mode 100644 samples/bpf/test_cgrp2_array_pin.c delete mode 100644 samples/bpf/test_cgrp2_attach.c delete mode 100644 samples/bpf/test_cgrp2_tc.bpf.c delete mode 100755 samples/bpf/test_cgrp2_tc.sh delete mode 100644 samples/bpf/test_current_task_under_cgroup.bpf.c delete mode 100644 samples/bpf/test_current_task_under_cgroup_user.c diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index cdfda15e859c..66827dbb93b3 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -25,10 +25,8 @@ tprogs-y += offwaketime tprogs-y += spintest tprogs-y += map_perf_test tprogs-y += test_overhead -tprogs-y += test_cgrp2_array_pin tprogs-y += test_cgrp2_attach tprogs-y += xdp_router_ipv4 -tprogs-y += test_current_task_under_cgroup tprogs-y += trace_event tprogs-y += sampleip tprogs-y += tc_l2_redirect @@ -71,11 +69,6 @@ lathist-objs := lathist_user.o offwaketime-objs := offwaketime_user.o $(TRACE_HELPERS) spintest-objs := spintest_user.o $(TRACE_HELPERS) map_perf_test-objs := map_perf_test_user.o -test_overhead-objs := test_overhead_user.o -test_cgrp2_array_pin-objs := test_cgrp2_array_pin.o -test_cgrp2_attach-objs := test_cgrp2_attach.o -test_current_task_under_cgroup-objs := $(CGROUP_HELPERS) \ - test_current_task_under_cgroup_user.o trace_event-objs := trace_event_user.o $(TRACE_HELPERS) sampleip-objs := sampleip_user.o $(TRACE_HELPERS) tc_l2_redirect-objs := tc_l2_redirect_user.o @@ -117,8 +110,6 @@ always-y += test_overhead_tp.bpf.o always-y += test_overhead_raw_tp.bpf.o always-y += test_overhead_kprobe.bpf.o always-y += parse_varlen.o parse_simple.o parse_ldabs.o -always-y += test_cgrp2_tc.bpf.o -always-y += test_current_task_under_cgroup.bpf.o always-y += trace_event_kern.o always-y += sampleip_kern.o always-y += lwt_len_hist.bpf.o diff --git a/samples/bpf/test_cgrp2_array_pin.c b/samples/bpf/test_cgrp2_array_pin.c deleted file mode 100644 index 05e88aa63009.. --- a/samples/bpf/test_cgrp2_array_pin.c +++ /dev/null @@ -1,106 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2016 Facebook - */ -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -static void usage(void) -{ - printf("Usage: test_cgrp2_array_pin [...]\n"); - printf(" -FFile to pin an BPF cgroup array\n"); - printf(" -UUpdate an already pinned BPF cgroup array\n"); - printf(" -v Full path of the cgroup2\n"); - printf(" -h Display this help\n"); -} - -int main(int argc, char **argv) -{ - const char *pinned_file = NULL, *cg2 = NULL; - int create_array = 1; - int array_key = 0; - int array_fd = -1; - int cg2_fd = -1; - int ret = -1; - int opt; - - while ((opt = getopt(argc, argv, "F:U:v:")) != -1) { - switch (opt) { - /* General args */ - case 'F': - pinned_file = optarg; - break; - case 'U': - pinned_file = optarg; - create_array = 0; - break; - case 'v': - cg2 = optarg; - break; - default: - usage(); - goto out; - } - } - - if (!cg2 || !pinned_file) { - usage(); - goto out; - } - - cg2_fd = open(cg2, O_RDONLY); - if (cg2_fd < 0) { - fprintf(stderr, "open(%s,...): %s(%d)\n", - cg2, strerror(errno), errno); - goto out; - } - -
[bpf-next 4/4] samples/bpf: remove obsolete tracing related tests
The samples/bpf has become outdated and often does not follow up with the latest. This commit removes obsolete tracing-related tests. Specifically, 'test_overhead' is duplicate with selftests (and bench), and 'test_override_return', 'test_probe_write_user' tests are obsolete since they have been replaced by kprobe_multi_override and probe_user from selftests respectively. The following files are removed: - test_overhead: tests the overhead of BPF programs with task_rename, now covered by selftests and benchmark tests (rename-*). [1] - test_override_return: tests the return override functionality, now handled by kprobe_multi_override in selftests. - test_probe_write_user: tests the probe_write_user functionality, now replaced by the probe_user test in selftests. This cleanup will help to streamline the testing framework by removing redundant tests. [1]: https://patchwork.kernel.org/cover/13759916 Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 11 -- samples/bpf/test_overhead_kprobe.bpf.c | 41 - samples/bpf/test_overhead_raw_tp.bpf.c | 17 -- samples/bpf/test_overhead_tp.bpf.c | 23 --- samples/bpf/test_overhead_user.c | 225 --- samples/bpf/test_override_return.sh | 16 -- samples/bpf/test_probe_write_user.bpf.c | 52 -- samples/bpf/test_probe_write_user_user.c | 108 --- samples/bpf/tracex7.bpf.c| 15 -- samples/bpf/tracex7_user.c | 56 -- 10 files changed, 564 deletions(-) delete mode 100644 samples/bpf/test_overhead_kprobe.bpf.c delete mode 100644 samples/bpf/test_overhead_raw_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_user.c delete mode 100755 samples/bpf/test_override_return.sh delete mode 100644 samples/bpf/test_probe_write_user.bpf.c delete mode 100644 samples/bpf/test_probe_write_user_user.c delete mode 100644 samples/bpf/tracex7.bpf.c delete mode 100644 samples/bpf/tracex7_user.c diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 66827dbb93b3..31bf0c665963 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -17,14 +17,11 @@ tprogs-y += tracex3 tprogs-y += tracex4 tprogs-y += tracex5 tprogs-y += tracex6 -tprogs-y += tracex7 -tprogs-y += test_probe_write_user tprogs-y += trace_output tprogs-y += lathist tprogs-y += offwaketime tprogs-y += spintest tprogs-y += map_perf_test -tprogs-y += test_overhead tprogs-y += test_cgrp2_attach tprogs-y += xdp_router_ipv4 tprogs-y += trace_event @@ -62,8 +59,6 @@ tracex3-objs := tracex3_user.o tracex4-objs := tracex4_user.o tracex5-objs := tracex5_user.o $(TRACE_HELPERS) tracex6-objs := tracex6_user.o -tracex7-objs := tracex7_user.o -test_probe_write_user-objs := test_probe_write_user_user.o trace_output-objs := trace_output_user.o lathist-objs := lathist_user.o offwaketime-objs := offwaketime_user.o $(TRACE_HELPERS) @@ -96,9 +91,7 @@ always-y += tracex3.bpf.o always-y += tracex4.bpf.o always-y += tracex5.bpf.o always-y += tracex6.bpf.o -always-y += tracex7.bpf.o always-y += sock_flags.bpf.o -always-y += test_probe_write_user.bpf.o always-y += trace_output.bpf.o always-y += tcbpf1_kern.o always-y += tc_l2_redirect_kern.o @@ -106,9 +99,6 @@ always-y += lathist_kern.o always-y += offwaketime.bpf.o always-y += spintest.bpf.o always-y += map_perf_test.bpf.o -always-y += test_overhead_tp.bpf.o -always-y += test_overhead_raw_tp.bpf.o -always-y += test_overhead_kprobe.bpf.o always-y += parse_varlen.o parse_simple.o parse_ldabs.o always-y += trace_event_kern.o always-y += sampleip_kern.o @@ -182,7 +172,6 @@ TPROGLDLIBS_xdp_router_ipv4 += -lm -pthread TPROGLDLIBS_tracex4+= -lrt TPROGLDLIBS_trace_output += -lrt TPROGLDLIBS_map_perf_test += -lrt -TPROGLDLIBS_test_overhead += -lrt # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/bin/clang diff --git a/samples/bpf/test_overhead_kprobe.bpf.c b/samples/bpf/test_overhead_kprobe.bpf.c deleted file mode 100644 index 668cf5259c60.. --- a/samples/bpf/test_overhead_kprobe.bpf.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2016 Facebook - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - */ -#include "vmlinux.h" -#include -#include -#include -#include - -SEC("kprobe/__set_task_comm") -int prog(struct pt_regs *ctx) -{ - struct signal_struct *signal; - struct task_struct *tsk; - char oldcomm[TASK_COMM_LEN] = {}; - char newcomm[TASK_COMM_LEN] = {}; - u16 oom_score_adj; - u32 pid; - - tsk = (void *)PT_REGS_PARM1_CORE(ctx); - - pid = BPF_CORE_READ(tsk, pid); - bpf_core_read_str(oldcomm
[bpf-next 2/4] selftests/bpf: migrate sock create tests for prohibitig sockets
This patch continues the migration and removal process for cgroup sock_create tests to selftests. The test being migrated verifies the ability of cgroup BPF to block the creation of specific types of sockets using a verdict. Specifically, the test denies socket creation when the socket is of type AF_INET{6}, SOCK_DGRAM, and IPPROTO_ICMP{V6}. If the requested socket type matches these attributes, the cgroup BPF verdict blocks the socket creation. As with the previous commit, this test currently lacks coverage in selftests, so this patch migrates the functionality into the sock_create tests under selftests. This migration ensures that the socket creation blocking behavior with cgroup bpf program is properly tested within the selftest framework. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 - samples/bpf/sock_flags.bpf.c | 47 samples/bpf/test_cgrp2_sock2.c| 95 samples/bpf/test_cgrp2_sock2.sh | 103 -- .../selftests/bpf/prog_tests/sock_create.c| 83 +- 5 files changed, 80 insertions(+), 250 deletions(-) delete mode 100644 samples/bpf/sock_flags.bpf.c delete mode 100644 samples/bpf/test_cgrp2_sock2.c delete mode 100755 samples/bpf/test_cgrp2_sock2.sh diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index f514c6fb1ae2..cdfda15e859c 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -27,7 +27,6 @@ tprogs-y += map_perf_test tprogs-y += test_overhead tprogs-y += test_cgrp2_array_pin tprogs-y += test_cgrp2_attach -tprogs-y += test_cgrp2_sock2 tprogs-y += xdp_router_ipv4 tprogs-y += test_current_task_under_cgroup tprogs-y += trace_event @@ -75,7 +74,6 @@ map_perf_test-objs := map_perf_test_user.o test_overhead-objs := test_overhead_user.o test_cgrp2_array_pin-objs := test_cgrp2_array_pin.o test_cgrp2_attach-objs := test_cgrp2_attach.o -test_cgrp2_sock2-objs := test_cgrp2_sock2.o test_current_task_under_cgroup-objs := $(CGROUP_HELPERS) \ test_current_task_under_cgroup_user.o trace_event-objs := trace_event_user.o $(TRACE_HELPERS) diff --git a/samples/bpf/sock_flags.bpf.c b/samples/bpf/sock_flags.bpf.c deleted file mode 100644 index 0da749f6a9e1.. --- a/samples/bpf/sock_flags.bpf.c +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include "vmlinux.h" -#include "net_shared.h" -#include - -SEC("cgroup/sock") -int bpf_prog1(struct bpf_sock *sk) -{ - char fmt[] = "socket: family %d type %d protocol %d\n"; - char fmt2[] = "socket: uid %u gid %u\n"; - __u64 gid_uid = bpf_get_current_uid_gid(); - __u32 uid = gid_uid & 0x; - __u32 gid = gid_uid >> 32; - - bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol); - bpf_trace_printk(fmt2, sizeof(fmt2), uid, gid); - - /* block AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6 sockets -* ie., make ping6 fail -*/ - if (sk->family == AF_INET6 && - sk->type == SOCK_DGRAM && - sk->protocol == IPPROTO_ICMPV6) - return 0; - - return 1; -} - -SEC("cgroup/sock") -int bpf_prog2(struct bpf_sock *sk) -{ - char fmt[] = "socket: family %d type %d protocol %d\n"; - - bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol); - - /* block AF_INET, SOCK_DGRAM, IPPROTO_ICMP sockets -* ie., make ping fail -*/ - if (sk->family == AF_INET && - sk->type == SOCK_DGRAM && - sk->protocol == IPPROTO_ICMP) - return 0; - - return 1; -} - -char _license[] SEC("license") = "GPL"; diff --git a/samples/bpf/test_cgrp2_sock2.c b/samples/bpf/test_cgrp2_sock2.c deleted file mode 100644 index e7060aaa2f5a.. --- a/samples/bpf/test_cgrp2_sock2.c +++ /dev/null @@ -1,95 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* eBPF example program: - * - * - Loads eBPF program - * - * The eBPF program loads a filter from file and attaches the - * program to a cgroup using BPF_PROG_ATTACH - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bpf_insn.h" - -static int usage(const char *argv0) -{ - printf("Usage: %s cg-path filter-path [filter-id]\n", argv0); - return EXIT_FAILURE; -} - -int main(int argc, char **argv) -{ - int cg_fd, err, ret = EXIT_FAILURE, filter_id = 0, prog_cnt = 0; - const char *link_pin_path = "/sys/fs/bpf/test_cgrp2_sock2"; - struct bpf_link *link = NULL; - struct bpf_program *progs[2]; - struct bpf_program *prog; - struct bpf_object *obj; - - if (argc < 3) - return usage(argv[0]); - - if (argc > 3) - filter_id = atoi(argv[3]); - - cg_fd = open(argv[1], O_DIRECTORY | O_RDONLY); - if (cg_fd < 0) { -
[bpf-next 1/4] selftests/bpf: migrate cgroup sock create test for setting iface/mark/prio
This patch migrates the old test for cgroup BPF that sets sk_bound_dev_if, mark, and priority when AF_INET{6} sockets are created. The most closely related tests under selftests are 'test_sock' and 'sockopt'. However, these existing tests serve different purposes. 'test_sock' focuses mainly on verifying the socket binding process, while 'sockopt' concentrates on testing the behavior of getsockopt and setsockopt operations for various socket options. Neither of these existing tests directly covers the ability of cgroup BPF to set socket attributes such as sk_bound_dev_if, mark, and priority during socket creation. To address this gap, this patch introduces a migration of the old cgroup socket attribute test, now included as the 'sock_create' test in selftests/bpf. This ensures that the ability to configure these attributes during socket creation is properly tested. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 - samples/bpf/test_cgrp2_sock.c | 296 -- samples/bpf/test_cgrp2_sock.sh| 137 .../selftests/bpf/prog_tests/sock_create.c| 256 +++ 4 files changed, 256 insertions(+), 435 deletions(-) delete mode 100644 samples/bpf/test_cgrp2_sock.c delete mode 100755 samples/bpf/test_cgrp2_sock.sh create mode 100644 tools/testing/selftests/bpf/prog_tests/sock_create.c diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 7afe040cf43b..f514c6fb1ae2 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -27,7 +27,6 @@ tprogs-y += map_perf_test tprogs-y += test_overhead tprogs-y += test_cgrp2_array_pin tprogs-y += test_cgrp2_attach -tprogs-y += test_cgrp2_sock tprogs-y += test_cgrp2_sock2 tprogs-y += xdp_router_ipv4 tprogs-y += test_current_task_under_cgroup @@ -76,7 +75,6 @@ map_perf_test-objs := map_perf_test_user.o test_overhead-objs := test_overhead_user.o test_cgrp2_array_pin-objs := test_cgrp2_array_pin.o test_cgrp2_attach-objs := test_cgrp2_attach.o -test_cgrp2_sock-objs := test_cgrp2_sock.o test_cgrp2_sock2-objs := test_cgrp2_sock2.o test_current_task_under_cgroup-objs := $(CGROUP_HELPERS) \ test_current_task_under_cgroup_user.o diff --git a/samples/bpf/test_cgrp2_sock.c b/samples/bpf/test_cgrp2_sock.c deleted file mode 100644 index 8ca2a445ffa1.. --- a/samples/bpf/test_cgrp2_sock.c +++ /dev/null @@ -1,296 +0,0 @@ -/* eBPF example program: - * - * - Loads eBPF program - * - * The eBPF program sets the sk_bound_dev_if index in new AF_INET{6} - * sockets opened by processes in the cgroup. - * - * - Attaches the new program to a cgroup using BPF_PROG_ATTACH - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bpf_insn.h" - -char bpf_log_buf[BPF_LOG_BUF_SIZE]; - -static int prog_load(__u32 idx, __u32 mark, __u32 prio) -{ - /* save pointer to context */ - struct bpf_insn prog_start[] = { - BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), - }; - struct bpf_insn prog_end[] = { - BPF_MOV64_IMM(BPF_REG_0, 1), /* r0 = verdict */ - BPF_EXIT_INSN(), - }; - - /* set sk_bound_dev_if on socket */ - struct bpf_insn prog_dev[] = { - BPF_MOV64_IMM(BPF_REG_3, idx), - BPF_MOV64_IMM(BPF_REG_2, offsetof(struct bpf_sock, bound_dev_if)), - BPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_3, offsetof(struct bpf_sock, bound_dev_if)), - }; - - /* set mark on socket */ - struct bpf_insn prog_mark[] = { - /* get uid of process */ - BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, -BPF_FUNC_get_current_uid_gid), - BPF_ALU64_IMM(BPF_AND, BPF_REG_0, 0x), - - /* if uid is 0, use given mark, else use the uid as the mark */ - BPF_MOV64_REG(BPF_REG_3, BPF_REG_0), - BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), - BPF_MOV64_IMM(BPF_REG_3, mark), - - /* set the mark on the new socket */ - BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), - BPF_MOV64_IMM(BPF_REG_2, offsetof(struct bpf_sock, mark)), - BPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_3, offsetof(struct bpf_sock, mark)), - }; - - /* set priority on socket */ - struct bpf_insn prog_prio[] = { - BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), - BPF_MOV64_IMM(BPF_REG_3, prio), - BPF_MOV64_IMM(BPF_REG_2, offsetof(struct bpf_sock, priority)), - BPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_3, offsetof(struct bpf_sock, priority)), - }; - LIBBPF_OPTS(bpf_prog_load_opts, opts, - .log_buf = bpf_log_buf, - .log_size = BPF_LOG_BUF_SIZE, - ); - - struct bpf_insn *prog; - size_t insns_cnt; -
[bpf-next 0/4] selftests/bpf: migrate and remove cgroup/tracing related tests
The BPF testing framework has evolved significantly over time. However, some legacy tests in the samples/bpf directory have not kept up with these changes. These outdated tests can cause confusion and increase maintenance efforts. This patchset focuses on migrating outdated cgroup and tracing-related tests from samples/bpf to selftests/bpf, ensuring the BPF test suite remains current and efficient. Tests that are already covered by selftests/bpf are removed, while those not yet covered are migrated. This includes cgroup sock create tests for setting socket attributes and blocking socket creation, as well as the removal of redundant cgroup and tracing tests that have been replaced by newer tests. This patchset covers the following cgroup/tracing tests: - test_overhead: tests the overhead of BPF programs with task_rename, now covered by selftests and benchmark tests (rename-*). [1] - test_override_return: tests the return override functionality, now handled by kprobe_multi_override in selftests. - test_probe_write_user: tests the probe_write_user functionality, now replaced by the probe_user test in selftests. - test_cgrp2_sock: tests cgroup BPF's ability to set sk_bound_dev_if, mark, and priority during socket creation. Migrated to selftests as 'sock_create' since no existing tests fully cover this. - test_cgrp2_sock2: tests blocking socket creation for specific types (AF_INET{6}, SOCK_DGRAM, IPPROTO_ICMP{V6}). Migrated to selftests in 'sock_create' test for coverage. - test_current_task_under_cgroup: tests bpf_current_task_under_cgroup() to check if a task belongs to a cgroup. Already covered by task_under_cgroup at selftest and other cgroup ID tests. - test_cgrp2_tc: tests bpf_skb_under_cgroup() to filter packets based on cgroup. This behavior is now validated by cgroup_skb_sk_lookup, which uses bpf_skb_cgroup_id, making this test redundant. Daniel T. Lee (4): selftests/bpf: migrate cgroup sock create test for setting iface/mark/prio selftests/bpf: migrate sock create tests for prohibitig sockets samples/bpf: remove obsolete cgroup related tests samples/bpf: remove obsolete tracing related tests samples/bpf/Makefile | 24 -- samples/bpf/sock_flags.bpf.c | 47 --- samples/bpf/test_cgrp2_array_pin.c| 106 -- samples/bpf/test_cgrp2_attach.c | 177 -- samples/bpf/test_cgrp2_sock.c | 296 samples/bpf/test_cgrp2_sock.sh| 137 --- samples/bpf/test_cgrp2_sock2.c| 95 - samples/bpf/test_cgrp2_sock2.sh | 103 -- samples/bpf/test_cgrp2_tc.bpf.c | 56 --- samples/bpf/test_cgrp2_tc.sh | 187 -- .../bpf/test_current_task_under_cgroup.bpf.c | 43 --- .../bpf/test_current_task_under_cgroup_user.c | 115 -- samples/bpf/test_overhead_kprobe.bpf.c| 41 --- samples/bpf/test_overhead_raw_tp.bpf.c| 17 - samples/bpf/test_overhead_tp.bpf.c| 23 -- samples/bpf/test_overhead_user.c | 225 samples/bpf/test_override_return.sh | 16 - samples/bpf/test_probe_write_user.bpf.c | 52 --- samples/bpf/test_probe_write_user_user.c | 108 -- samples/bpf/tracex7.bpf.c | 15 - samples/bpf/tracex7_user.c| 56 --- .../selftests/bpf/prog_tests/sock_create.c| 333 ++ 22 files changed, 333 insertions(+), 1939 deletions(-) delete mode 100644 samples/bpf/sock_flags.bpf.c delete mode 100644 samples/bpf/test_cgrp2_array_pin.c delete mode 100644 samples/bpf/test_cgrp2_attach.c delete mode 100644 samples/bpf/test_cgrp2_sock.c delete mode 100755 samples/bpf/test_cgrp2_sock.sh delete mode 100644 samples/bpf/test_cgrp2_sock2.c delete mode 100755 samples/bpf/test_cgrp2_sock2.sh delete mode 100644 samples/bpf/test_cgrp2_tc.bpf.c delete mode 100755 samples/bpf/test_cgrp2_tc.sh delete mode 100644 samples/bpf/test_current_task_under_cgroup.bpf.c delete mode 100644 samples/bpf/test_current_task_under_cgroup_user.c delete mode 100644 samples/bpf/test_overhead_kprobe.bpf.c delete mode 100644 samples/bpf/test_overhead_raw_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_user.c delete mode 100755 samples/bpf/test_override_return.sh delete mode 100644 samples/bpf/test_probe_write_user.bpf.c delete mode 100644 samples/bpf/test_probe_write_user_user.c delete mode 100644 samples/bpf/tracex7.bpf.c delete mode 100644 samples/bpf/tracex7_user.c create mode 100644 tools/testing/selftests/bpf/prog_tests/sock_create.c -- 2.43.0
kselftest/fixes build: 7 builds: 2 failed, 5 passed, 1 warning (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed)
kselftest/fixes build: 7 builds: 2 failed, 5 passed, 1 warning (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed) Full Build Summary: https://kernelci.org/build/kselftest/branch/fixes/kernel/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/ Tree: kselftest Branch: fixes Git Describe: linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed Git Commit: e26e42b5679edf8c1226970325366f962555e58f Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git Built: 4 unique architectures Build Failures Detected: arm64: defconfig+kselftest+arm64-chromebook: (clang-16) FAIL defconfig+kselftest+arm64-chromebook: (gcc-12) FAIL Warnings Detected: arm64: arm: i386: x86_64: x86_64_defconfig+kselftest (clang-16): 1 warning Warnings summary: 1vmlinux.o: warning: objtool: set_ftrace_ops_ro+0x23: relocation to !ENDBR: .text+0x14fd19 Detailed per-defconfig build reports: defconfig+kselftest (arm64, gcc-12) — PASS, 0 errors, 0 warnings, 0 section mismatches defconfig+kselftest+arm64-chromebook (arm64, gcc-12) — FAIL, 0 errors, 0 warnings, 0 section mismatches defconfig+kselftest+arm64-chromebook (arm64, clang-16) — FAIL, 0 errors, 0 warnings, 0 section mismatches i386_defconfig+kselftest (i386, gcc-12) — PASS, 0 errors, 0 warnings, 0 section mismatches multi_v7_defconfig+kselftest (arm, gcc-12) — PASS, 0 errors, 0 warnings, 0 section mismatches x86_64_defconfig+kselftest (x86_64, gcc-12) — PASS, 0 errors, 0 warnings, 0 section mismatches x86_64_defconfig+kselftest (x86_64, clang-16) — PASS, 0 errors, 1 warning, 0 section mismatches Warnings: vmlinux.o: warning: objtool: set_ftrace_ops_ro+0x23: relocation to !ENDBR: .text+0x14fd19 --- For more info write to
kselftest/fixes kselftest-lib: 2 runs, 1 regressions (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed)
kselftest/fixes kselftest-lib: 2 runs, 1 regressions (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed) Regressions Summary --- platform | arch | lab | compiler | defconfig | regressions -+---+-+--+-+ meson-gxl-s905x-libretech-cc | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 Details: https://kernelci.org/test/job/kselftest/branch/fixes/kernel/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/plan/kselftest-lib/ Test: kselftest-lib Tree: kselftest Branch: fixes Describe: linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed URL: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git SHA: e26e42b5679edf8c1226970325366f962555e58f Test Regressions platform | arch | lab | compiler | defconfig | regressions -+---+-+--+-+ meson-gxl-s905x-libretech-cc | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 Details: https://kernelci.org/test/plan/id/670867935b7b683c98c86855 Results: 0 PASS, 1 FAIL, 0 SKIP Full config: defconfig+kselftest Compiler:gcc-12 (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0) Plain log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-lib-meson-gxl-s905x-libretech-cc.txt HTML log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-lib-meson-gxl-s905x-libretech-cc.html Rootfs: http://storage.kernelci.org/images/rootfs/debian/bookworm-kselftest/20240313.0/arm64/initrd.cpio.gz * kselftest-lib.login: https://kernelci.org/test/case/id/670867935b7b683c98c86856 failing since 1 day (last pass: v6.12-rc1-5-g45a8897db67d4, first fail: linux_kselftest-fixes-6.12-rc2-4-g34d5b600172b)
kselftest/fixes kselftest-cpufreq: 3 runs, 2 regressions (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed)
kselftest/fixes kselftest-cpufreq: 3 runs, 2 regressions (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed) Regressions Summary --- platform | arch | lab | compiler | defconfig | regressions -+---+-+--+-+ meson-gxl-s905x-libretech-cc | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 sun50i-a64-pine64-plus | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 Details: https://kernelci.org/test/job/kselftest/branch/fixes/kernel/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/plan/kselftest-cpufreq/ Test: kselftest-cpufreq Tree: kselftest Branch: fixes Describe: linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed URL: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git SHA: e26e42b5679edf8c1226970325366f962555e58f Test Regressions platform | arch | lab | compiler | defconfig | regressions -+---+-+--+-+ meson-gxl-s905x-libretech-cc | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 Details: https://kernelci.org/test/plan/id/6708676e7a41ae1109c86861 Results: 0 PASS, 1 FAIL, 0 SKIP Full config: defconfig+kselftest Compiler:gcc-12 (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0) Plain log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-cpufreq-meson-gxl-s905x-libretech-cc.txt HTML log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-cpufreq-meson-gxl-s905x-libretech-cc.html Rootfs: http://storage.kernelci.org/images/rootfs/debian/bookworm-kselftest/20240313.0/arm64/initrd.cpio.gz * kselftest-cpufreq.login: https://kernelci.org/test/case/id/6708676e7a41ae1109c86862 failing since 1 day (last pass: v6.12-rc1-5-g45a8897db67d4, first fail: linux_kselftest-fixes-6.12-rc2-4-g34d5b600172b) platform | arch | lab | compiler | defconfig | regressions -+---+-+--+-+ sun50i-a64-pine64-plus | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 Details: https://kernelci.org/test/plan/id/67086a1a7942f7bc76c86875 Results: 0 PASS, 1 FAIL, 0 SKIP Full config: defconfig+kselftest Compiler:gcc-12 (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0) Plain log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-cpufreq-sun50i-a64-pine64-plus.txt HTML log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-cpufreq-sun50i-a64-pine64-plus.html Rootfs: http://storage.kernelci.org/images/rootfs/debian/bookworm-kselftest/20240313.0/arm64/initrd.cpio.gz * kselftest-cpufreq.login: https://kernelci.org/test/case/id/67086a1a7942f7bc76c86876 failing since 1 day (last pass: v6.12-rc1-5-g45a8897db67d4, first fail: linux_kselftest-fixes-6.12-rc2-4-g34d5b600172b)
kselftest/fixes kselftest-seccomp: 2 runs, 1 regressions (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed)
kselftest/fixes kselftest-seccomp: 2 runs, 1 regressions (linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed) Regressions Summary --- platform | arch | lab | compiler | defconfig | regressions -+---+-+--+-+ meson-gxl-s905x-libretech-cc | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 Details: https://kernelci.org/test/job/kselftest/branch/fixes/kernel/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/plan/kselftest-seccomp/ Test: kselftest-seccomp Tree: kselftest Branch: fixes Describe: linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed URL: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git SHA: e26e42b5679edf8c1226970325366f962555e58f Test Regressions platform | arch | lab | compiler | defconfig | regressions -+---+-+--+-+ meson-gxl-s905x-libretech-cc | arm64 | lab-broonie | gcc-12 | defconfig+kselftest | 1 Details: https://kernelci.org/test/plan/id/670866b6913f5044d0c86896 Results: 0 PASS, 1 FAIL, 0 SKIP Full config: defconfig+kselftest Compiler:gcc-12 (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0) Plain log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-seccomp-meson-gxl-s905x-libretech-cc.txt HTML log: https://storage.kernelci.org//kselftest/fixes/linux_kselftest-fixes-6.12-rc2-6-ge26e42b5679ed/arm64/defconfig+kselftest/gcc-12/lab-broonie/kselftest-seccomp-meson-gxl-s905x-libretech-cc.html Rootfs: http://storage.kernelci.org/images/rootfs/debian/bookworm-kselftest/20240313.0/arm64/initrd.cpio.gz * kselftest-seccomp.login: https://kernelci.org/test/case/id/670866b6913f5044d0c86897 failing since 1 day (last pass: v6.12-rc1-5-g45a8897db67d4, first fail: linux_kselftest-fixes-6.12-rc2-4-g34d5b600172b)
RE: [PATCH v2 3/6] iommu/vt-d: Make intel_iommu_set_dev_pasid() to handle domain replacement
> From: Baolu Lu > Sent: Wednesday, October 9, 2024 9:09 AM > > On 2024/9/30 15:19, Tian, Kevin wrote: > >> From: Baolu Lu > >> Sent: Friday, September 13, 2024 10:17 AM > >> > >> On 9/13/24 9:35 AM, Baolu Lu wrote: > >>> On 9/12/24 9:04 PM, Yi Liu wrote: > +static void intel_iommu_remove_dev_pasid(struct device *dev, > ioasid_t > pasid, > + struct iommu_domain *domain) > +{ > + struct device_domain_info *info = dev_iommu_priv_get(dev); > + struct intel_iommu *iommu = info->iommu; > + > intel_pasid_tear_down_entry(iommu, dev, pasid, > INTEL_PASID_TEARDOWN_DRAIN_PRQ); > + if (domain->type == IOMMU_DOMAIN_IDENTITY) > + return; > >>> > >>> The static identity domain is not capable of handling page requests. > >>> Therefore there is no need to drain PRQ for an identity domain removal. > >>> > >>> So it probably should be something like this: > >>> > >>> if (domain->type == IOMMU_DOMAIN_IDENTITY) { > >>> intel_pasid_tear_down_entry(iommu, dev, pasid, 0); > >>> return; > >>> } > >>> > >>> intel_pasid_tear_down_entry(iommu, dev, pasid, > >>> INTEL_PASID_TEARDOWN_DRAIN_PRQ); > >> > >> Just revisited this. It seems that we just need to drain PRQ if the > >> attached domain is iopf-capable. Therefore, how about making it like > >> this? > >> > >>unsigned int flags = 0; > >> > >>if (domain->iopf_handler) > >>flags |= INTEL_PASID_TEARDOWN_DRAIN_PRQ; > >> > >>intel_pasid_tear_down_entry(iommu, dev, pasid, flags); > >> > >>/* Identity domain has no meta data for pasid. */ > >>if (domain->type == IOMMU_DOMAIN_IDENTITY) > >>return; > >> > > > > this is the right thing to do, but also suggesting a bug in existing > > code. intel_pasid_tear_down_entry() is not just for PRQ drain. > > It's also about iotlb/devtlb invalidation. From device p.o.v it > > has no idea about the translation mode in the IOMMU side and > > always caches the valid mappings in devtlb when ATS is enabled. > > Yes. You are right. > > intel_pasid_tear_down_entry() takes care of iotlb/devtlb invalidation. > So it's fine as long as intel_pasid_tear_down_entry() is called for the > IDENTITY domain path, right? > > > Existing code skips all those housekeeping for identify domain > > by early return before intel_pasid_tear_down_entry(). We need > > a separate fix for it before this series? > > Existing code doesn't skip intel_pasid_tear_down_entry(). > > if (domain->type == IOMMU_DOMAIN_IDENTITY) { > intel_pasid_tear_down_entry(iommu, dev, pasid, false); > return; > } > > Or anything I overlooked? No. Looks I was confused by this patch and misunderstood the existing code.