On 2/11/22 1:43 PM, Daniel Borkmann wrote:
On 2/11/22 1:11 PM, Yafang Shao wrote:
A new member pin_name is added into struct bpf_prog_aux, which will be
set when the prog is set and cleared when the pinned file is removed.
Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
---
include/linux/bpf.h | 2 ++
include/uapi/linux/bpf.h | 1 +
kernel/bpf/inode.c | 20 +++++++++++++++++++-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 0ceb25b..9cf8055 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -933,6 +933,8 @@ struct bpf_prog_aux {
struct work_struct work;
struct rcu_head rcu;
};
+
+ char pin_name[BPF_PIN_NAME_LEN];
};
I'm afraid this is not possible. You are assuming a 1:1 relationship between prog
and pin location, but it's really a 1:n (prog can be pinned in multiple locations
and also across multiple mount instances). Also, you can create hard links of pins
which are not handled via bpf_obj_do_pin().
(Same is also true for BPF maps wrt patch 2.)