Blame SOURCES/0004-memory-Handle-struct-slab-changes-on-Linux-5.17-rc1-.patch

e64a0b
From 14f8c460473c8613553b5defd174ca2af812ddcb Mon Sep 17 00:00:00 2001
e64a0b
From: Alexander Egorenkov <egorenar@linux.ibm.com>
e64a0b
Date: Mon, 6 Dec 2021 16:04:19 +0100
e64a0b
Subject: [PATCH 04/10] memory: Handle struct slab changes on Linux 5.17-rc1
e64a0b
 and later
e64a0b
e64a0b
Since kernel commit d122019bf061 ("mm: Split slab into its own type"),
e64a0b
the struct slab is used for both SLAB and SLUB. Therefore, don't depend
e64a0b
on the non-presence of the struct slab to decide whether SLAB implementation
e64a0b
should be chosen and use the member variable "cpu_slab" of the struct
e64a0b
kmem_cache instead, it should be present only in SLUB.
e64a0b
e64a0b
Without the patch, crash fails to start with the error message:
e64a0b
e64a0b
  crash: invalid structure member offset: kmem_cache_s_num
e64a0b
             FILE: memory.c  LINE: 9619  FUNCTION: kmem_cache_init()
e64a0b
e64a0b
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
e64a0b
---
e64a0b
 memory.c | 3 ++-
e64a0b
 1 file changed, 2 insertions(+), 1 deletion(-)
e64a0b
e64a0b
diff --git a/memory.c b/memory.c
e64a0b
index 86c02c132890..5af45fd7d834 100644
e64a0b
--- a/memory.c
e64a0b
+++ b/memory.c
e64a0b
@@ -576,7 +576,8 @@ vm_init(void)
e64a0b
 		STRUCT_SIZE_INIT(cpucache_s, "cpucache_s");
e64a0b
 
e64a0b
         } else if (!VALID_STRUCT(kmem_slab_s) && 
e64a0b
-		   !VALID_STRUCT(slab_s) && 
e64a0b
+		   !VALID_STRUCT(slab_s) &&
e64a0b
+		   !MEMBER_EXISTS("kmem_cache", "cpu_slab") &&
e64a0b
 		   (VALID_STRUCT(slab) || (vt->flags & SLAB_OVERLOAD_PAGE))) {
e64a0b
                 vt->flags |= PERCPU_KMALLOC_V2;
e64a0b
 
e64a0b
-- 
e64a0b
2.20.1
e64a0b