diff options
Diffstat (limited to 'include/linux/bpf-cgroup.h')
-rw-r--r-- | include/linux/bpf-cgroup.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index a4c644c1c091..b1c45da20a26 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h | |||
@@ -17,6 +17,8 @@ struct bpf_map; | |||
17 | struct bpf_prog; | 17 | struct bpf_prog; |
18 | struct bpf_sock_ops_kern; | 18 | struct bpf_sock_ops_kern; |
19 | struct bpf_cgroup_storage; | 19 | struct bpf_cgroup_storage; |
20 | struct ctl_table; | ||
21 | struct ctl_table_header; | ||
20 | 22 | ||
21 | #ifdef CONFIG_CGROUP_BPF | 23 | #ifdef CONFIG_CGROUP_BPF |
22 | 24 | ||
@@ -109,6 +111,10 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk, | |||
109 | int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, | 111 | int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, |
110 | short access, enum bpf_attach_type type); | 112 | short access, enum bpf_attach_type type); |
111 | 113 | ||
114 | int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, | ||
115 | struct ctl_table *table, int write, | ||
116 | enum bpf_attach_type type); | ||
117 | |||
112 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( | 118 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( |
113 | struct bpf_map *map) | 119 | struct bpf_map *map) |
114 | { | 120 | { |
@@ -253,6 +259,17 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, | |||
253 | \ | 259 | \ |
254 | __ret; \ | 260 | __ret; \ |
255 | }) | 261 | }) |
262 | |||
263 | |||
264 | #define BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write) \ | ||
265 | ({ \ | ||
266 | int __ret = 0; \ | ||
267 | if (cgroup_bpf_enabled) \ | ||
268 | __ret = __cgroup_bpf_run_filter_sysctl(head, table, write, \ | ||
269 | BPF_CGROUP_SYSCTL); \ | ||
270 | __ret; \ | ||
271 | }) | ||
272 | |||
256 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, | 273 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
257 | enum bpf_prog_type ptype, struct bpf_prog *prog); | 274 | enum bpf_prog_type ptype, struct bpf_prog *prog); |
258 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, | 275 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, |
@@ -321,6 +338,7 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, | |||
321 | #define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; }) | 338 | #define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; }) |
322 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) | 339 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) |
323 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) | 340 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) |
341 | #define BPF_CGROUP_RUN_PROG_SYSCTL(head, table, write) ({ 0; }) | ||
324 | 342 | ||
325 | #define for_each_cgroup_storage_type(stype) for (; false; ) | 343 | #define for_each_cgroup_storage_type(stype) for (; false; ) |
326 | 344 | ||