Blob Blame History Raw
From: Tony Jones <tonyj@suse.de>
Subject: handle KABI change in struct bpf_map
Patch-mainline: Never, kABI fix only
References: bsc#1192990 CVE-2021-4001
Signed-off-by: Tony Jones <tonyj@suse.de>

Usage of struct bpf_map->writecnt limited to ./kernel/bpf/syscall.c [defn in tools subtree is a different type]

pahole info for "struct bpf_map"

Total sizing is unchanged:
        /* size: 256, cachelines: 4, members: 23 */
        /* sum members: 194, holes: 1, sum holes: 22 */
        /* padding: 40 */
        /* forced alignments: 2, forced holes: 1, sum forced holes: 22 */

Element difference:
30c30
<       atomic64_t                 writecnt;             /*   208     8 */
---
>       u64                        writecnt;             /*   208     8 */

---
 include/linux/bpf.h |    4 ++++
 1 file changed, 4 insertions(+)

--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -117,7 +117,11 @@ struct bpf_map {
 	atomic64_t usercnt;
 	struct work_struct work;
 	struct mutex freeze_mutex;
+#ifdef __GENKSYMS__
+	u64 writecnt;
+#else
 	atomic64_t writecnt;
+#endif
 };
 
 static inline bool map_value_has_spin_lock(const struct bpf_map *map)