From: Daniel Borkmann <daniel@iogearbox.net>
To: Andrii Nakryiko <andriin@fb.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@fb.com,
andrii.nakryiko@gmail.com, kernel-team@fb.com
Subject: Re: [PATCH v2 bpf-next 0/2] Track read-only map contents as known scalars in BPF verifiers
Date: Fri, 11 Oct 2019 01:51:01 +0200 [thread overview]
Message-ID: <20191010235101.GB20202@pc-63.home> (raw)
In-Reply-To: <20191009201458.2679171-1-andriin@fb.com>
On Wed, Oct 09, 2019 at 01:14:56PM -0700, Andrii Nakryiko wrote:
> 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.
>
> v1->v2:
> - BPF_F_RDONLY means nothing, stick to just map->frozen (Daniel);
> - stick to passing just offset into map_direct_value_addr (Martin).
>
> 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 | 57 ++++++++++-
> .../selftests/bpf/prog_tests/rdonly_maps.c | 99 +++++++++++++++++++
> .../selftests/bpf/progs/test_rdonly_maps.c | 83 ++++++++++++++++
> 3 files changed, 237 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
Applied, thanks!
prev parent reply other threads:[~2019-10-10 23:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 20:14 [PATCH v2 bpf-next 0/2] Track read-only map contents as known scalars in BPF verifiers Andrii Nakryiko
2019-10-09 20:14 ` [PATCH v2 bpf-next 1/2] bpf: track contents of read-only maps as scalars Andrii Nakryiko
2019-10-09 20:14 ` [PATCH v2 bpf-next 2/2] selftests/bpf: add read-only map values propagation tests Andrii Nakryiko
2019-10-10 23:51 ` Daniel Borkmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191010235101.GB20202@pc-63.home \
--to=daniel@iogearbox.net \
--cc=andrii.nakryiko@gmail.com \
--cc=andriin@fb.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).