Commit 24316461 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

selftests/bpf: validate .bss section bigger than 8MB is possible now

Add a simple big 16MB array and validate access to the very last byte of
it to make sure that kernel supports > KMALLOC_MAX_SIZE value_size for
BPF array maps (which are backing .bss in this case).
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220715053146.1291891-5-andrii@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 63b8ce77
...@@ -122,6 +122,8 @@ void test_skeleton(void) ...@@ -122,6 +122,8 @@ void test_skeleton(void)
ASSERT_EQ(skel->bss->out_mostly_var, 123, "out_mostly_var"); ASSERT_EQ(skel->bss->out_mostly_var, 123, "out_mostly_var");
ASSERT_EQ(bss->huge_arr[ARRAY_SIZE(bss->huge_arr) - 1], 123, "huge_arr");
elf_bytes = test_skeleton__elf_bytes(&elf_bytes_sz); elf_bytes = test_skeleton__elf_bytes(&elf_bytes_sz);
ASSERT_OK_PTR(elf_bytes, "elf_bytes"); ASSERT_OK_PTR(elf_bytes, "elf_bytes");
ASSERT_GE(elf_bytes_sz, 0, "elf_bytes_sz"); ASSERT_GE(elf_bytes_sz, 0, "elf_bytes_sz");
......
...@@ -51,6 +51,8 @@ int out_dynarr[4] SEC(".data.dyn") = { 1, 2, 3, 4 }; ...@@ -51,6 +51,8 @@ int out_dynarr[4] SEC(".data.dyn") = { 1, 2, 3, 4 };
int read_mostly_var __read_mostly; int read_mostly_var __read_mostly;
int out_mostly_var; int out_mostly_var;
char huge_arr[16 * 1024 * 1024];
SEC("raw_tp/sys_enter") SEC("raw_tp/sys_enter")
int handler(const void *ctx) int handler(const void *ctx)
{ {
...@@ -71,6 +73,8 @@ int handler(const void *ctx) ...@@ -71,6 +73,8 @@ int handler(const void *ctx)
out_mostly_var = read_mostly_var; out_mostly_var = read_mostly_var;
huge_arr[sizeof(huge_arr) - 1] = 123;
return 0; return 0;
} }
......
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