Context |
Check |
Description |
bpf/vmtest-bpf-next-VM_Test-0 |
success
|
Logs for Lint
|
bpf/vmtest-bpf-next-VM_Test-1 |
success
|
Logs for ShellCheck
|
bpf/vmtest-bpf-next-VM_Test-2 |
success
|
Logs for Unittests
|
bpf/vmtest-bpf-next-VM_Test-3 |
success
|
Logs for Validate matrix.py
|
bpf/vmtest-bpf-next-VM_Test-4 |
success
|
Logs for aarch64-gcc / GCC BPF
|
bpf/vmtest-bpf-next-VM_Test-5 |
success
|
Logs for aarch64-gcc / build / build for aarch64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-24 |
success
|
Logs for x86_64-gcc / build-release
|
bpf/vmtest-bpf-next-VM_Test-25 |
success
|
Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-30 |
success
|
Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-31 |
success
|
Logs for x86_64-gcc / veristat-kernel / x86_64-gcc veristat_kernel
|
bpf/vmtest-bpf-next-VM_Test-34 |
success
|
Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17
|
bpf/vmtest-bpf-next-VM_Test-35 |
success
|
Logs for x86_64-llvm-17 / build-release / build for x86_64 with llvm-17-O2
|
bpf/vmtest-bpf-next-VM_Test-40 |
success
|
Logs for x86_64-llvm-17 / veristat-kernel
|
bpf/vmtest-bpf-next-VM_Test-39 |
success
|
Logs for x86_64-llvm-17 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-17
|
bpf/vmtest-bpf-next-VM_Test-41 |
success
|
Logs for x86_64-llvm-17 / veristat-meta
|
bpf/vmtest-bpf-next-VM_Test-13 |
success
|
Logs for s390x-gcc / GCC BPF
|
bpf/vmtest-bpf-next-VM_Test-11 |
success
|
Logs for aarch64-gcc / veristat-kernel
|
bpf/vmtest-bpf-next-VM_Test-18 |
success
|
Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
|
bpf/vmtest-bpf-next-VM_Test-14 |
success
|
Logs for s390x-gcc / build / build for s390x with gcc
|
bpf/vmtest-bpf-next-VM_Test-12 |
success
|
Logs for aarch64-gcc / veristat-meta
|
bpf/vmtest-bpf-next-VM_Test-20 |
success
|
Logs for s390x-gcc / veristat-meta
|
bpf/vmtest-bpf-next-VM_Test-19 |
success
|
Logs for s390x-gcc / veristat-kernel
|
bpf/vmtest-bpf-next-VM_Test-21 |
success
|
Logs for set-matrix
|
bpf/vmtest-bpf-next-VM_Test-43 |
success
|
Logs for x86_64-llvm-18 / build / build for x86_64 with llvm-18
|
bpf/vmtest-bpf-next-VM_Test-23 |
success
|
Logs for x86_64-gcc / build / build for x86_64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-15 |
success
|
Logs for s390x-gcc / build-release
|
bpf/vmtest-bpf-next-VM_Test-44 |
success
|
Logs for x86_64-llvm-18 / build-release / build for x86_64 with llvm-18-O2
|
bpf/vmtest-bpf-next-VM_Test-6 |
success
|
Logs for aarch64-gcc / build-release
|
bpf/vmtest-bpf-next-VM_Test-49 |
success
|
Logs for x86_64-llvm-18 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-18
|
bpf/vmtest-bpf-next-VM_Test-50 |
success
|
Logs for x86_64-llvm-18 / veristat-kernel
|
bpf/vmtest-bpf-next-VM_Test-51 |
success
|
Logs for x86_64-llvm-18 / veristat-meta
|
bpf/vmtest-bpf-next-VM_Test-27 |
fail
|
Logs for x86_64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-26 |
fail
|
Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-28 |
success
|
Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-29 |
success
|
Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-32 |
success
|
Logs for x86_64-gcc / veristat-meta / x86_64-gcc veristat_meta
|
bpf/vmtest-bpf-next-VM_Test-33 |
success
|
Logs for x86_64-llvm-17 / GCC BPF / GCC BPF
|
bpf/vmtest-bpf-next-VM_Test-10 |
success
|
Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-7 |
success
|
Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-22 |
success
|
Logs for x86_64-gcc / GCC BPF / GCC BPF
|
bpf/vmtest-bpf-next-VM_Test-36 |
success
|
Logs for x86_64-llvm-17 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-17
|
bpf/vmtest-bpf-next-VM_Test-37 |
fail
|
Logs for x86_64-llvm-17 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-17
|
bpf/vmtest-bpf-next-VM_Test-38 |
fail
|
Logs for x86_64-llvm-17 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-17
|
bpf/vmtest-bpf-next-VM_Test-42 |
success
|
Logs for x86_64-llvm-18 / GCC BPF / GCC BPF
|
bpf/vmtest-bpf-next-VM_Test-45 |
success
|
Logs for x86_64-llvm-18 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-18
|
bpf/vmtest-bpf-next-VM_Test-46 |
fail
|
Logs for x86_64-llvm-18 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-18
|
bpf/vmtest-bpf-next-VM_Test-47 |
fail
|
Logs for x86_64-llvm-18 / test (test_progs_cpuv4, false, 360) / test_progs_cpuv4 on x86_64 with llvm-18
|
bpf/vmtest-bpf-next-VM_Test-48 |
fail
|
Logs for x86_64-llvm-18 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-18
|
bpf/vmtest-bpf-next-PR |
fail
|
PR summary
|
bpf/vmtest-bpf-next-VM_Test-8 |
fail
|
Logs for aarch64-gcc / test (test_progs, false, 360) / test_progs on aarch64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-9 |
fail
|
Logs for aarch64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on aarch64 with gcc
|
bpf/vmtest-bpf-next-VM_Test-17 |
fail
|
Logs for s390x-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on s390x with gcc
|
bpf/vmtest-bpf-next-VM_Test-16 |
fail
|
Logs for s390x-gcc / test (test_progs, false, 360) / test_progs on s390x with gcc
|
netdev/series_format |
success
|
Posting correctly formatted
|
netdev/tree_selection |
success
|
Guessed tree name to be net-next, async
|
netdev/ynl |
success
|
Generated files up to date;
no warnings/errors;
no diff in generated;
|
netdev/fixes_present |
success
|
Fixes tag not required for -next series
|
netdev/header_inline |
success
|
No static functions without inline keyword in header files
|
netdev/build_32bit |
success
|
Errors and warnings before: 0 this patch: 0
|
netdev/build_tools |
success
|
Errors and warnings before: 26 (+0) this patch: 26 (+0)
|
netdev/cc_maintainers |
warning
|
12 maintainers not CCed: sdf@fomichev.me linux-kselftest@vger.kernel.org eddyz87@gmail.com jolsa@kernel.org song@kernel.org martin.lau@linux.dev haoluo@google.com mykolal@fb.com john.fastabend@gmail.com yonghong.song@linux.dev shuah@kernel.org kpsingh@kernel.org
|
netdev/build_clang |
success
|
Errors and warnings before: 1 this patch: 1
|
netdev/verify_signedoff |
success
|
Signed-off-by tag matches author and committer
|
netdev/deprecated_api |
success
|
None detected
|
netdev/check_selftest |
success
|
No net selftest shell script
|
netdev/verify_fixes |
success
|
No Fixes tag
|
netdev/build_allmodconfig_warn |
success
|
Errors and warnings before: 4 this patch: 4
|
netdev/checkpatch |
warning
|
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
WARNING: line length of 83 exceeds 80 columns
WARNING: line length of 86 exceeds 80 columns
WARNING: line length of 92 exceeds 80 columns
|
netdev/build_clang_rust |
success
|
No Rust files in patch. Skipping build
|
netdev/kdoc |
success
|
Errors and warnings before: 0 this patch: 0
|
netdev/source_inline |
success
|
Was 0 now: 0
|
new file mode 100644
@@ -0,0 +1,77 @@
+#include <test_progs.h>
+
+#include "uptr_kv_store.h"
+#include "test_uptr_kv_store_common.h"
+#include "test_uptr_kv_store.skel.h"
+
+static void test_uptr_kv_store_basic(void)
+{
+ int err, i, pid, int_val, *int_val_p, max_int_entries;
+ struct test_uptr_kv_store *skel;
+ struct kv_store *kvs = NULL;
+
+ skel = test_uptr_kv_store__open_and_load();
+ if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
+ return;
+
+ skel->bss->target_pid = -1;
+ err = test_uptr_kv_store__attach(skel);
+ if (!ASSERT_OK(err, "skel_attach"))
+ return;
+
+ kvs = kv_store_init(getpid(), skel->maps.data_map, "/sys/fs/bpf/kv_store_data_map");
+ if (!ASSERT_OK_PTR(kvs, "kv_store_init"))
+ return;
+
+ max_int_entries = KVS_MAX_VAL_ENTRIES;
+
+ err = kv_store_update_value_size(kvs, 0, KVS_MAX_VAL_SIZE);
+ ASSERT_ERR(err, "kv_store_update_value_size");
+
+ err = kv_store_put(kvs, 0, &int_val, KVS_MAX_VAL_SIZE + 1);
+ ASSERT_ERR(err, "kv_store_put");
+
+ for (i = 0; i < max_int_entries; i++) {
+ int_val_p = kv_store_get(kvs, i);
+ if (!ASSERT_ERR_PTR(int_val_p, "kv_store_get int_val"))
+ goto out;
+
+ err = kv_store_put(kvs, i, &i, sizeof(i));
+ if (!ASSERT_OK(err, "kv_store_put int_val"))
+ goto out;
+ }
+
+ pid = sys_gettid();
+ skel->bss->target_pid = pid;
+ for (i = 0; i < max_int_entries; i++) {
+ skel->bss->test_key = i;
+ skel->bss->test_op = KVS_INT_GET;
+ sys_gettid();
+ ASSERT_EQ(skel->bss->test_int_val, i, "bpf: check int_val[i] = i");
+
+ skel->bss->test_int_val += 1;
+ skel->bss->test_op = KVS_INT_PUT;
+ sys_gettid();
+ }
+ skel->bss->target_pid = -1;
+
+ for (i = 0; i < max_int_entries; i++) {
+ int_val_p = kv_store_get(kvs, i);
+ if (!ASSERT_OK_PTR(int_val_p, "kv_store_get int_val"))
+ goto out;
+
+ ASSERT_EQ(*int_val_p, i + 1, "user space: check int_val[i] == i + 1");
+ }
+
+ err = kv_store_put(kvs, max_int_entries, &int_val, sizeof(int));
+ ASSERT_EQ(err, -ENOENT, "kv_store_put int_val");
+
+out:
+ kv_store_close(kvs);
+}
+
+void test_uptr_kv_store(void)
+{
+ if (test__start_subtest("uptr_kv_store_basic"))
+ test_uptr_kv_store_basic();
+}
new file mode 100644
@@ -0,0 +1,37 @@
+#include <vmlinux.h>
+#include <bpf/bpf_helpers.h>
+
+#include "uptr_kv_store.h"
+#include "test_uptr_kv_store_common.h"
+
+pid_t target_pid = 0;
+int test_op;
+int test_key;
+int test_int_val;
+
+SEC("tp_btf/sys_enter")
+int on_enter(__u64 *ctx)
+{
+ struct kv_store_data_map_value *data;
+ struct task_struct *task;
+
+ task = bpf_get_current_task_btf();
+ if (task->pid != target_pid)
+ return 0;
+
+ data = bpf_task_storage_get(&data_map, task, 0, 0);
+
+ switch (test_op) {
+ case KVS_INT_PUT:
+ kv_store_put(data, test_key, &test_int_val, 4);
+ break;
+ case KVS_INT_GET:
+ kv_store_get(data, test_key, &test_int_val, 4);
+ break;
+ }
+
+ return 0;
+}
+
+char _license[] SEC("license") = "GPL";
+
new file mode 100644
@@ -0,0 +1,9 @@
+#ifndef _TEST_UPTR_KV_STORE_COMMON_H
+#define _TEST_UPTR_KV_STORE_COMMON_H
+
+enum test_kvs_op {
+ KVS_INT_GET,
+ KVS_INT_PUT,
+};
+
+#endif
Make sure both user space and bpf programs can correctly manipulate the KV store. In the first loop, for each key, we first try to get the value, this should fail as it is not yet initialized. Then, we put the value as the key. In the second loop, for each key, a bpf program is triggered to get the value, and then put a new value. In the final loop, we get the value again in the user space and make sure they are the new value. Signed-off-by: Amery Hung <ameryhung@gmail.com> --- .../bpf/prog_tests/test_uptr_kv_store.c | 77 +++++++++++++++++++ .../selftests/bpf/progs/test_uptr_kv_store.c | 37 +++++++++ .../selftests/bpf/test_uptr_kv_store_common.h | 9 +++ 3 files changed, 123 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/test_uptr_kv_store.c create mode 100644 tools/testing/selftests/bpf/progs/test_uptr_kv_store.c create mode 100644 tools/testing/selftests/bpf/test_uptr_kv_store_common.h