From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Hou Tao <houtao@huaweicloud.com>
Cc: bpf@vger.kernel.org, Martin KaFai Lau <martin.lau@linux.dev>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>, Song Liu <song@kernel.org>,
Hao Luo <haoluo@google.com>,
Yonghong Song <yonghong.song@linux.dev>,
Daniel Borkmann <daniel@iogearbox.net>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
Jiri Olsa <jolsa@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
houtao1@huawei.com, xukuohai@huawei.com
Subject: Re: [PATCH bpf] bpf: Extend the size of scratched_stack_slots to 128 bits
Date: Wed, 23 Oct 2024 09:17:36 -0700 [thread overview]
Message-ID: <42a4ec6bccc867d18033583b1dfea0736ac1afb0.camel@gmail.com> (raw)
In-Reply-To: <CAEf4BzZpL7faQh61X_pqr+57qxzDD1LcxWgUqNZCCKh1z5hV9w@mail.gmail.com>
On Wed, 2024-10-23 at 09:15 -0700, Andrii Nakryiko wrote:
[...]
> > diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
> > index 4513372c5bc8..1bb6c6def04d 100644
> > --- a/include/linux/bpf_verifier.h
> > +++ b/include/linux/bpf_verifier.h
> > @@ -773,8 +773,11 @@ struct bpf_verifier_env {
> > * since the last time the function state was printed
> > */
> > u32 scratched_regs;
> > - /* Same as scratched_regs but for stack slots */
> > - u64 scratched_stack_slots;
> > + /* Same as scratched_regs but for stack slots. The stack size may
> > + * temporarily exceed MAX_BPF_STACK (e.g., due to fastcall pattern
> > + * in check_stack_slot_within_bounds()), so two u64 values are used.
> > + */
> > + u64 scratched_stack_slots[2];
>
> We have other places where we assume that 64 bits is enough to specify
> stack slot index (linked regs, for instance). Do we need to update all
> of those now as well? If yes, maybe then it's better to make sure
> valid programs can never go beyond 512 bytes of stack even for
> bpf_fastcall?..
Specifically function frames.
This is a huge blunder from my side.
next prev parent reply other threads:[~2024-10-23 16:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 2:27 [PATCH bpf] bpf: Extend the size of scratched_stack_slots to 128 bits Hou Tao
2024-10-23 16:15 ` Andrii Nakryiko
2024-10-23 16:17 ` Eduard Zingerman [this message]
2024-10-23 17:13 ` Eduard Zingerman
2024-10-23 17:33 ` Andrii Nakryiko
2024-10-23 17:37 ` Eduard Zingerman
2024-10-23 17:44 ` Andrii Nakryiko
2024-10-23 18:02 ` Eduard Zingerman
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=42a4ec6bccc867d18033583b1dfea0736ac1afb0.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=houtao1@huawei.com \
--cc=houtao@huaweicloud.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=xukuohai@huawei.com \
--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