6 Commits

Author SHA256 Message Date
Petr Tesarik
c03c96f7ca Move makedumpfile-R.pl to doc.
The script functionality is superseded by `makedumpfile -R`, but the
script may still serve as a useful reference implementation of reading
the flattened file format.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2025-08-13 08:24:34 +02:00
Petr Tesarik
2ca34b3dfd Update bundled eppic to 72da440362e20291d5ecbb04b6eb7c7b492f233c
Fix build with glibc-2.42 (boo#1247577).

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2025-08-13 08:21:38 +02:00
Petr Tesarik
8b6d0ef748 Fix a data race in multi-threading mode (--num-threads=N)
Apply an unreleased fix for a data race.

References: bsc#1245569
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2025-07-18 14:41:50 +02:00
Petr Tesarik
4996c11987 Convert HKT timezone in changelog to UTC. 2025-07-08 10:05:13 +02:00
Petr Tesarik
3195f010eb Update to makedumpfile-1.7.7
New features:
- Support for kernels up to v6.14 (x86_64)

Drop upstreamed patches:
- makedumpfile-fix-detection-of-typed-compound-pages-Linux-6.12.patch

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2025-05-29 13:16:11 +02:00
Petr Tesarik
ef3511896c Update bundled eppic to 63c2a2072464d774097a1a6cc1d2e98290f89c49
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2025-05-29 13:02:38 +02:00
9 changed files with 171 additions and 108 deletions

6
_service Normal file
View File

@@ -0,0 +1,6 @@
<services>
<service name="download_files" mode="manual">
<param name="recompress">yes</param>
</service>
</services>

Binary file not shown.

BIN
eppic-72da440362e20291d5ecbb04b6eb7c7b492f233c.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
makedumpfile-1.7.6.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
makedumpfile-1.7.7.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -1,93 +0,0 @@
From: David Hildenbrand <david@redhat.com>
Date: Fri, 22 Nov 2024 11:12:19 +0100
Subject: fix detection of typed (compound) pages (Linux 6.12)
Git-commit: 72c3414949bd2e9284c8ba7ceaf109a5a34ac2e1
References: bsc#1237269
Link: https://lore.kernel.org/kexec/20241122101219.936746-1-david@redhat.com/
Upstream: merged
* Required for kernel 6.12
Ever since kernel commit 4ffca5a96678c ("mm: support only one page_type
per page"), page types are no longer flags (PG_slab, PG_offline, ...)
stored in page->_mapcount, but values stored in the top byte.
Because we currently try deriving flags from the mapcount values to
check for slab and hugetlb pages, we get:
(1) "false positives" from isSlab(), making us not detect free (buddy)
pages and offline pages anymore.
(2) "false positives" when detecting hugetlb pages.
In the common case we now simply dump all memory, and fail to exclude
offline and free (buddy) pages, assuming they are all slab pages,
which is bad.
We should just consistently compare the page->_mapcount with the unmodified
PAGE_*_MAPCOUNT_VALUE, like we already did for free (buddy) and offline
pages already. This also works for older kernels, because the kernel never
supported having multiple page types set on a single page, so there was
never the need to derive flags from the PAGE_*_MAPCOUNT_VALUE.
It is worth noting that the lower 24bit of the page->_mapcount field
can be used while a page type is set. This is, however, currently not
the case for any of the involved page types (slab, buddy, offline,
hugetlb). In the future, the kernel could either just tell us the types,
or provide a mask to be applied to the page->_mapcount ("bits to ignore")
when comparing the values. But, there might be bigger changes coming up
with the "memdesc" work in the kernel, where the type would not longer
be stored in page->_mapcount ... so for now we can keep it simple.
Link: https://github.com/makedumpfile/makedumpfile/issues/16
Cc: Masamitsu Yamazaki <yamazaki-msmt@nec.com>
Cc: Kazuhito Hagio <k-hagio-ab@nec.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
makedumpfile.c | 6 ++----
makedumpfile.h | 2 --
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index b356eb3..bad3c48 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -280,8 +280,7 @@ isSlab(unsigned long flags, unsigned int _mapcount)
{
/* Linux 6.10 and later */
if (NUMBER(PAGE_SLAB_MAPCOUNT_VALUE) != NOT_FOUND_NUMBER) {
- unsigned int PG_slab = ~NUMBER(PAGE_SLAB_MAPCOUNT_VALUE);
- if ((_mapcount & (PAGE_TYPE_BASE | PG_slab)) == PAGE_TYPE_BASE)
+ if (_mapcount == (int)NUMBER(PAGE_SLAB_MAPCOUNT_VALUE))
return TRUE;
}
@@ -6549,11 +6548,10 @@ __exclude_unnecessary_pages(unsigned long mem_map,
*/
if (NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE) != NOT_FOUND_NUMBER) {
unsigned long _flags_1 = ULONG(addr + OFFSET(page.flags));
- unsigned int PG_hugetlb = ~NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE);
compound_order = _flags_1 & 0xff;
- if ((_mapcount & (PAGE_TYPE_BASE | PG_hugetlb)) == PAGE_TYPE_BASE)
+ if (_mapcount == (int)NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE))
compound_dtor = IS_HUGETLB;
goto check_order;
diff --git a/makedumpfile.h b/makedumpfile.h
index 7ed566d..2b3495e 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -164,8 +164,6 @@ test_bit(int nr, unsigned long addr)
#define isAnon(mapping, flags, _mapcount) \
(((unsigned long)mapping & PAGE_MAPPING_ANON) != 0 && !isSlab(flags, _mapcount))
-#define PAGE_TYPE_BASE (0xf0000000)
-
#define PTOB(X) (((unsigned long long)(X)) << PAGESHIFT())
#define BTOP(X) (((unsigned long long)(X)) >> PAGESHIFT())
--
2.48.1

View File

@@ -0,0 +1,117 @@
From: Tao Liu <ltao@redhat.com>
Date: Wed, 25 Jun 2025 14:23:44 +1200
Subject: Fix a data race in multi-threading mode (--num-threads=N)
References: bsc#1245569
Git-commit: 65bf4c9ef0fd0cbf2fb99b60e15b00d984b391b8
Upstream: merged
A vmcore corrupt issue has been noticed in powerpc arch [1]. It can be
reproduced with upstream makedumpfile.
When analyzing the corrupt vmcore using crash, the following error
message will output:
crash: compressed kdump: uncompress failed: 0
crash: read error: kernel virtual address: c0001e2d2fe48000 type:
"hardirq thread_union"
crash: cannot read hardirq_ctx[930] at c0001e2d2fe48000
crash: compressed kdump: uncompress failed: 0
If the vmcore is generated without num-threads option, then no such
errors are noticed.
With --num-threads=N enabled, there will be N sub-threads created. All
sub-threads are producers which responsible for mm page processing, e.g.
compression. The main thread is the consumer which responsible for
writing the compressed data into file. page_flag_buf->ready is used to
sync main and sub-threads. When a sub-thread finishes page processing,
it will set ready flag to be FLAG_READY. In the meantime, main thread
looply check all threads of the ready flags, and break the loop when
find FLAG_READY.
page_flag_buf->ready is read/write by main/sub-threads simultaneously,
but it is unprotected and unsafe. I have tested both mutex and atomic_rw
can fix this issue. This patch takes atomic_rw for its simplicity.
[1]: https://github.com/makedumpfile/makedumpfile/issues/15
Resolves: https://github.com/makedumpfile/makedumpfile/issues/15
Tested-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
makedumpfile.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -8623,7 +8623,8 @@ kdump_thread_function_cyclic(void *arg)
while (buf_ready == FALSE) {
pthread_testcancel();
- if (page_flag_buf->ready == FLAG_READY)
+ if (__atomic_load_n(&page_flag_buf->ready,
+ __ATOMIC_SEQ_CST) == FLAG_READY)
continue;
/* get next dumpable pfn */
@@ -8639,7 +8640,8 @@ kdump_thread_function_cyclic(void *arg)
info->current_pfn = pfn + 1;
page_flag_buf->pfn = pfn;
- page_flag_buf->ready = FLAG_FILLING;
+ __atomic_store_n(&page_flag_buf->ready, FLAG_FILLING,
+ __ATOMIC_SEQ_CST);
pthread_mutex_unlock(&info->current_pfn_mutex);
sem_post(&info->page_flag_buf_sem);
@@ -8728,7 +8730,8 @@ kdump_thread_function_cyclic(void *arg)
page_flag_buf->index = index;
buf_ready = TRUE;
next:
- page_flag_buf->ready = FLAG_READY;
+ __atomic_store_n(&page_flag_buf->ready, FLAG_READY,
+ __ATOMIC_SEQ_CST);
page_flag_buf = page_flag_buf->next;
}
@@ -8857,7 +8860,8 @@ write_kdump_pages_parallel_cyclic(struct
* current_pfn is used for recording the value of pfn when checking the pfn.
*/
for (i = 0; i < info->num_threads; i++) {
- if (info->page_flag_buf[i]->ready == FLAG_UNUSED)
+ if (__atomic_load_n(&info->page_flag_buf[i]->ready,
+ __ATOMIC_SEQ_CST) == FLAG_UNUSED)
continue;
temp_pfn = info->page_flag_buf[i]->pfn;
@@ -8865,7 +8869,8 @@ write_kdump_pages_parallel_cyclic(struct
* count how many threads have reached the end.
*/
if (temp_pfn >= end_pfn) {
- info->page_flag_buf[i]->ready = FLAG_UNUSED;
+ __atomic_store_n(&info->page_flag_buf[i]->ready,
+ FLAG_UNUSED, __ATOMIC_SEQ_CST);
end_count++;
continue;
}
@@ -8887,7 +8892,8 @@ write_kdump_pages_parallel_cyclic(struct
* If the page_flag_buf is not ready, the pfn recorded may be changed.
* So we should recheck.
*/
- if (info->page_flag_buf[consuming]->ready != FLAG_READY) {
+ if (__atomic_load_n(&info->page_flag_buf[consuming]->ready,
+ __ATOMIC_SEQ_CST) != FLAG_READY) {
clock_gettime(CLOCK_MONOTONIC, &new);
if (new.tv_sec - last.tv_sec > WAIT_TIME) {
ERRMSG("Can't get data of pfn.\n");
@@ -8929,7 +8935,8 @@ write_kdump_pages_parallel_cyclic(struct
goto out;
page_data_buf[index].used = FALSE;
}
- info->page_flag_buf[consuming]->ready = FLAG_UNUSED;
+ __atomic_store_n(&info->page_flag_buf[consuming]->ready,
+ FLAG_UNUSED, __ATOMIC_SEQ_CST);
info->page_flag_buf[consuming] = info->page_flag_buf[consuming]->next;
}
finish:

View File

@@ -1,3 +1,37 @@
-------------------------------------------------------------------
Wed Aug 13 06:22:31 UTC 2025 - Petr Tesařík <ptesarik@suse.com>
- Move makedumpfile-R.pl to doc. The script is no longer needed,
but may serve as a useful reference implementation of reading the
flattened file format.
-------------------------------------------------------------------
Wed Aug 13 06:07:18 UTC 2025 - Petr Tesařík <ptesarik@suse.com>
- Update bundled eppic to 72da440362e20291d5ecbb04b6eb7c7b492f233c
(boo#1247577).
-------------------------------------------------------------------
Fri Jul 18 12:40:21 UTC 2025 - Petr Tesařík <ptesarik@suse.com>
- makedumpfile-fix-multi-threading-data-race.patch: Fix a data race
in multi-threading mode (--num-threads=N) (bsc#1245569).
-------------------------------------------------------------------
Thu May 29 11:10:50 UTC 2025 - Petr Tesařík <ptesarik@suse.com>
- Update to 1.7.7:
* Support for kernels up to v6.14 (x86_64)
* Fix gcc-15 compile errors
* Improve message readability and fix typos
- Drop upstreamed patches:
* makedumpfile-fix-detection-of-typed-compound-pages-Linux-6.12.patch
-------------------------------------------------------------------
Thu May 29 10:54:22 UTC 2025 - Petr Tesařík <ptesarik@suse.com>
- Update bundled eppic to 63c2a2072464d774097a1a6cc1d2e98290f89c49.
-------------------------------------------------------------------
Thu Feb 27 10:09:29 UTC 2025 - Petr Tesařík <ptesarik@suse.com>
@@ -436,7 +470,7 @@ Wed Nov 15 18:05:58 UTC 2017 - msuchanek@suse.com
apply to SLE15 (4.12 kernel) due to backport of 2d070eab2e82 (bsc#1067703)
-------------------------------------------------------------------
Fri Nov 10 17:01:33 HKT 2017 - lzwang@suse.com
Fri Nov 10 09:01:33 UTC 2017 - lzwang@suse.com
- Handled renaming of init_level4_pgt to init_top_pgt (bsc#1066770).
* Added patch: makedumpfile-handle-renamed-init_level4_pgt-init_top_pgt.patch
@@ -447,7 +481,7 @@ Thu Nov 9 12:16:29 UTC 2017 - jslaby@suse.com
- add makedumpfile-Fix-SECTION_MAP_MASK-for-kernel-v.13.patch (bnc#1066811)
-------------------------------------------------------------------
Wed Nov 8 17:00:15 HKT 2017 - lzwang@suse.com
Wed Nov 8 09:00:15 UTC 2017 - lzwang@suse.com
- Update to 1.6.2
* Fix the use of Xen physical and machine addresses (bsc#1014136)

View File

@@ -17,7 +17,7 @@
%define build_eppic 1
%define eppic_commit 21808c78596d6d80c67eeaa08a618570ae0d886d
%define eppic_commit 72da440362e20291d5ecbb04b6eb7c7b492f233c
%if 0%{!?have_zstd:1}
%if 0%{?sle_version} >= 150200 || 0%{?suse_version} > 1500
@@ -28,19 +28,19 @@
%endif
Name: makedumpfile
Version: 1.7.6
Version: 1.7.7
Release: 0
Summary: Partial kernel dump
License: GPL-2.0-only
Group: System/Kernel
URL: https://github.com/makedumpfile/makedumpfile
Source: https://github.com/makedumpfile/makedumpfile/releases/download/%{version}/%{name}-%{version}.tar.gz
Source: https://github.com/makedumpfile/makedumpfile/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.xz
Source1: https://github.com/lucchouina/eppic/archive/%{eppic_commit}.tar.gz#/eppic-%{eppic_commit}.tar.gz
Source99: %{name}-rpmlintrc
Patch0: %{name}-override-libtinfo.patch
Patch1: %{name}-ppc64-VA-range-SUSE.patch
Patch2: %{name}-PN_XNUM.patch
Patch3: %{name}-fix-detection-of-typed-compound-pages-Linux-6.12.patch
Patch3: %{name}-fix-multi-threading-data-race.patch
BuildRequires: libbz2-devel
BuildRequires: libdw-devel
BuildRequires: libelf-devel
@@ -97,7 +97,6 @@ make %{?_smp_mflags} eppic_makedumpfile.so %{?ncurses_make_opts}
install -D -m 0755 makedumpfile %{buildroot}%{_bindir}/makedumpfile
install -D -m 0644 makedumpfile.8 %{buildroot}%{_mandir}/man8/makedumpfile.8
install -D -m 0644 makedumpfile.conf.5 %{buildroot}%{_mandir}/man5/makedumpfile.conf.5
install -D -m 0644 makedumpfile-R.pl %{buildroot}%{_datadir}/%{name}-%{version}/makedumpfile-R.pl
%if %{build_eppic}
install -D -m 0755 eppic_makedumpfile.so %{buildroot}%{_libdir}/%{name}-%{version}/eppic_makedumpfile.so
install -d -m 0755 %{buildroot}%{_datadir}/%{name}-%{version}/eppic_scripts
@@ -119,13 +118,13 @@ install -m 0644 -t %{buildroot}%{_datadir}/%{name}-%{version}/eppic_scripts/ epp
%defattr(-,root,root)
%license COPYING
%doc README IMPLEMENTATION
%doc makedumpfile-R.pl
%{_mandir}/man?/*
%{_bindir}/*
%dir %{_datadir}/%{name}-%{version}
%{_datadir}/%{name}-%{version}/makedumpfile-R.pl
%if %{build_eppic}
%dir %{_libdir}/%{name}-%{version}
%{_libdir}/%{name}-%{version}/eppic_makedumpfile.so
%dir %{_datadir}/%{name}-%{version}
%{_datadir}/%{name}-%{version}/eppic_scripts/
%endif