mbox series

[bpf-next,v2,0/2] Update a struct_ops link through a pinned path

Message ID 20240418163509.719335-1-thinker.li@gmail.com (mailing list archive)
Headers show
Series Update a struct_ops link through a pinned path | expand

Message

Kui-Feng Lee April 18, 2024, 4:35 p.m. UTC
Applications already have the ability to update a struct_ops link with
another struct_ops map. However, they were unable to open pinned paths
of the links. This implies that updating a link through its pinned
paths was not feasible. By allowing the "open" operator on pinned
paths, applications can pin a struct_ops link and update the link
through the pinned path later.

---
Changes from v1:

 - Fix a link time error for the case that CONFIG_BPF_JIT is not
   enabled. (Reported by kernel test robot)

v1: https://lore.kernel.org/all/20240417002513.1534535-1-thinker.li@gmail.com/

Kui-Feng Lee (2):
  bpf: enable the "open" operator on a pinned path of a struct_osp link.
  selftests/bpf: open a pinned path of a struct_ops link.

 include/linux/bpf.h                           |  6 ++
 kernel/bpf/bpf_struct_ops.c                   | 10 ++++
 kernel/bpf/inode.c                            | 11 +++-
 kernel/bpf/syscall.c                          | 16 +++++-
 .../selftests/bpf/bpf_testmod/bpf_testmod.c   |  6 ++
 .../bpf/prog_tests/test_struct_ops_module.c   | 56 +++++++++++++++++++
 6 files changed, 101 insertions(+), 4 deletions(-)

Comments

Eduard Zingerman April 18, 2024, 9:37 p.m. UTC | #1
On Thu, 2024-04-18 at 09:35 -0700, Kui-Feng Lee wrote:
> Applications already have the ability to update a struct_ops link with
> another struct_ops map. However, they were unable to open pinned paths
> of the links. This implies that updating a link through its pinned
> paths was not feasible. By allowing the "open" operator on pinned
> paths, applications can pin a struct_ops link and update the link
> through the pinned path later.
> 
> ---

Not an expert in how bpffs is tied together, but this patch-set seems to be fine.

Reviewed-by: Eduard Zingerman <eddyz87@gmail.com>