bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Andrei Matei <andreimatei1@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH bpf-next v3 0/4] allow variable-offset stack acces
Date: Wed, 10 Feb 2021 11:14:56 -0800	[thread overview]
Message-ID: <CAADnVQLf95h8Wv2tv+e6o9sD25U5skS6RJ=48P+eEyQKamhMkw@mail.gmail.com> (raw)
In-Reply-To: <20210207011027.676572-1-andreimatei1@gmail.com>

On Sat, Feb 6, 2021 at 5:11 PM Andrei Matei <andreimatei1@gmail.com> wrote:
> Before this patch, variable offset access to the stack was dissalowed
> for regular instructions, but was allowed for "indirect" accesses (i.e.
> helpers). This patch removes the restriction, allowing reading and
> writing to the stack through stack pointers with variable offsets. This
> makes stack-allocated buffers more usable in programs, and brings stack
> pointers closer to other types of pointers.
> The motivation is being able to use stack-allocated buffers for data
> manipulation. When the stack size limit is sufficient, allocating
> buffers on the stack is simpler than per-cpu arrays, or other
> alternatives.
> V2 -> V3
> - var-offset writes mark all the stack slots in range as initialized, so
>   that future reads are not rejected.
> - rewrote the C test to not use uprobes, as per Andrii's suggestion.
> - addressed other review comments from Alexei.

I've fixed up Andrii's nits in patch 4,
then moved skel__attach after test_pid init and applied to bpf-next.

I've played with a few other ways to do var stack access in C and all
looked good.
Thanks a lot for making the verifier smarter.

      parent reply	other threads:[~2021-02-10 19:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07  1:10 Andrei Matei
2021-02-07  1:10 ` [PATCH bpf-next v3 1/4] bpf: allow variable-offset stack access Andrei Matei
2021-02-07  1:10 ` [PATCH bpf-next v3 2/4] selftest/bpf: adjust expected verifier errors Andrei Matei
2021-02-07  1:10 ` [PATCH bpf-next v3 3/4] selftest/bpf: verifier tests for var-off access Andrei Matei
2021-02-07  1:10 ` [PATCH bpf-next v3 4/4] selftest/bpf: add test for var-offset stack access Andrei Matei
2021-02-08 22:03   ` Andrii Nakryiko
2021-02-10 19:14 ` Alexei Starovoitov [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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAADnVQLf95h8Wv2tv+e6o9sD25U5skS6RJ=48P+eEyQKamhMkw@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andreimatei1@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --subject='Re: [PATCH bpf-next v3 0/4] allow variable-offset stack acces' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).