Blob Blame History Raw
From aba7bc914ab6839a4368119d640d5f5cd5e54c85 Mon Sep 17 00:00:00 2001
From: Vlastimil Babka <vbabka@suse.cz>
Date: Fri, 2 Sep 2022 13:18:12 +0200
Subject: [PATCH] kABI: Fix kABI after "mm/rmap: Fix anon_vma->degree ambiguity
 leading to double-reuse"
Patch-mainline; Never, SUSE kABI
References: git-fixes, bsc#1203098

The patch changes struct anon_vma which is exposed, although should not be used
by any non-core code. Move the new fields to the end (hidden from KABI checker)
and restore the removed degree field so the layout doesn't change within the old
size.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 include/linux/rmap.h |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -37,16 +37,12 @@ struct anon_vma {
 	 */
 	atomic_t refcount;
 
-	/*
-	 * Count of child anon_vmas. Equals to the count of all anon_vmas that
-	 * have ->parent pointing to this one, including itself.
-	 *
-	 * This counter is used for making decision about reusing anon_vma
-	 * instead of forking new one. See comments in function anon_vma_clone.
-	 */
-	unsigned long num_children;
-	/* Count of VMAs whose ->anon_vma pointer points to this object. */
-	unsigned long num_active_vmas;
+	/* SUSE KABI compatibility placeholder */
+#ifndef __GENKSYMS__
+	unsigned __unused_degree;
+#else
+	unsigned degree;
+#endif
 
 	struct anon_vma *parent;	/* Parent of this anon_vma */
 
@@ -59,6 +55,19 @@ struct anon_vma {
 	 * mm_take_all_locks() (mm_all_locks_mutex).
 	 */
 	struct rb_root rb_root;	/* Interval tree of private "related" vmas */
+
+#ifndef __GENKSYMS__
+	/*
+	 * Count of child anon_vmas. Equals to the count of all anon_vmas that
+	 * have ->parent pointing to this one, including itself.
+	 *
+	 * This counter is used for making decision about reusing anon_vma
+	 * instead of forking new one. See comments in function anon_vma_clone.
+	 */
+	unsigned long num_children;
+	/* Count of VMAs whose ->anon_vma pointer points to this object. */
+	unsigned long num_active_vmas;
+#endif
 };
 
 /*