Commit 0b2971a2 authored by Alexei Starovoitov's avatar Alexei Starovoitov

Revert "selftests/bpf: Temporarily disable linked list tests"

This reverts commit 0a2f85a1.
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 68f8e3d4
...@@ -24,9 +24,7 @@ static struct { ...@@ -24,9 +24,7 @@ static struct {
{ #test "_missing_lock_pop_back", \ { #test "_missing_lock_pop_back", \
"bpf_spin_lock at off=" #off " must be held for bpf_list_head" }, "bpf_spin_lock at off=" #off " must be held for bpf_list_head" },
TEST(kptr, 32) TEST(kptr, 32)
/* FIXME
TEST(global, 16) TEST(global, 16)
*/
TEST(map, 0) TEST(map, 0)
TEST(inner_map, 0) TEST(inner_map, 0)
#undef TEST #undef TEST
...@@ -34,6 +32,9 @@ static struct { ...@@ -34,6 +32,9 @@ static struct {
{ #test "_kptr_incorrect_lock_" #op, \ { #test "_kptr_incorrect_lock_" #op, \
"held lock and object are not in the same allocation\n" \ "held lock and object are not in the same allocation\n" \
"bpf_spin_lock at off=32 must be held for bpf_list_head" }, \ "bpf_spin_lock at off=32 must be held for bpf_list_head" }, \
{ #test "_global_incorrect_lock_" #op, \
"held lock and object are not in the same allocation\n" \
"bpf_spin_lock at off=16 must be held for bpf_list_head" }, \
{ #test "_map_incorrect_lock_" #op, \ { #test "_map_incorrect_lock_" #op, \
"held lock and object are not in the same allocation\n" \ "held lock and object are not in the same allocation\n" \
"bpf_spin_lock at off=0 must be held for bpf_list_head" }, \ "bpf_spin_lock at off=0 must be held for bpf_list_head" }, \
...@@ -44,6 +45,10 @@ static struct { ...@@ -44,6 +45,10 @@ static struct {
TEST(kptr, push_back) TEST(kptr, push_back)
TEST(kptr, pop_front) TEST(kptr, pop_front)
TEST(kptr, pop_back) TEST(kptr, pop_back)
TEST(global, push_front)
TEST(global, push_back)
TEST(global, pop_front)
TEST(global, pop_back)
TEST(map, push_front) TEST(map, push_front)
TEST(map, push_back) TEST(map, push_back)
TEST(map, pop_front) TEST(map, pop_front)
...@@ -53,14 +58,12 @@ static struct { ...@@ -53,14 +58,12 @@ static struct {
TEST(inner_map, pop_front) TEST(inner_map, pop_front)
TEST(inner_map, pop_back) TEST(inner_map, pop_back)
#undef TEST #undef TEST
/* FIXME
{ "map_compat_kprobe", "tracing progs cannot use bpf_list_head yet" }, { "map_compat_kprobe", "tracing progs cannot use bpf_list_head yet" },
{ "map_compat_kretprobe", "tracing progs cannot use bpf_list_head yet" }, { "map_compat_kretprobe", "tracing progs cannot use bpf_list_head yet" },
{ "map_compat_tp", "tracing progs cannot use bpf_list_head yet" }, { "map_compat_tp", "tracing progs cannot use bpf_list_head yet" },
{ "map_compat_perf", "tracing progs cannot use bpf_list_head yet" }, { "map_compat_perf", "tracing progs cannot use bpf_list_head yet" },
{ "map_compat_raw_tp", "tracing progs cannot use bpf_list_head yet" }, { "map_compat_raw_tp", "tracing progs cannot use bpf_list_head yet" },
{ "map_compat_raw_tp_w", "tracing progs cannot use bpf_list_head yet" }, { "map_compat_raw_tp_w", "tracing progs cannot use bpf_list_head yet" },
*/
{ "obj_type_id_oor", "local type ID argument must be in range [0, U32_MAX]" }, { "obj_type_id_oor", "local type ID argument must be in range [0, U32_MAX]" },
{ "obj_new_no_composite", "bpf_obj_new type ID argument must be of a struct" }, { "obj_new_no_composite", "bpf_obj_new type ID argument must be of a struct" },
{ "obj_new_no_struct", "bpf_obj_new type ID argument must be of a struct" }, { "obj_new_no_struct", "bpf_obj_new type ID argument must be of a struct" },
...@@ -75,7 +78,6 @@ static struct { ...@@ -75,7 +78,6 @@ static struct {
{ "direct_write_head", "direct access to bpf_list_head is disallowed" }, { "direct_write_head", "direct access to bpf_list_head is disallowed" },
{ "direct_read_node", "direct access to bpf_list_node is disallowed" }, { "direct_read_node", "direct access to bpf_list_node is disallowed" },
{ "direct_write_node", "direct access to bpf_list_node is disallowed" }, { "direct_write_node", "direct access to bpf_list_node is disallowed" },
/* FIXME
{ "write_after_push_front", "only read is supported" }, { "write_after_push_front", "only read is supported" },
{ "write_after_push_back", "only read is supported" }, { "write_after_push_back", "only read is supported" },
{ "use_after_unlock_push_front", "invalid mem access 'scalar'" }, { "use_after_unlock_push_front", "invalid mem access 'scalar'" },
...@@ -92,11 +94,8 @@ static struct { ...@@ -92,11 +94,8 @@ static struct {
{ "no_head_type", "bpf_list_head not found at offset=0" }, { "no_head_type", "bpf_list_head not found at offset=0" },
{ "incorrect_head_var_off1", "R1 doesn't have constant offset" }, { "incorrect_head_var_off1", "R1 doesn't have constant offset" },
{ "incorrect_head_var_off2", "variable ptr_ access var_off=(0x0; 0xffffffff) disallowed" }, { "incorrect_head_var_off2", "variable ptr_ access var_off=(0x0; 0xffffffff) disallowed" },
*/
{ "incorrect_head_off1", "bpf_list_head not found at offset=17" }, { "incorrect_head_off1", "bpf_list_head not found at offset=17" },
/* FIXME
{ "incorrect_head_off2", "bpf_list_head not found at offset=1" }, { "incorrect_head_off2", "bpf_list_head not found at offset=1" },
*/
{ "pop_front_off", { "pop_front_off",
"15: (bf) r1 = r6 ; R1_w=ptr_or_null_foo(id=4,ref_obj_id=4,off=40,imm=0) " "15: (bf) r1 = r6 ; R1_w=ptr_or_null_foo(id=4,ref_obj_id=4,off=40,imm=0) "
"R6_w=ptr_or_null_foo(id=4,ref_obj_id=4,off=40,imm=0) refs=2,4\n" "R6_w=ptr_or_null_foo(id=4,ref_obj_id=4,off=40,imm=0) refs=2,4\n"
...@@ -189,10 +188,8 @@ static void test_linked_list_success(int mode, bool leave_in_map) ...@@ -189,10 +188,8 @@ static void test_linked_list_success(int mode, bool leave_in_map)
ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.global_list_push_pop), &opts); ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.global_list_push_pop), &opts);
ASSERT_OK(ret, "global_list_push_pop"); ASSERT_OK(ret, "global_list_push_pop");
ASSERT_OK(opts.retval, "global_list_push_pop retval"); ASSERT_OK(opts.retval, "global_list_push_pop retval");
/* FIXME:
if (!leave_in_map) if (!leave_in_map)
clear_fields(skel->maps.data_A); clear_fields(skel->maps.data_A);
*/
if (mode == PUSH_POP) if (mode == PUSH_POP)
goto end; goto end;
...@@ -213,10 +210,8 @@ static void test_linked_list_success(int mode, bool leave_in_map) ...@@ -213,10 +210,8 @@ static void test_linked_list_success(int mode, bool leave_in_map)
ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.global_list_push_pop_multiple), &opts); ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.global_list_push_pop_multiple), &opts);
ASSERT_OK(ret, "global_list_push_pop_multiple"); ASSERT_OK(ret, "global_list_push_pop_multiple");
ASSERT_OK(opts.retval, "global_list_push_pop_multiple retval"); ASSERT_OK(opts.retval, "global_list_push_pop_multiple retval");
/* FIXME:
if (!leave_in_map) if (!leave_in_map)
clear_fields(skel->maps.data_A); clear_fields(skel->maps.data_A);
*/
if (mode == PUSH_POP_MULT) if (mode == PUSH_POP_MULT)
goto end; goto end;
...@@ -237,10 +232,8 @@ static void test_linked_list_success(int mode, bool leave_in_map) ...@@ -237,10 +232,8 @@ static void test_linked_list_success(int mode, bool leave_in_map)
ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.global_list_in_list), &opts); ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.global_list_in_list), &opts);
ASSERT_OK(ret, "global_list_in_list"); ASSERT_OK(ret, "global_list_in_list");
ASSERT_OK(opts.retval, "global_list_in_list retval"); ASSERT_OK(opts.retval, "global_list_in_list retval");
/* FIXME:
if (!leave_in_map) if (!leave_in_map)
clear_fields(skel->maps.data_A); clear_fields(skel->maps.data_A);
*/
end: end:
linked_list__destroy(skel); linked_list__destroy(skel);
} }
......
...@@ -291,10 +291,7 @@ int inner_map_list_push_pop(void *ctx) ...@@ -291,10 +291,7 @@ int inner_map_list_push_pop(void *ctx)
SEC("tc") SEC("tc")
int global_list_push_pop(void *ctx) int global_list_push_pop(void *ctx)
{ {
/* FIXME: return test_list_push_pop(&glock, &ghead);
* return test_list_push_pop(&glock, &ghead);
*/
return 0;
} }
SEC("tc") SEC("tc")
...@@ -330,13 +327,10 @@ int global_list_push_pop_multiple(void *ctx) ...@@ -330,13 +327,10 @@ int global_list_push_pop_multiple(void *ctx)
{ {
int ret; int ret;
/* FIXME:
ret = list_push_pop_multiple(&glock, &ghead, false); ret = list_push_pop_multiple(&glock, &ghead, false);
if (ret) if (ret)
return ret; return ret;
return list_push_pop_multiple(&glock, &ghead, true); return list_push_pop_multiple(&glock, &ghead, true);
*/
return 0;
} }
SEC("tc") SEC("tc")
...@@ -370,10 +364,7 @@ int inner_map_list_in_list(void *ctx) ...@@ -370,10 +364,7 @@ int inner_map_list_in_list(void *ctx)
SEC("tc") SEC("tc")
int global_list_in_list(void *ctx) int global_list_in_list(void *ctx)
{ {
/* FIXME
return test_list_in_list(&glock, &ghead); return test_list_in_list(&glock, &ghead);
*/
return 0;
} }
char _license[] SEC("license") = "GPL"; char _license[] SEC("license") = "GPL";
...@@ -47,12 +47,10 @@ struct { ...@@ -47,12 +47,10 @@ struct {
}, },
}; };
/* FIXME
#define private(name) SEC(".data." #name) __hidden __attribute__((aligned(8))) #define private(name) SEC(".data." #name) __hidden __attribute__((aligned(8)))
private(A) struct bpf_spin_lock glock; private(A) struct bpf_spin_lock glock;
private(A) struct bpf_list_head ghead __contains(foo, node); private(A) struct bpf_list_head ghead __contains(foo, node);
private(B) struct bpf_spin_lock glock2; private(B) struct bpf_spin_lock glock2;
*/
#endif #endif
...@@ -59,12 +59,10 @@ CHECK(kptr, push_back, &f->head); ...@@ -59,12 +59,10 @@ CHECK(kptr, push_back, &f->head);
CHECK(kptr, pop_front, &f->head); CHECK(kptr, pop_front, &f->head);
CHECK(kptr, pop_back, &f->head); CHECK(kptr, pop_back, &f->head);
/* FIXME
CHECK(global, push_front, &ghead); CHECK(global, push_front, &ghead);
CHECK(global, push_back, &ghead); CHECK(global, push_back, &ghead);
CHECK(global, pop_front, &ghead); CHECK(global, pop_front, &ghead);
CHECK(global, pop_back, &ghead); CHECK(global, pop_back, &ghead);
*/
CHECK(map, push_front, &v->head); CHECK(map, push_front, &v->head);
CHECK(map, push_back, &v->head); CHECK(map, push_back, &v->head);
...@@ -91,15 +89,23 @@ CHECK(inner_map, pop_back, &iv->head); ...@@ -91,15 +89,23 @@ CHECK(inner_map, pop_back, &iv->head);
#define CHECK_OP(op) \ #define CHECK_OP(op) \
CHECK(kptr_kptr, op, &f1->lock, &f2->head); \ CHECK(kptr_kptr, op, &f1->lock, &f2->head); \
CHECK(kptr_global, op, &f1->lock, &ghead); \
CHECK(kptr_map, op, &f1->lock, &v->head); \ CHECK(kptr_map, op, &f1->lock, &v->head); \
CHECK(kptr_inner_map, op, &f1->lock, &iv->head); \ CHECK(kptr_inner_map, op, &f1->lock, &iv->head); \
\ \
CHECK(global_global, op, &glock2, &ghead); \
CHECK(global_kptr, op, &glock, &f1->head); \
CHECK(global_map, op, &glock, &v->head); \
CHECK(global_inner_map, op, &glock, &iv->head); \
\
CHECK(map_map, op, &v->lock, &v2->head); \ CHECK(map_map, op, &v->lock, &v2->head); \
CHECK(map_kptr, op, &v->lock, &f2->head); \ CHECK(map_kptr, op, &v->lock, &f2->head); \
CHECK(map_global, op, &v->lock, &ghead); \
CHECK(map_inner_map, op, &v->lock, &iv->head); \ CHECK(map_inner_map, op, &v->lock, &iv->head); \
\ \
CHECK(inner_map_inner_map, op, &iv->lock, &iv2->head); \ CHECK(inner_map_inner_map, op, &iv->lock, &iv2->head); \
CHECK(inner_map_kptr, op, &iv->lock, &f2->head); \ CHECK(inner_map_kptr, op, &iv->lock, &f2->head); \
CHECK(inner_map_global, op, &iv->lock, &ghead); \
CHECK(inner_map_map, op, &iv->lock, &v->head); CHECK(inner_map_map, op, &iv->lock, &v->head);
CHECK_OP(push_front); CHECK_OP(push_front);
...@@ -111,7 +117,6 @@ CHECK_OP(pop_back); ...@@ -111,7 +117,6 @@ CHECK_OP(pop_back);
#undef CHECK_OP #undef CHECK_OP
#undef INIT #undef INIT
/* FIXME
SEC("?kprobe/xyz") SEC("?kprobe/xyz")
int map_compat_kprobe(void *ctx) int map_compat_kprobe(void *ctx)
{ {
...@@ -153,7 +158,6 @@ int map_compat_raw_tp_w(void *ctx) ...@@ -153,7 +158,6 @@ int map_compat_raw_tp_w(void *ctx)
bpf_list_push_front(&ghead, NULL); bpf_list_push_front(&ghead, NULL);
return 0; return 0;
} }
*/
SEC("?tc") SEC("?tc")
int obj_type_id_oor(void *ctx) int obj_type_id_oor(void *ctx)
...@@ -299,7 +303,6 @@ int direct_write_node(void *ctx) ...@@ -299,7 +303,6 @@ int direct_write_node(void *ctx)
return 0; return 0;
} }
/* FIXME
static __always_inline static __always_inline
int write_after_op(void (*push_op)(void *head, void *node)) int write_after_op(void (*push_op)(void *head, void *node))
{ {
...@@ -503,7 +506,6 @@ int incorrect_head_var_off2(struct __sk_buff *ctx) ...@@ -503,7 +506,6 @@ int incorrect_head_var_off2(struct __sk_buff *ctx)
return 0; return 0;
} }
*/
SEC("?tc") SEC("?tc")
int incorrect_head_off1(void *ctx) int incorrect_head_off1(void *ctx)
...@@ -527,7 +529,6 @@ int incorrect_head_off1(void *ctx) ...@@ -527,7 +529,6 @@ int incorrect_head_off1(void *ctx)
return 0; return 0;
} }
/* FIXME
SEC("?tc") SEC("?tc")
int incorrect_head_off2(void *ctx) int incorrect_head_off2(void *ctx)
{ {
...@@ -544,7 +545,6 @@ int incorrect_head_off2(void *ctx) ...@@ -544,7 +545,6 @@ int incorrect_head_off2(void *ctx)
return 0; return 0;
} }
*/
static __always_inline static __always_inline
int pop_ptr_off(void *(*op)(void *head)) int pop_ptr_off(void *(*op)(void *head))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment