bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Track read-only map contents as known scalars in BPF verifiers
@ 2019-10-08 19:45 Andrii Nakryiko
  2019-10-08 19:45 ` [PATCH bpf-next 1/2] bpf: track contents of read-only maps as scalars Andrii Nakryiko
  2019-10-08 19:45 ` [PATCH bpf-next 2/2] selftests/bpf: add read-only map values propagation tests Andrii Nakryiko
  0 siblings, 2 replies; 9+ messages in thread
From: Andrii Nakryiko @ 2019-10-08 19:45 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-10-09  2:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 19:45 [PATCH bpf-next 0/2] Track read-only map contents as known scalars in BPF verifiers Andrii Nakryiko
2019-10-08 19:45 ` [PATCH bpf-next 1/2] bpf: track contents of read-only maps as scalars Andrii Nakryiko
2019-10-08 21:29   ` Daniel Borkmann
2019-10-08 23:41     ` Andrii Nakryiko
2019-10-08 21:53   ` Martin Lau
2019-10-08 23:49     ` Andrii Nakryiko
2019-10-09  0:34       ` Martin Lau
2019-10-09  2:48         ` Andrii Nakryiko
2019-10-08 19:45 ` [PATCH bpf-next 2/2] selftests/bpf: add read-only map values propagation tests Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).