Rebase makedumpfile-1.5.6

Signed-off-by: WANG Chao <chaowang@redhat.com>
This commit is contained in:
WANG Chao 2014-04-28 21:52:15 +08:00
parent 38eb68edad
commit 39178b1346
5 changed files with 14 additions and 128 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ makedumpfile-1.3.5.tar.gz
/makedumpfile-1.5.5.tar.gz
/kexec-tools-2.0.5.tar.xz
/kexec-tools-2.0.6.tar.xz
/makedumpfile-1.5.6.tar.gz

View File

@ -1,6 +1,6 @@
--- kexec-tools-2.0.3/makedumpfile-1.5.5/Makefile.orig
+++ kexec-tools-2.0.3/makedumpfile-1.5.5/Makefile
@@ -60,7 +60,7 @@ LIBS := -lsnappy $(LIBS)
--- kexec-tools-2.0.6/makedumpfile-1.5.6/Makefile.orig
+++ kexec-tools-2.0.6/makedumpfile-1.5.6/Makefile
@@ -66,7 +66,7 @@
CFLAGS += -DUSESNAPPY
endif
@ -8,8 +8,8 @@
+all: makedumpfile eppic_makedumpfile.so
$(OBJ_PART): $(SRC_PART)
$(CC) $(CFLAGS) -c -o ./$@ ./$(@:.o=.c)
@@ -80,7 +80,7 @@ makedumpfile: $(SRC) $(OBJ_PART) $(OBJ_A
$(CC) $(CFLAGS) -c -o ./$@ $(VPATH)$(@:.o=.c)
@@ -87,7 +87,7 @@
gzip -c ./makedumpfile.conf.5 > ./makedumpfile.conf.5.gz
eppic_makedumpfile.so: extension_eppic.c

View File

@ -1,112 +0,0 @@
From 4404368a0860e3b6c845eb41782e97a9bf7593b8 Mon Sep 17 00:00:00 2001
From: WANG Chao <chaowang@redhat.com>
Date: Wed, 18 Dec 2013 22:34:43 +0900
Subject: [PATCH] [PATCH] memset() in cyclic bitmap initialization introduce
segment fault.
We are using memset() to improve performance when creating 1st and 2nd
bitmap. After doing round up the pfn_start and round down pfn_end, it's
possible that pfn_start_roundup is greater than pfn_end_round. A segment
fault could happen in that case because memset is taking roughly the
value of (pfn_end_round << 3 - pfn_start_roundup << 3 ), which is
negative, as its third argument.
So we can skip the memset if start is greater than end. It's safe
because we will set bit for the round up part and also round down part.
Actually this happens on my EFI virtual machine:
cat /proc/iomem:
00000000-00000fff : reserved
00001000-0009ffff : System RAM
000a0000-000bffff : PCI Bus 0000:00
000f0000-000fffff : System ROM
00100000-3d162017 : System RAM
01000000-015cab9b : Kernel code
015cab9c-019beb3f : Kernel data
01b4f000-01da9fff : Kernel bss
30000000-37ffffff : Crash kernel
3d162018-3d171e57 : System RAM
3d171e58-3d172017 : System RAM
3d172018-3d17ae57 : System RAM
3d17ae58-3dc10fff : System RAM
3dc11000-3dc18fff : reserved
3dc19000-3dc41fff : System RAM
3dc42000-3ddcefff : reserved
3ddcf000-3f7fefff : System RAM
3f7ff000-3f856fff : reserved
[..]
gdb ./makedumpfile core
(gdb) bt full
[..]
#1 0x000000000042775d in create_1st_bitmap_cyclic () at makedumpfile.c:4543
i = 0x5
pfn = 0x3d190
phys_start = 0x3d18ee58
phys_end = 0x3d18f018
pfn_start = 0x3d18e
pfn_end = 0x3d18f
pfn_start_roundup = 0x3d190
pfn_end_round = 0x3d188
pfn_start_byte = 0x7a32
pfn_end_byte = 0x7a31
[..]
(gdb) list makedumpfile.c:4543
4538 return FALSE;
4539
4540 pfn_start_byte = (pfn_start_roundup - info->cyclic_start_pfn) >>
3;
4541 pfn_end_byte = (pfn_end_round - info->cyclic_start_pfn) >> 3;
4542
4543 memset(info->partial_bitmap2 + pfn_start_byte,
4544 0xff,
4545 pfn_end_byte - pfn_start_byte);
4546
4547 for (pfn = pfn_end_round; pfn < pfn_end; ++pfn)
Signed-off-by: WANG Chao <chaowang@redhat.com>
---
makedumpfile.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index 23251a1..ef08d91 100644
--- a/makedumpfile-1.5.5/makedumpfile.c
+++ b/makedumpfile-1.5.5/makedumpfile.c
@@ -4435,11 +4435,13 @@ create_1st_bitmap_cyclic()
pfn_start_byte = (pfn_start_roundup - info->cyclic_start_pfn) >> 3;
pfn_end_byte = (pfn_end_round - info->cyclic_start_pfn) >> 3;
- memset(info->partial_bitmap1 + pfn_start_byte,
- 0xff,
- pfn_end_byte - pfn_start_byte);
+ if (pfn_start_byte < pfn_end_byte) {
+ memset(info->partial_bitmap1 + pfn_start_byte,
+ 0xff,
+ pfn_end_byte - pfn_start_byte);
- pfn_bitmap1 += (pfn_end_byte - pfn_start_byte) * BITPERBYTE;
+ pfn_bitmap1 += (pfn_end_byte - pfn_start_byte) * BITPERBYTE;
+ }
for (pfn = pfn_end_round; pfn < pfn_end; pfn++) {
if (set_bit_on_1st_bitmap(pfn))
@@ -4540,9 +4542,11 @@ initialize_2nd_bitmap_cyclic(void)
pfn_start_byte = (pfn_start_roundup - info->cyclic_start_pfn) >> 3;
pfn_end_byte = (pfn_end_round - info->cyclic_start_pfn) >> 3;
- memset(info->partial_bitmap2 + pfn_start_byte,
- 0xff,
- pfn_end_byte - pfn_start_byte);
+ if (pfn_start_byte < pfn_end_byte) {
+ memset(info->partial_bitmap2 + pfn_start_byte,
+ 0xff,
+ pfn_end_byte - pfn_start_byte);
+ }
for (pfn = pfn_end_round; pfn < pfn_end; ++pfn)
if (!set_bit_on_2nd_bitmap_for_kernel(pfn))
--
1.8.5.3

View File

@ -12,7 +12,7 @@ Source4: kdump.sysconfig.i386
Source5: kdump.sysconfig.ppc64
Source7: mkdumprd
Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.5/makedumpfile-1.5.5.tar.gz
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.6/makedumpfile-1.5.6.tar.gz
Source10: kexec-kdump-howto.txt
Source11: firstboot_kdump.py
Source12: mkdumprd.8
@ -75,7 +75,6 @@ ExcludeArch: aarch64
#
Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
Patch604: kexec-tools-2.0.3-build-makedumpfile-eppic-shared-object.patch
Patch618: kexec-tools-2.0.4-makedumpfile-memset-in-cyclic-bitmap-initialization-introdu.patch
Patch619: kexec-tools-2.0.5-vmcore-dmesg-stack-smashing-happend-in-extreme-case.patch
%description
@ -107,7 +106,6 @@ tar -z -x -v -f %{SOURCE19}
%patch601 -p1
%patch604 -p1
%patch618 -p1
%patch619 -p1
tar -z -x -v -f %{SOURCE13}
@ -132,7 +130,7 @@ cp %{SOURCE21} .
make
%ifarch %{ix86} x86_64 ppc64 s390x
make -C eppic/libeppic
make -C makedumpfile-1.5.5 LINKTYPE=dynamic USELZO=on USESNAPPY=on
make -C makedumpfile-1.5.6 LINKTYPE=dynamic USELZO=on USESNAPPY=on
%endif
make -C kexec-tools-po
@ -174,11 +172,11 @@ mkdir -p $RPM_BUILD_ROOT/usr/sbin
install -m 755 %{SOURCE17} $RPM_BUILD_ROOT/usr/sbin/rhcrashkernel-param
%ifarch %{ix86} x86_64 ppc64 s390x
install -m 755 makedumpfile-1.5.5/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile
install -m 644 makedumpfile-1.5.5/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
install -m 644 makedumpfile-1.5.5/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
install -m 644 makedumpfile-1.5.5/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
install -m 755 makedumpfile-1.5.5/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
install -m 755 makedumpfile-1.5.6/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile
install -m 644 makedumpfile-1.5.6/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
install -m 644 makedumpfile-1.5.6/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
install -m 644 makedumpfile-1.5.6/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
install -m 755 makedumpfile-1.5.6/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
%endif
make -C kexec-tools-po install DESTDIR=$RPM_BUILD_ROOT
%find_lang %{name}

View File

@ -1,5 +1,4 @@
b48eb2726d602c1aa3abfd3739441f54 eppic_030413.tar.gz
ba3710c36b287b6a61b2867b4c9b6478 kexec-tools-po-20131224.tgz
70ff343bbe6657b69beb23458e3e0b98 makedumpfile-1.5.5.tar.gz
e476990aa00e27a799a89b3c8f63e82b kexec-tools-2.0.5.tar.xz
9192e5b9fab094b90f481226d1ad5e74 kexec-tools-2.0.6.tar.xz
874990aedbdd28689a238917169852f8 makedumpfile-1.5.6.tar.gz