Commit f19ceb69 authored by Pu Lehui's avatar Pu Lehui
Browse files

bpf: Fix kabi breakage in struct bpf_map and struct bpf_map_ops

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I932VJ


CVE: CVE-2023-52447

--------------------------------

Fix kabi breakage in struct bpf_map and struct bpf_map_ops.

Signed-off-by: default avatarPu Lehui <pulehui@huawei.com>
parent bdc6d156
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -86,7 +86,8 @@ struct bpf_map_ops {
	 * the to-be-put element is still alive before the bpf program, which
	 * may manipulate it, exists.
	 */
	void (*map_fd_put_ptr)(struct bpf_map *map, void *ptr, bool need_defer);
	KABI_BROKEN_REPLACE(void (*map_fd_put_ptr)(void *ptr),
			    void (*map_fd_put_ptr)(struct bpf_map *map, void *ptr, bool need_defer))
	int (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf);
	u32 (*map_fd_sys_lookup_elem)(void *ptr);
	void (*map_seq_show_elem)(struct bpf_map *map, void *key,
@@ -168,8 +169,8 @@ struct bpf_map {
	u32 btf_vmlinux_value_type_id;
	bool bypass_spec_v1;
	bool frozen; /* write-once; write-protected by freeze_mutex */
	bool free_after_mult_rcu_gp;
	/* 22 bytes hole */
	KABI_EXTEND(bool free_after_mult_rcu_gp)
	/* 17 bytes hole */

	/* The 3rd and 4th cacheline with misc members to avoid false sharing
	 * particularly with refcounting.
@@ -177,10 +178,12 @@ struct bpf_map {
	atomic64_t refcnt ____cacheline_aligned;
	atomic64_t usercnt;
	/* rcu is used before freeing and work is only used during freeing */
	KABI_BROKEN_REPLACE(
	struct work_struct work,
	union {
		struct work_struct work;
		struct rcu_head rcu;
	};
	})
	struct mutex freeze_mutex;
	atomic64_t writecnt;
};