|
|
2ba6f6 |
From 5f17bdd2128998a3eeeb4521d136a192222fadb6 Mon Sep 17 00:00:00 2001
|
|
|
2ba6f6 |
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
2ba6f6 |
Date: Wed, 21 Dec 2022 11:06:39 +0900
|
|
|
2ba6f6 |
Subject: [PATCH 4/7] [PATCH] Fix wrong exclusion of slab pages on Linux
|
|
|
2ba6f6 |
6.2-rc1
|
|
|
2ba6f6 |
|
|
|
2ba6f6 |
* Required for kernel 6.2
|
|
|
2ba6f6 |
|
|
|
2ba6f6 |
Kernel commit 130d4df57390 ("mm/sl[au]b: rearrange struct slab fields to
|
|
|
2ba6f6 |
allow larger rcu_head"), which is contained in Linux 6.2-rc1 and later,
|
|
|
2ba6f6 |
made the offset of slab.slabs equal to page.mapping's one. As a result,
|
|
|
2ba6f6 |
"makedumpfile -d 8", which should exclude user data, excludes some slab
|
|
|
2ba6f6 |
pages wrongly because isAnon() returns true when slab.slabs is an odd
|
|
|
2ba6f6 |
number. With such dumpfiles, crash can fail to start session with an
|
|
|
2ba6f6 |
error like this:
|
|
|
2ba6f6 |
|
|
|
2ba6f6 |
# crash vmlinux dumpfile
|
|
|
2ba6f6 |
...
|
|
|
2ba6f6 |
crash: page excluded: kernel virtual address: ffff8fa047ac2fe8 type: "xa_node shift"
|
|
|
2ba6f6 |
|
|
|
2ba6f6 |
Make isAnon() check that the page is not slab to fix this.
|
|
|
2ba6f6 |
|
|
|
2ba6f6 |
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
2ba6f6 |
---
|
|
|
2ba6f6 |
makedumpfile.c | 6 +++---
|
|
|
2ba6f6 |
makedumpfile.h | 9 +++------
|
|
|
2ba6f6 |
2 files changed, 6 insertions(+), 9 deletions(-)
|
|
|
2ba6f6 |
|
|
|
2ba6f6 |
diff --git a/makedumpfile-1.7.2/makedumpfile.c b/makedumpfile-1.7.2/makedumpfile.c
|
|
|
2ba6f6 |
index ff821eb..f403683 100644
|
|
|
2ba6f6 |
--- a/makedumpfile-1.7.2/makedumpfile.c
|
|
|
2ba6f6 |
+++ b/makedumpfile-1.7.2/makedumpfile.c
|
|
|
2ba6f6 |
@@ -6502,7 +6502,7 @@ __exclude_unnecessary_pages(unsigned long mem_map,
|
|
|
2ba6f6 |
*/
|
|
|
2ba6f6 |
else if ((info->dump_level & DL_EXCLUDE_CACHE)
|
|
|
2ba6f6 |
&& is_cache_page(flags)
|
|
|
2ba6f6 |
- && !isPrivate(flags) && !isAnon(mapping)) {
|
|
|
2ba6f6 |
+ && !isPrivate(flags) && !isAnon(mapping, flags)) {
|
|
|
2ba6f6 |
pfn_counter = &pfn_cache;
|
|
|
2ba6f6 |
}
|
|
|
2ba6f6 |
/*
|
|
|
2ba6f6 |
@@ -6510,7 +6510,7 @@ __exclude_unnecessary_pages(unsigned long mem_map,
|
|
|
2ba6f6 |
*/
|
|
|
2ba6f6 |
else if ((info->dump_level & DL_EXCLUDE_CACHE_PRI)
|
|
|
2ba6f6 |
&& is_cache_page(flags)
|
|
|
2ba6f6 |
- && !isAnon(mapping)) {
|
|
|
2ba6f6 |
+ && !isAnon(mapping, flags)) {
|
|
|
2ba6f6 |
if (isPrivate(flags))
|
|
|
2ba6f6 |
pfn_counter = &pfn_cache_private;
|
|
|
2ba6f6 |
else
|
|
|
2ba6f6 |
@@ -6522,7 +6522,7 @@ __exclude_unnecessary_pages(unsigned long mem_map,
|
|
|
2ba6f6 |
* - hugetlbfs pages
|
|
|
2ba6f6 |
*/
|
|
|
2ba6f6 |
else if ((info->dump_level & DL_EXCLUDE_USER_DATA)
|
|
|
2ba6f6 |
- && (isAnon(mapping) || isHugetlb(compound_dtor))) {
|
|
|
2ba6f6 |
+ && (isAnon(mapping, flags) || isHugetlb(compound_dtor))) {
|
|
|
2ba6f6 |
pfn_counter = &pfn_user;
|
|
|
2ba6f6 |
}
|
|
|
2ba6f6 |
/*
|
|
|
2ba6f6 |
diff --git a/makedumpfile-1.7.2/makedumpfile.h b/makedumpfile-1.7.2/makedumpfile.h
|
|
|
2ba6f6 |
index 70a1a91..21dec7d 100644
|
|
|
2ba6f6 |
--- a/makedumpfile-1.7.2/makedumpfile.h
|
|
|
2ba6f6 |
+++ b/makedumpfile-1.7.2/makedumpfile.h
|
|
|
2ba6f6 |
@@ -161,12 +161,9 @@ test_bit(int nr, unsigned long addr)
|
|
|
2ba6f6 |
#define isSwapBacked(flags) test_bit(NUMBER(PG_swapbacked), flags)
|
|
|
2ba6f6 |
#define isHWPOISON(flags) (test_bit(NUMBER(PG_hwpoison), flags) \
|
|
|
2ba6f6 |
&& (NUMBER(PG_hwpoison) != NOT_FOUND_NUMBER))
|
|
|
2ba6f6 |
-
|
|
|
2ba6f6 |
-static inline int
|
|
|
2ba6f6 |
-isAnon(unsigned long mapping)
|
|
|
2ba6f6 |
-{
|
|
|
2ba6f6 |
- return ((unsigned long)mapping & PAGE_MAPPING_ANON) != 0;
|
|
|
2ba6f6 |
-}
|
|
|
2ba6f6 |
+#define isSlab(flags) test_bit(NUMBER(PG_slab), flags)
|
|
|
2ba6f6 |
+#define isAnon(mapping, flags) (((unsigned long)mapping & PAGE_MAPPING_ANON) != 0 \
|
|
|
2ba6f6 |
+ && !isSlab(flags))
|
|
|
2ba6f6 |
|
|
|
2ba6f6 |
#define PTOB(X) (((unsigned long long)(X)) << PAGESHIFT())
|
|
|
2ba6f6 |
#define BTOP(X) (((unsigned long long)(X)) >> PAGESHIFT())
|
|
|
2ba6f6 |
--
|
|
|
2ba6f6 |
2.33.1
|
|
|
2ba6f6 |
|