BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	 Martin KaFai Lau <martin.lau@kernel.org>,
	kkd@meta.com, kernel-team@meta.com
Subject: Re: [PATCH bpf-next v1 1/2] bpf: Summarize sleepable global subprogs
Date: Fri, 28 Feb 2025 15:57:46 -0800	[thread overview]
Message-ID: <69a875c3c8be2851f71d64c062d139d9a2c64b07.camel@gmail.com> (raw)
In-Reply-To: <CAEf4BzZMhVCc0SVjbOLQj736kH-0yRdptqa7rNTftyD5X7ZDvw@mail.gmail.com>

On Fri, 2025-02-28 at 15:34 -0800, Andrii Nakryiko wrote:

[...]

> > There were two alternatives on the table last time:
> > - add support for tags on global functions;
> 
> I was supportive of this, I believe
> 
> > - verify global subprogram call tree in post-order,
> >   in order to have the flags ready when needed.
> 
> Remind me of the details here? we'd start validating the main prog,
> suspend that process when encountering global func, go validate global
> func, once done, come back to main prog, right?

Yes.
The tree can't be built statically if we account for dead code
elimination, as post-order might change.

> Alternatively, we could mark expected properties (restrictions) of
> global subprogs as we encounter them, right? E.g, if we come to global
> func call inside rcu_read_{lock,unlock}() region, we'd mark it
> internally as "needs to be non-sleepable".

For situation like below, suppose verification order is main, foo,
bar, buz:
- main() sleepable
  - foo()
  - bar()
- foo():
  - buz()
- bar():
  - foo() while holding lock
- buz():
  - calls something sleepable

I think, to handle this the call-tree needs to be built on the main
verification pass, and then checked for sleepable.
But that won't work for changes_pkt_data, as verdict has to be known
right-away to decide whether to invalidate packet pointers.

[...]


  reply	other threads:[~2025-02-28 23:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 16:28 [PATCH bpf-next v1 0/2] Global subprogs in RCU/{preempt,irq}-disabled sections Kumar Kartikeya Dwivedi
2025-02-28 16:28 ` [PATCH bpf-next v1 1/2] bpf: Summarize sleepable global subprogs Kumar Kartikeya Dwivedi
2025-02-28 20:42   ` Eduard Zingerman
2025-02-28 20:47     ` Kumar Kartikeya Dwivedi
2025-02-28 23:18   ` Andrii Nakryiko
2025-02-28 23:23     ` Eduard Zingerman
2025-02-28 23:34       ` Andrii Nakryiko
2025-02-28 23:57         ` Eduard Zingerman [this message]
2025-03-01  1:43           ` Kumar Kartikeya Dwivedi
2025-02-28 16:28 ` [PATCH bpf-next v1 2/2] selftests/bpf: Test sleepable global subprogs in atomic contexts Kumar Kartikeya Dwivedi
2025-02-28 21:21   ` 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=69a875c3c8be2851f71d64c062d139d9a2c64b07.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.com \
    /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