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(a)linux.ibm.com>
---
memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/memory.c b/memory.c
index ccc2944..c2433eb 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