OBS User unknown 2009-01-19 01:08:14 +00:00 committed by Git OBS Bridge
parent 3408288f1e
commit 7a7685aef8
5 changed files with 142 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From b4b79993adc9ac3094361900f34582e36f5de162 Mon Sep 17 00:00:00 2001
From: Bernhard Walle <bwalle@suse.de>
Date: Fri, 16 Jan 2009 18:52:29 +0100
Subject: [PATCH] [PPC64] Fix typo in realloc_memory_ranges()
The base_memory_range should not become memory_range. We need to realloc
base_memory_range to not change the contents of memory. That was a copy & paste
error.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index d8347f1..b0d8acd 100644
--- a/kexec/arch/ppc64/kexec-ppc64.c
+++ b/kexec/arch/ppc64/kexec-ppc64.c
@@ -107,7 +107,7 @@ static int realloc_memory_ranges(void)
if (!memory_range)
goto err;
- base_memory_range = (struct memory_range *) realloc(memory_range, memory_range_len);
+ base_memory_range = (struct memory_range *) realloc(base_memory_range, memory_range_len);
if (!base_memory_range)
goto err;

View File

@ -0,0 +1,44 @@
From ef3f522c99c0e8af06ae5af625225885f8930b19 Mon Sep 17 00:00:00 2001
From: Bernhard Walle <bwalle@suse.de>
Date: Fri, 16 Jan 2009 18:52:26 +0100
Subject: [PATCH] [PPC64] Fix memory corruption when using realloc_memory_ranges()
Because realloc_memory_ranges() makes the old memory invalid, and we return
a pointer to memory_range in get_memory_ranges(), we need to copy the contents
in get_memory_ranges().
Some code that calls realloc_memory_ranges() may be triggered by
get_base_ranges() which is called after get_memory_ranges().
Yes, the memory needs to be deleted somewhere, but I don't know currently
where it's the best, and since it's not in a loop and memory is deleted
anyway after program termination I don't want to introduce unneccessary
complexity. The problem is that get_base_ranges() gets called from
architecture independent code and that allocation is PPC64-specific here.
Signed-off-by: Bernhard Walle <bwalle@suse.de>diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index b0d8acd..ad8a31c 100644
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index b0d8acd..ad8a31c 100644
--- a/kexec/arch/ppc64/kexec-ppc64.c
+++ b/kexec/arch/ppc64/kexec-ppc64.c
@@ -715,7 +715,16 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
if (setup_memory_ranges(kexec_flags))
return -1;
- *range = memory_range;
+ /*
+ * copy the memory here, another realloc_memory_ranges might
+ * corrupt the old memory
+ */
+ *range = calloc(sizeof(struct memory_range), nr_memory_ranges);
+ if (*range == NULL)
+ return -1;
+ memmove(*range, memory_range,
+ sizeof(struct memory_range) * nr_memory_ranges);
+
*ranges = nr_memory_ranges;
fprintf(stderr, "get memory ranges:%d\n", nr_memory_ranges);
return 0;

View File

@ -0,0 +1,45 @@
From 8a2f02cc303147cb09f00a9d322c6bfaee32492d Mon Sep 17 00:00:00 2001
From: Bernhard Walle <bwalle@suse.de>
Date: Fri, 16 Jan 2009 18:52:10 +0100
Subject: [PATCH] [PPC64] printf() consolidation
Remove the fprintf(stderr,...) in get_memory_ranges() that adds unnecessary
output in the normal kexec case that the user don't want to see.
Use dbgprintf() in get_base_ranges() instead of
#ifdef DEBUG
fprintf(stderr,...)
#endif
to to make the code more readable.
Signed-off-by: Bernhard Walle <bwalle@suse.de>diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index ad8a31c..8d4e42b 100644
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index ad8a31c..8d4e42b 100644
--- a/kexec/arch/ppc64/kexec-ppc64.c
+++ b/kexec/arch/ppc64/kexec-ppc64.c
@@ -263,9 +263,8 @@ static int get_base_ranges(void)
closedir(dir);
sort_base_ranges();
memory_max = base_memory_range[nr_memory_ranges - 1].end;
-#ifdef DEBUG
- fprintf(stderr, "get base memory ranges:%d\n", nr_memory_ranges);
-#endif
+ dbgprintf("get base memory ranges:%d\n", nr_memory_ranges);
+
return 0;
}
@@ -726,7 +725,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
sizeof(struct memory_range) * nr_memory_ranges);
*ranges = nr_memory_ranges;
- fprintf(stderr, "get memory ranges:%d\n", nr_memory_ranges);
+ dbgprintf("get memory ranges:%d\n", nr_memory_ranges);
return 0;
}

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Jan 16 18:57:47 CET 2009 - bwalle@suse.de
- The dynamic reallocation for PPC64 broke kdump completely.
Fix the patch so that dynamic reallocation actually works
without memory corruption (bnc #466782).
-------------------------------------------------------------------
Fri Jan 16 15:11:37 CET 2009 - bwalle@suse.de
- Add #!BuildIgnore on fop to speed up build (asciidoc don't
require fop for manpage generation).
-------------------------------------------------------------------
Wed Jan 07 14:30:47 CET 2009 - bwalle@suse.de

View File

@ -29,7 +29,7 @@ PreReq: %insserv_prereq %fillup_prereq
AutoReqProv: on
Summary: Tools for fast kernel loading
Version: 2.0.0
Release: 49
Release: 51
Source: %{name}-%{version}.tar.bz2
Source1: kexec-bootloader
Source2: kexec-bootloader.8.txt
@ -53,8 +53,12 @@ Patch14: %{name}-proc-iomem-xen.diff
Patch15: %{name}-parse-iomem-single-warning.diff
Patch16: %{name}-exclude-gart.diff
Patch17: %{name}-ppc64-memory-ranges-dynamic.diff
Patch18: %{name}-ppc64-dynamic-fix-1.diff
Patch19: %{name}-ppc64-dynamic-fix-2.diff
Patch20: %{name}-ppc64-dynamic-fix-3.diff
Url: http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#!BuildIgnore: fop
BuildRequires: zlib-devel
%if 0%{?suse_version} >= 1110
BuildRequires: asciidoc
@ -100,6 +104,9 @@ Authors:
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%build
%{?suse_update_config -f}
@ -167,6 +174,13 @@ install -m 0755 kexec.init ${RPM_BUILD_ROOT}/etc/init.d/kexec
%endif
%changelog
* Fri Jan 16 2009 bwalle@suse.de
- The dynamic reallocation for PPC64 broke kdump completely.
Fix the patch so that dynamic reallocation actually works
without memory corruption (bnc #466782).
* Fri Jan 16 2009 bwalle@suse.de
- Add #!BuildIgnore on fop to speed up build (asciidoc don't
require fop for manpage generation).
* Wed Jan 07 2009 bwalle@suse.de
- Allocate memory ranges dynamically on PPC64 (bnc #460752).
* Tue Dec 09 2008 bwalle@suse.de