File crash-fix-kmem-sS-for-caches-created-during-SLUB-bootstrap.patch of Package crash.24892

From 50f39247d80519c71d1f03984bc34aa476a9c2bd Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@in.ibm.com>
Date: Wed, 8 Apr 2020 11:38:23 +0200
Subject: [PATCH] fix "kmem -[sS]" for caches created during SLUB bootstrap

References: bsc#1164815 ltc#182973 https://www.redhat.com/archives/crash-utility/2020-April/msg00029.html
Upstream: submitted

Fix for "kmem -[sS]" options on Linux 4.14 and later kernels built
with CONFIG_SLAB_FREELIST_HARDENED enabled. Without the patch, there
will error messages of the type "kmem: <cache name> slab: <address>
invalid freepointer: <obfuscated address>" for caches created during
SLUB bootstrap, as they are likely to have s->random == 0.

Signed-off-by: Hari Bathini <hbathini linux ibm com>
---
 memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/memory.c b/memory.c
index ccc29442c3f6..c2433ebe5e75 100644
--- a/memory.c
+++ b/memory.c
@@ -19244,7 +19244,7 @@ count_free_objects(struct meminfo *si, ulong freelist)
 static ulong
 freelist_ptr(struct meminfo *si, ulong ptr, ulong ptr_addr)
 {
-	if (si->random)
+	if (VALID_MEMBER(kmem_cache_random))
 		/* CONFIG_SLAB_FREELIST_HARDENED */
 		return (ptr ^ si->random ^ ptr_addr);
 	else
-- 
2.23.0

openSUSE Build Service is sponsored by