@@ -52,10 +52,6 @@ struct module;
5252struct bpf_func_state ;
5353struct ftrace_ops ;
5454struct cgroup ;
55- struct bpf_token ;
56- struct user_namespace ;
57- struct super_block ;
58- struct inode ;
5955
6056extern struct idr btf_idr ;
6157extern spinlock_t btf_idr_lock ;
@@ -1488,7 +1484,6 @@ struct bpf_prog_aux {
14881484#ifdef CONFIG_SECURITY
14891485 void * security ;
14901486#endif
1491- struct bpf_token * token ;
14921487 struct bpf_prog_offload * offload ;
14931488 struct btf * btf ;
14941489 struct bpf_func_info * func_info ;
@@ -1613,31 +1608,6 @@ struct bpf_link_primer {
16131608 u32 id ;
16141609};
16151610
1616- struct bpf_mount_opts {
1617- kuid_t uid ;
1618- kgid_t gid ;
1619- umode_t mode ;
1620-
1621- /* BPF token-related delegation options */
1622- u64 delegate_cmds ;
1623- u64 delegate_maps ;
1624- u64 delegate_progs ;
1625- u64 delegate_attachs ;
1626- };
1627-
1628- struct bpf_token {
1629- struct work_struct work ;
1630- atomic64_t refcnt ;
1631- struct user_namespace * userns ;
1632- u64 allowed_cmds ;
1633- u64 allowed_maps ;
1634- u64 allowed_progs ;
1635- u64 allowed_attachs ;
1636- #ifdef CONFIG_SECURITY
1637- void * security ;
1638- #endif
1639- };
1640-
16411611struct bpf_struct_ops_value ;
16421612struct btf_member ;
16431613
@@ -2097,7 +2067,6 @@ static inline void bpf_enable_instrumentation(void)
20972067 migrate_enable ();
20982068}
20992069
2100- extern const struct super_operations bpf_super_ops ;
21012070extern const struct file_operations bpf_map_fops ;
21022071extern const struct file_operations bpf_prog_fops ;
21032072extern const struct file_operations bpf_iter_fops ;
@@ -2232,26 +2201,24 @@ static inline void bpf_map_dec_elem_count(struct bpf_map *map)
22322201
22332202extern int sysctl_unprivileged_bpf_disabled ;
22342203
2235- bool bpf_token_capable (const struct bpf_token * token , int cap );
2236-
2237- static inline bool bpf_allow_ptr_leaks (const struct bpf_token * token )
2204+ static inline bool bpf_allow_ptr_leaks (void )
22382205{
2239- return bpf_token_capable ( token , CAP_PERFMON );
2206+ return perfmon_capable ( );
22402207}
22412208
2242- static inline bool bpf_allow_uninit_stack (const struct bpf_token * token )
2209+ static inline bool bpf_allow_uninit_stack (void )
22432210{
2244- return bpf_token_capable ( token , CAP_PERFMON );
2211+ return perfmon_capable ( );
22452212}
22462213
2247- static inline bool bpf_bypass_spec_v1 (const struct bpf_token * token )
2214+ static inline bool bpf_bypass_spec_v1 (void )
22482215{
2249- return cpu_mitigations_off () || bpf_token_capable ( token , CAP_PERFMON );
2216+ return cpu_mitigations_off () || perfmon_capable ( );
22502217}
22512218
2252- static inline bool bpf_bypass_spec_v4 (const struct bpf_token * token )
2219+ static inline bool bpf_bypass_spec_v4 (void )
22532220{
2254- return cpu_mitigations_off () || bpf_token_capable ( token , CAP_PERFMON );
2221+ return cpu_mitigations_off () || perfmon_capable ( );
22552222}
22562223
22572224int bpf_map_new_fd (struct bpf_map * map , int flags );
@@ -2268,21 +2235,8 @@ int bpf_link_new_fd(struct bpf_link *link);
22682235struct bpf_link * bpf_link_get_from_fd (u32 ufd );
22692236struct bpf_link * bpf_link_get_curr_or_next (u32 * id );
22702237
2271- void bpf_token_inc (struct bpf_token * token );
2272- void bpf_token_put (struct bpf_token * token );
2273- int bpf_token_create (union bpf_attr * attr );
2274- struct bpf_token * bpf_token_get_from_fd (u32 ufd );
2275-
2276- bool bpf_token_allow_cmd (const struct bpf_token * token , enum bpf_cmd cmd );
2277- bool bpf_token_allow_map_type (const struct bpf_token * token , enum bpf_map_type type );
2278- bool bpf_token_allow_prog_type (const struct bpf_token * token ,
2279- enum bpf_prog_type prog_type ,
2280- enum bpf_attach_type attach_type );
2281-
22822238int bpf_obj_pin_user (u32 ufd , int path_fd , const char __user * pathname );
22832239int bpf_obj_get_user (int path_fd , const char __user * pathname , int flags );
2284- struct inode * bpf_get_inode (struct super_block * sb , const struct inode * dir ,
2285- umode_t mode );
22862240
22872241#define BPF_ITER_FUNC_PREFIX "bpf_iter_"
22882242#define DEFINE_BPF_ITER_FUNC (target , args ...) \
@@ -2526,8 +2480,7 @@ const char *btf_find_decl_tag_value(const struct btf *btf, const struct btf_type
25262480struct bpf_prog * bpf_prog_by_id (u32 id );
25272481struct bpf_link * bpf_link_by_id (u32 id );
25282482
2529- const struct bpf_func_proto * bpf_base_func_proto (enum bpf_func_id func_id ,
2530- const struct bpf_prog * prog );
2483+ const struct bpf_func_proto * bpf_base_func_proto (enum bpf_func_id func_id );
25312484void bpf_task_storage_free (struct task_struct * task );
25322485void bpf_cgrp_storage_free (struct cgroup * cgroup );
25332486bool bpf_prog_has_kfunc_call (const struct bpf_prog * prog );
@@ -2646,24 +2599,6 @@ static inline int bpf_obj_get_user(const char __user *pathname, int flags)
26462599 return - EOPNOTSUPP ;
26472600}
26482601
2649- static inline bool bpf_token_capable (const struct bpf_token * token , int cap )
2650- {
2651- return capable (cap ) || (cap != CAP_SYS_ADMIN && capable (CAP_SYS_ADMIN ));
2652- }
2653-
2654- static inline void bpf_token_inc (struct bpf_token * token )
2655- {
2656- }
2657-
2658- static inline void bpf_token_put (struct bpf_token * token )
2659- {
2660- }
2661-
2662- static inline struct bpf_token * bpf_token_get_from_fd (u32 ufd )
2663- {
2664- return ERR_PTR (- EOPNOTSUPP );
2665- }
2666-
26672602static inline void __dev_flush (void )
26682603{
26692604}
@@ -2787,7 +2722,7 @@ static inline int btf_struct_access(struct bpf_verifier_log *log,
27872722}
27882723
27892724static inline const struct bpf_func_proto *
2790- bpf_base_func_proto (enum bpf_func_id func_id , const struct bpf_prog * prog )
2725+ bpf_base_func_proto (enum bpf_func_id func_id )
27912726{
27922727 return NULL ;
27932728}
0 commit comments