mbox series

[bpf-next,0/3] Enable struct_ops programs to be sleepable

Message ID 20230123232228.646563-1-void@manifault.com (mailing list archive)
Headers show
Series Enable struct_ops programs to be sleepable | expand

Message

David Vernet Jan. 23, 2023, 11:22 p.m. UTC
BPF struct_ops programs currently cannot be marked as sleepable. This
need not be the case -- struct_ops programs could be sleepable, and e.g.
invoke kfuncs that export the KF_SLEEPABLE flag.

Enabling this is simple -- we just have to change a couple of lines in
the verifier. This patch set does that, then allows struct_ops backends
to validate the program being loaded to check if it's allowed to be
sleepable, and finally adds a testcase to validate all of this.

David Vernet (3):
  bpf: Allow BPF_PROG_TYPE_STRUCT_OPS programs to be sleepable
  bpf: Pass const struct bpf_prog * to .check_member
  bpf/selftests: Verify struct_ops prog sleepable behavior

 include/linux/bpf.h                           |  4 +-
 kernel/bpf/verifier.c                         |  7 +-
 net/bpf/bpf_dummy_struct_ops.c                | 18 ++++
 net/bpf/test_run.c                            |  6 ++
 net/ipv4/bpf_tcp_ca.c                         |  3 +-
 .../selftests/bpf/prog_tests/dummy_st_ops.c   | 85 +++++++++++++++++--
 .../selftests/bpf/progs/dummy_st_ops.c        | 11 +++
 7 files changed, 121 insertions(+), 13 deletions(-)