public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vernet <void@manifault.com>
To: lsf-pc@lists.linux-foundation.org
Cc: bpf@vger.kernel.org
Subject: [LSF/MM/BPF TOPIC] Multi-kfunc sets / restricted scoping
Date: Thu, 26 Jan 2023 08:15:57 -0600	[thread overview]
Message-ID: <Y9KLHZ1TNXVHdVKm@maniforge> (raw)

Hi all,

I would like to propose discussing a potential new kfunc-related feature
at LSF/MM/BPF: Enabling kfuncs to be restricted to only being callable
from a subset of specific BPF programs, e.g. from only a subset of
callbacks defined in a struct_ops struct, rather than from any
struct_ops program.

Some kfuncs may not be safe or logical to call from all contexts. For
example, the backend kernel implementation which is invoking a
struct_ops callback may set some global state before calling into BPF,
and may thus expect that the state is set when the program calls back
into the kernel from that struct_ops callback, via a kfunc. If the kfunc
can't actually rely on that expectation, whether for safety reasons or
correctness reasons, it has to implement its own methodology for
ensuring it was called from the right context.

Providing developers with an ability to specify the specific programs
that a kfunc should be invokable from would address this problem, and
would avoid every kfunc implementation from having to implement its own
scope checking / validation where required.

I would like to discuss possible design approaches, UX approaches, etc.

Thoughts?

Thanks,
David

             reply	other threads:[~2023-01-26 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 14:15 David Vernet [this message]
2023-02-01  6:25 ` [LSF/MM/BPF TOPIC] Multi-kfunc sets / restricted scoping Martin KaFai Lau

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=Y9KLHZ1TNXVHdVKm@maniforge \
    --to=void@manifault.com \
    --cc=bpf@vger.kernel.org \
    --cc=lsf-pc@lists.linux-foundation.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