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: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220715053146.1291891-5-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Andrii Nakryiko 2022-07-14 22:31:46 -07:00 committed by Alexei Starovoitov
parent 63b8ce77b1
commit 2431646120
2 changed files with 6 additions and 0 deletions

View File

@ -122,6 +122,8 @@ void test_skeleton(void)
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);
ASSERT_OK_PTR(elf_bytes, "elf_bytes");
ASSERT_GE(elf_bytes_sz, 0, "elf_bytes_sz");

View File

@ -51,6 +51,8 @@ int out_dynarr[4] SEC(".data.dyn") = { 1, 2, 3, 4 };
int read_mostly_var __read_mostly;
int out_mostly_var;
char huge_arr[16 * 1024 * 1024];
SEC("raw_tp/sys_enter")
int handler(const void *ctx)
{
@ -71,6 +73,8 @@ int handler(const void *ctx)
out_mostly_var = read_mostly_var;
huge_arr[sizeof(huge_arr) - 1] = 123;
return 0;
}