From: Eduard Zingerman <eddyz87@gmail.com>
To: Yonghong Song <yonghong.song@linux.dev>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>,
Kuniyuki Iwashima <kuniyu@amazon.com>,
Martin KaFai Lau <kafai@fb.com>
Subject: Re: [PATCH bpf-next v3 1/2] bpf: Track aligned st store as imprecise spilled registers
Date: Tue, 09 Jan 2024 20:02:41 +0200 [thread overview]
Message-ID: <de8dd3773d84b4c07fbba2776d52bf2114ca5414.camel@gmail.com> (raw)
In-Reply-To: <20240109040524.2313448-1-yonghong.song@linux.dev>
On Mon, 2024-01-08 at 20:05 -0800, Yonghong Song wrote:
[...]
> @@ -4640,7 +4641,18 @@ static int check_stack_write_var_off(struct bpf_verifier_env *env,
> return -EINVAL;
> }
>
> - /* Erase all spilled pointers. */
> + /* If writing_zero and the the spi slot contains a spill of value 0,
> + * maintain the spill type.
> + */
> + if (writing_zero && is_spilled_scalar_reg(&state->stack[spi])) {
As discussed on offlist today, this should probably look as follows:
- if (writing_zero && is_spilled_scalar_reg(&state->stack[spi])) {
+ if (writing_zero && *stype == STACK_SPILL && is_spilled_scalar_reg(&state->stack[spi])) {
In order to handle cases like "mmmmSSSS" for slot types.
> + spill_reg = &state->stack[spi].spilled_ptr;
> + if (tnum_is_const(spill_reg->var_off) && spill_reg->var_off.value == 0) {
> + zero_used = true;
> + continue;
> + }
> + }
> +
> + /* Erase all other spilled pointers. */
> state->stack[spi].spilled_ptr.type = NOT_INIT;
>
> /* Update the slot type. */
[...]
next prev parent reply other threads:[~2024-01-09 18:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 4:05 [PATCH bpf-next v3 1/2] bpf: Track aligned st store as imprecise spilled registers Yonghong Song
2024-01-09 4:05 ` [PATCH bpf-next v3 2/2] selftests/bpf: Add a selftest with not-8-byte aligned BPF_ST Yonghong Song
2024-01-09 22:47 ` Andrii Nakryiko
2024-01-10 4:29 ` Yonghong Song
2024-01-09 5:14 ` [PATCH bpf-next v3 1/2] bpf: Track aligned st store as imprecise spilled registers Kuniyuki Iwashima
2024-01-09 18:02 ` Eduard Zingerman [this message]
2024-01-09 18:45 ` Yonghong Song
2024-01-09 22:38 ` Andrii Nakryiko
2024-01-10 4:19 ` Yonghong Song
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=de8dd3773d84b4c07fbba2776d52bf2114ca5414.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=kernel-team@fb.com \
--cc=kuniyu@amazon.com \
--cc=martin.lau@kernel.org \
--cc=yonghong.song@linux.dev \
/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