mirror of https://github.com/OpenIPC/firmware.git
84 lines
2.8 KiB
Diff
84 lines
2.8 KiB
Diff
diff -drupN a/include/linux/bpf.h b/include/linux/bpf.h
|
|
--- a/include/linux/bpf.h 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/include/linux/bpf.h 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -56,6 +56,9 @@ struct bpf_map {
|
|
atomic_t refcnt;
|
|
atomic_t usercnt;
|
|
struct work_struct work;
|
|
+#ifdef CONFIG_SECURITY
|
|
+ void *security;
|
|
+#endif
|
|
};
|
|
|
|
struct bpf_map_type_list {
|
|
@@ -189,6 +192,9 @@ struct bpf_prog_aux {
|
|
struct bpf_map **used_maps;
|
|
struct bpf_prog *prog;
|
|
struct user_struct *user;
|
|
+#ifdef CONFIG_SECURITY
|
|
+ void *security;
|
|
+#endif
|
|
union {
|
|
struct work_struct work;
|
|
struct rcu_head rcu;
|
|
@@ -241,6 +247,9 @@ DECLARE_PER_CPU(int, bpf_prog_active);
|
|
void bpf_register_prog_type(struct bpf_prog_type_list *tl);
|
|
void bpf_register_map_type(struct bpf_map_type_list *tl);
|
|
|
|
+extern const struct file_operations bpf_map_fops;
|
|
+extern const struct file_operations bpf_prog_fops;
|
|
+
|
|
struct bpf_prog *bpf_prog_get(u32 ufd);
|
|
struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type);
|
|
struct bpf_prog *bpf_prog_add(struct bpf_prog *prog, int i);
|
|
@@ -258,11 +267,11 @@ void bpf_map_area_free(void *base);
|
|
|
|
extern int sysctl_unprivileged_bpf_disabled;
|
|
|
|
-int bpf_map_new_fd(struct bpf_map *map);
|
|
+int bpf_map_new_fd(struct bpf_map *map, int flags);
|
|
int bpf_prog_new_fd(struct bpf_prog *prog);
|
|
|
|
int bpf_obj_pin_user(u32 ufd, const char __user *pathname);
|
|
-int bpf_obj_get_user(const char __user *pathname);
|
|
+int bpf_obj_get_user(const char __user *pathname, int flags);
|
|
|
|
int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value);
|
|
int bpf_percpu_array_copy(struct bpf_map *map, void *key, void *value);
|
|
@@ -277,6 +286,8 @@ int bpf_fd_array_map_update_elem(struct
|
|
void *key, void *value, u64 map_flags);
|
|
void bpf_fd_array_map_clear(struct bpf_map *map);
|
|
|
|
+int bpf_get_file_flag(int flags);
|
|
+
|
|
/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and
|
|
* forced to use 'long' read/writes to try to atomically copy long counters.
|
|
* Best-effort only. No barriers here, since it _will_ race with concurrent
|
|
@@ -295,6 +306,9 @@ static inline void bpf_long_memcpy(void
|
|
|
|
/* verify correctness of eBPF program */
|
|
int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
|
|
+
|
|
+struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type);
|
|
+
|
|
#else
|
|
static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl)
|
|
{
|
|
@@ -322,6 +336,16 @@ static inline struct bpf_prog *bpf_prog_
|
|
{
|
|
return ERR_PTR(-EOPNOTSUPP);
|
|
}
|
|
+static inline int bpf_obj_get_user(const char __user *pathname)
|
|
+{
|
|
+ return -EOPNOTSUPP;
|
|
+}
|
|
+
|
|
+static inline struct bpf_prog *bpf_prog_get_type_path(const char *name,
|
|
+ enum bpf_prog_type type)
|
|
+{
|
|
+ return ERR_PTR(-EOPNOTSUPP);
|
|
+}
|
|
#endif /* CONFIG_BPF_SYSCALL */
|
|
|
|
/* verifier prototypes for helper functions called from eBPF programs */
|