]> www.infradead.org Git - nvme.git/commit
selftests/bpf: fexit_sleep: Fix stack allocation for arm64
authorPuranjay Mohan <puranjay@kernel.org>
Mon, 15 Jul 2024 17:33:27 +0000 (17:33 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 17 Jul 2024 17:22:44 +0000 (19:22 +0200)
commite1ef78dce9b7b0fa7f9d88bb3554441d74d33b34
tree30d09e5eee781120345ae48d102d4980262b20d8
parent0e03c643dc9389e61fa484562dae58c8d6e96d63
selftests/bpf: fexit_sleep: Fix stack allocation for arm64

On ARM64 the stack pointer should be aligned at a 16 byte boundary or
the SPAlignmentFault can occur. The fexit_sleep selftest allocates the
stack for the child process as a character array, this is not guaranteed
to be aligned at 16 bytes.

Because of the SPAlignmentFault, the child process is killed before it
can do the nanosleep call and hence fentry_cnt remains as 0. This causes
the main thread to hang on the following line:

while (READ_ONCE(fexit_skel->bss->fentry_cnt) != 2);

Fix this by allocating the stack using mmap() as described in the
example in the man page of clone().

Remove the fexit_sleep test from the DENYLIST of arm64.

Fixes: eddbe8e65214 ("selftest/bpf: Add a test to check trampoline freeing logic.")
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20240715173327.8657-1-puranjay@kernel.org
tools/testing/selftests/bpf/DENYLIST.aarch64
tools/testing/selftests/bpf/prog_tests/fexit_sleep.c