[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191008194548.2344473-1-andriin@fb.com>
Date: Tue, 8 Oct 2019 12:45:46 -0700
From: Andrii Nakryiko <andriin@...com>
To: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>, <ast@...com>,
<daniel@...earbox.net>
CC: <andrii.nakryiko@...il.com>, <kernel-team@...com>,
Andrii Nakryiko <andriin@...com>
Subject: [PATCH bpf-next 0/2] Track read-only map contents as known scalars in BPF verifiers
With BPF maps supporting direct map access (currently, array_map w/ single
element, used for global data) that are read-only both from system call and
BPF side, it's possible for BPF verifier to track its contents as known
constants.
Now it's possible for user-space control app to pre-initialize read-only map
(e.g., for .rodata section) with user-provided flags and parameters and rely
on BPF verifier to detect and eliminate dead code resulting from specific
combination of input parameters.
Andrii Nakryiko (2):
bpf: track contents of read-only maps as scalars
selftests/bpf: add read-only map values propagation tests
kernel/bpf/verifier.c | 58 ++++++++++-
.../selftests/bpf/prog_tests/rdonly_maps.c | 99 +++++++++++++++++++
.../selftests/bpf/progs/test_rdonly_maps.c | 83 ++++++++++++++++
3 files changed, 238 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/rdonly_maps.c
create mode 100644 tools/testing/selftests/bpf/progs/test_rdonly_maps.c
--
2.17.1
Powered by blists - more mailing lists