Fix for "kmem -s|-S" option on Linux 5.7 and later kernels
Release crash-7.3.0-2 Resolves: rhbz#1954913 Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
parent
a3933d5c86
commit
a3ae8fcfd1
@ -0,0 +1,58 @@
|
|||||||
|
From 647a5c33e1c94054d7b63168cd6c12901591cb77 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
Date: Thu, 27 May 2021 18:02:11 +0800
|
||||||
|
Subject: [PATCH] Fix for "kmem -s|-S" option on Linux 5.7 and later kernels
|
||||||
|
|
||||||
|
Linux 5.7 and later kernels that contain kernel commit 1ad53d9fa3f6
|
||||||
|
("slub: improve bit diffusion for freelist ptr obfuscation") changed
|
||||||
|
the calculation formula in the freelist_ptr(), which added a swab()
|
||||||
|
call to mix bits a little more. When kernel is configured with the
|
||||||
|
"CONFIG_SLAB_FREELIST_HARDENED=y", without the patch, the "kmem -s|-S"
|
||||||
|
options display wrong statistics and state whether slab objects are
|
||||||
|
in use or free and can print the following errors:
|
||||||
|
|
||||||
|
crash> kmem -s
|
||||||
|
CACHE OBJSIZE ALLOCATED TOTAL SLABS SSIZE NAME
|
||||||
|
87201e00 528 0 0 0 8k xfs_dqtrx
|
||||||
|
87201f00 496 0 0 0 8k xfs_dquot
|
||||||
|
kmem: xfs_buf: slab: 37202e6e900 invalid freepointer: b844bab900001d70
|
||||||
|
kmem: xfs_buf: slab: 3720250fd80 invalid freepointer: b8603f9400001370
|
||||||
|
...
|
||||||
|
|
||||||
|
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||||
|
---
|
||||||
|
memory.c | 9 +++++++--
|
||||||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/memory.c b/memory.c
|
||||||
|
index 8c6bbe409922..a3cf8a86728d 100644
|
||||||
|
--- a/memory.c
|
||||||
|
+++ b/memory.c
|
||||||
|
@@ -20,6 +20,7 @@
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
+#include <byteswap.h>
|
||||||
|
|
||||||
|
struct meminfo { /* general purpose memory information structure */
|
||||||
|
ulong cache; /* used by the various memory searching/dumping */
|
||||||
|
@@ -19336,10 +19337,14 @@ count_free_objects(struct meminfo *si, ulong freelist)
|
||||||
|
static ulong
|
||||||
|
freelist_ptr(struct meminfo *si, ulong ptr, ulong ptr_addr)
|
||||||
|
{
|
||||||
|
- if (VALID_MEMBER(kmem_cache_random))
|
||||||
|
+ if (VALID_MEMBER(kmem_cache_random)) {
|
||||||
|
/* CONFIG_SLAB_FREELIST_HARDENED */
|
||||||
|
+
|
||||||
|
+ if (THIS_KERNEL_VERSION >= LINUX(5,7,0))
|
||||||
|
+ ptr_addr = (sizeof(long) == 8) ? bswap_64(ptr_addr)
|
||||||
|
+ : bswap_32(ptr_addr);
|
||||||
|
return (ptr ^ si->random ^ ptr_addr);
|
||||||
|
- else
|
||||||
|
+ } else
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.30.2
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
|
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
|
||||||
Name: crash
|
Name: crash
|
||||||
Version: 7.3.0
|
Version: 7.3.0
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
|
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
|
||||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz
|
Source1: http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz
|
||||||
@ -18,6 +18,7 @@ Requires: binutils
|
|||||||
Provides: bundled(libiberty)
|
Provides: bundled(libiberty)
|
||||||
Provides: bundled(gdb) = 7.6
|
Provides: bundled(gdb) = 7.6
|
||||||
Patch0: lzo_snappy.patch
|
Patch0: lzo_snappy.patch
|
||||||
|
Patch1: 0001-Fix-for-kmem-s-S-option-on-Linux-5.7-and-later-kerne.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The core analysis suite is a self-contained tool that can be used to
|
The core analysis suite is a self-contained tool that can be used to
|
||||||
@ -38,6 +39,7 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
|
|||||||
%prep
|
%prep
|
||||||
%setup -n %{name}-%{version} -q
|
%setup -n %{name}-%{version} -q
|
||||||
%patch0 -p1 -b lzo_snappy.patch
|
%patch0 -p1 -b lzo_snappy.patch
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# This package has an internal copy of GDB which has broken configure code for
|
# This package has an internal copy of GDB which has broken configure code for
|
||||||
@ -69,6 +71,9 @@ cp -p defs.h %{buildroot}%{_includedir}/crash
|
|||||||
%{_includedir}/*
|
%{_includedir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jun 11 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-2
|
||||||
|
- Fix for "kmem -s|-S" option on Linux 5.7 and later kernels
|
||||||
|
|
||||||
* Mon May 10 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-1
|
* Mon May 10 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-1
|
||||||
- Rebase to upstream 7.3.0
|
- Rebase to upstream 7.3.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user