Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Pull bpf fixes from Alexei Starovoitov: - Replace bpf_map_kmalloc_node() with kmalloc_nolock() to fix kmemleak imbalance in tracking of bpf_async_cb structures (Alexei Starovoitov) - Make selftests/bpf arg_parsing.c more robust to errors (Andrii Nakryiko) - Fix redefinition of 'off' as different kind of symbol when I40E driver is builtin (Brahmajit Das) - Do not disable preemption in bpf_test_run (Sahil Chandna) - Fix memory leak in __lookup_instance error path (Shardul Bankar) - Ensure test data is flushed to disk before reading it (Xing Guo) * tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: selftests/bpf: Fix redefinition of 'off' as different kind of symbol bpf: Do not disable preemption in bpf_test_run(). bpf: Fix memory leak in __lookup_instance error path selftests: arg_parsing: Ensure data is flushed to disk before reading. bpf: Replace bpf_map_kmalloc_node() with kmalloc_nolock() to allocate bpf_async_cb structures. selftests/bpf: make arg_parsing.c more robust to crashes bpf: test_run: Fix ctx leak in bpf_prog_test_run_xdp error path
This commit is contained in:
@@ -144,11 +144,17 @@ static void test_parse_test_list_file(void)
|
||||
if (!ASSERT_OK(ferror(fp), "prepare tmp"))
|
||||
goto out_fclose;
|
||||
|
||||
if (!ASSERT_OK(fsync(fileno(fp)), "fsync tmp"))
|
||||
goto out_fclose;
|
||||
|
||||
init_test_filter_set(&set);
|
||||
|
||||
ASSERT_OK(parse_test_list_file(tmpfile, &set, true), "parse file");
|
||||
if (!ASSERT_OK(parse_test_list_file(tmpfile, &set, true), "parse file"))
|
||||
goto out_fclose;
|
||||
|
||||
if (!ASSERT_EQ(set.cnt, 4, "test count"))
|
||||
goto out_free_set;
|
||||
|
||||
ASSERT_EQ(set.cnt, 4, "test count");
|
||||
ASSERT_OK(strcmp("test_with_spaces", set.tests[0].name), "test 0 name");
|
||||
ASSERT_EQ(set.tests[0].subtest_cnt, 0, "test 0 subtest count");
|
||||
ASSERT_OK(strcmp("testA", set.tests[1].name), "test 1 name");
|
||||
@@ -158,8 +164,8 @@ static void test_parse_test_list_file(void)
|
||||
ASSERT_OK(strcmp("testB", set.tests[2].name), "test 2 name");
|
||||
ASSERT_OK(strcmp("testC_no_eof_newline", set.tests[3].name), "test 3 name");
|
||||
|
||||
out_free_set:
|
||||
free_test_filter_set(&set);
|
||||
|
||||
out_fclose:
|
||||
fclose(fp);
|
||||
out_remove:
|
||||
|
||||
@@ -225,7 +225,7 @@ int trusted_to_untrusted(void *ctx)
|
||||
}
|
||||
|
||||
char mem[16];
|
||||
u32 off;
|
||||
u32 offset;
|
||||
|
||||
SEC("tp_btf/sys_enter")
|
||||
__success
|
||||
@@ -240,9 +240,9 @@ int anything_to_untrusted(void *ctx)
|
||||
/* scalar to untrusted */
|
||||
subprog_untrusted(0);
|
||||
/* variable offset to untrusted (map) */
|
||||
subprog_untrusted((void *)mem + off);
|
||||
subprog_untrusted((void *)mem + offset);
|
||||
/* variable offset to untrusted (trusted) */
|
||||
subprog_untrusted((void *)bpf_get_current_task_btf() + off);
|
||||
subprog_untrusted((void *)bpf_get_current_task_btf() + offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -298,12 +298,12 @@ int anything_to_untrusted_mem(void *ctx)
|
||||
/* scalar to untrusted mem */
|
||||
subprog_void_untrusted(0);
|
||||
/* variable offset to untrusted mem (map) */
|
||||
subprog_void_untrusted((void *)mem + off);
|
||||
subprog_void_untrusted((void *)mem + offset);
|
||||
/* variable offset to untrusted mem (trusted) */
|
||||
subprog_void_untrusted(bpf_get_current_task_btf() + off);
|
||||
subprog_void_untrusted(bpf_get_current_task_btf() + offset);
|
||||
/* variable offset to untrusted char/enum (map) */
|
||||
subprog_char_untrusted(mem + off);
|
||||
subprog_enum_untrusted((void *)mem + off);
|
||||
subprog_char_untrusted(mem + offset);
|
||||
subprog_enum_untrusted((void *)mem + offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user