@@ -1729,19 +1729,22 @@ struct bpf_link {
17291729 enum bpf_link_type type ;
17301730 const struct bpf_link_ops * ops ;
17311731 struct bpf_prog * prog ;
1732- /* whether BPF link itself has "sleepable" semantics, which can differ
1733- * from underlying BPF program having a "sleepable" semantics, as BPF
1734- * link's semantics is determined by target attach hook
1735- */
1736- bool sleepable ;
1732+
17371733 u32 flags ;
1734+ enum bpf_attach_type attach_type ;
1735+
17381736 /* rcu is used before freeing, work can be used to schedule that
17391737 * RCU-based freeing before that, so they never overlap
17401738 */
17411739 union {
17421740 struct rcu_head rcu ;
17431741 struct work_struct work ;
17441742 };
1743+ /* whether BPF link itself has "sleepable" semantics, which can differ
1744+ * from underlying BPF program having a "sleepable" semantics, as BPF
1745+ * link's semantics is determined by target attach hook
1746+ */
1747+ bool sleepable ;
17451748};
17461749
17471750struct bpf_link_ops {
@@ -1781,7 +1784,6 @@ struct bpf_shim_tramp_link {
17811784
17821785struct bpf_tracing_link {
17831786 struct bpf_tramp_link link ;
1784- enum bpf_attach_type attach_type ;
17851787 struct bpf_trampoline * trampoline ;
17861788 struct bpf_prog * tgt_prog ;
17871789};
@@ -2034,11 +2036,13 @@ int bpf_prog_ctx_arg_info_init(struct bpf_prog *prog,
20342036
20352037#if defined(CONFIG_CGROUP_BPF ) && defined(CONFIG_BPF_LSM )
20362038int bpf_trampoline_link_cgroup_shim (struct bpf_prog * prog ,
2037- int cgroup_atype );
2039+ int cgroup_atype ,
2040+ enum bpf_attach_type attach_type );
20382041void bpf_trampoline_unlink_cgroup_shim (struct bpf_prog * prog );
20392042#else
20402043static inline int bpf_trampoline_link_cgroup_shim (struct bpf_prog * prog ,
2041- int cgroup_atype )
2044+ int cgroup_atype ,
2045+ enum bpf_attach_type attach_type )
20422046{
20432047 return - EOPNOTSUPP ;
20442048}
@@ -2350,6 +2354,7 @@ extern const struct super_operations bpf_super_ops;
23502354extern const struct file_operations bpf_map_fops ;
23512355extern const struct file_operations bpf_prog_fops ;
23522356extern const struct file_operations bpf_iter_fops ;
2357+ extern const struct file_operations bpf_token_fops ;
23532358
23542359#define BPF_PROG_TYPE (_id , _name , prog_ctx_type , kern_ctx_type ) \
23552360 extern const struct bpf_prog_ops _name ## _prog_ops; \
@@ -2528,10 +2533,11 @@ int bpf_map_new_fd(struct bpf_map *map, int flags);
25282533int bpf_prog_new_fd (struct bpf_prog * prog );
25292534
25302535void bpf_link_init (struct bpf_link * link , enum bpf_link_type type ,
2531- const struct bpf_link_ops * ops , struct bpf_prog * prog );
2536+ const struct bpf_link_ops * ops , struct bpf_prog * prog ,
2537+ enum bpf_attach_type attach_type );
25322538void bpf_link_init_sleepable (struct bpf_link * link , enum bpf_link_type type ,
25332539 const struct bpf_link_ops * ops , struct bpf_prog * prog ,
2534- bool sleepable );
2540+ enum bpf_attach_type attach_type , bool sleepable );
25352541int bpf_link_prime (struct bpf_link * link , struct bpf_link_primer * primer );
25362542int bpf_link_settle (struct bpf_link_primer * primer );
25372543void bpf_link_cleanup (struct bpf_link_primer * primer );
@@ -2546,6 +2552,9 @@ void bpf_token_inc(struct bpf_token *token);
25462552void bpf_token_put (struct bpf_token * token );
25472553int bpf_token_create (union bpf_attr * attr );
25482554struct bpf_token * bpf_token_get_from_fd (u32 ufd );
2555+ int bpf_token_get_info_by_fd (struct bpf_token * token ,
2556+ const union bpf_attr * attr ,
2557+ union bpf_attr __user * uattr );
25492558
25502559bool bpf_token_allow_cmd (const struct bpf_token * token , enum bpf_cmd cmd );
25512560bool bpf_token_allow_map_type (const struct bpf_token * token , enum bpf_map_type type );
@@ -2883,13 +2892,13 @@ bpf_prog_inc_not_zero(struct bpf_prog *prog)
28832892
28842893static inline void bpf_link_init (struct bpf_link * link , enum bpf_link_type type ,
28852894 const struct bpf_link_ops * ops ,
2886- struct bpf_prog * prog )
2895+ struct bpf_prog * prog , enum bpf_attach_type attach_type )
28872896{
28882897}
28892898
28902899static inline void bpf_link_init_sleepable (struct bpf_link * link , enum bpf_link_type type ,
28912900 const struct bpf_link_ops * ops , struct bpf_prog * prog ,
2892- bool sleepable )
2901+ enum bpf_attach_type attach_type , bool sleepable )
28932902{
28942903}
28952904
@@ -2944,6 +2953,13 @@ static inline struct bpf_token *bpf_token_get_from_fd(u32 ufd)
29442953 return ERR_PTR (- EOPNOTSUPP );
29452954}
29462955
2956+ static inline int bpf_token_get_info_by_fd (struct bpf_token * token ,
2957+ const union bpf_attr * attr ,
2958+ union bpf_attr __user * uattr )
2959+ {
2960+ return - EOPNOTSUPP ;
2961+ }
2962+
29472963static inline void __dev_flush (struct list_head * flush_list )
29482964{
29492965}
0 commit comments