selftests/bpf: Test ringbuf mmap read-only and read-write restrictions
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 14 May 2021 18:07:26 +0000 (11:07 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 20 May 2021 21:48:38 +0000 (23:48 +0200)
commit704e2beba23c45eaa056b1c03b5e1fb221e03f80
treeea97b769abc7cc1c79e625421809834528689e47
parent8f1634b82189e715b0f82f16ce54fab43cfedd8a
selftests/bpf: Test ringbuf mmap read-only and read-write restrictions

Extend ringbuf selftest to validate read/write and read-only restrictions on
memory mapping consumer/producer/data pages. Ensure no "escalations" from
PROT_READ to PROT_WRITE/PROT_EXEC is allowed. And test that mremap() fails to
expand mmap()'ed area.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210514180726.843157-1-andrii@kernel.org
tools/testing/selftests/bpf/prog_tests/ringbuf.c