Release 2.0.15-6
Update makedumpfile to upstream 1.6.2 Signed-off-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
ee882b26b7
commit
d968a68263
|
@ -1,43 +0,0 @@
|
||||||
From 5520739f1e6e31c7731d34d384bbaf4904282931 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <5520739f1e6e31c7731d34d384bbaf4904282931.1489470510.git.panand@redhat.com>
|
|
||||||
From: Pratyush Anand <panand@redhat.com>
|
|
||||||
Date: Wed, 1 Mar 2017 11:19:42 +0530
|
|
||||||
Subject: [PATCH] build_mem_phdrs(): check if p_paddr is invalid
|
|
||||||
|
|
||||||
Currently, all the p_paddr of PT_LOAD headers are assigned to 0, which
|
|
||||||
is not correct and could be misleading, since 0 is a valid physical
|
|
||||||
address.
|
|
||||||
|
|
||||||
Upstream kernel commit "464920104bf7 /proc/kcore: update physical
|
|
||||||
address for kcore ram and text" fixed it and now invalid PT_LOAD is
|
|
||||||
assigned as -1.
|
|
||||||
|
|
||||||
kexec/arch/i386/crashdump-x86.c:get_kernel_vaddr_and_size() uses kcore
|
|
||||||
interface and so calls build_mem_phdrs() for kcore PT_LOAD headers.
|
|
||||||
|
|
||||||
This patch fixes build_mem_phdrs() to check if p_paddr is invalid.
|
|
||||||
|
|
||||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
||||||
Acked-by: Dave Young <dyoung@redhat.com>
|
|
||||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
||||||
---
|
|
||||||
kexec/kexec-elf.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
|
|
||||||
index 1d6320a2f0e6..be60bbd48486 100644
|
|
||||||
--- a/kexec/kexec-elf.c
|
|
||||||
+++ b/kexec/kexec-elf.c
|
|
||||||
@@ -432,7 +432,8 @@ static int build_mem_phdrs(const char *buf, off_t len, struct mem_ehdr *ehdr,
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if ((phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
|
|
||||||
+ if (phdr->p_paddr != (unsigned long long)-1 &&
|
|
||||||
+ (phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
|
|
||||||
/* The memory address wraps */
|
|
||||||
if (probe_debug) {
|
|
||||||
fprintf(stderr, "ELF address wrap around\n");
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
From f4ab6897a716d3f3959f6cb8cab27744eaecb5a6 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <f4ab6897a716d3f3959f6cb8cab27744eaecb5a6.1489471500.git.panand@redhat.com>
|
|
||||||
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
From: Pratyush Anand <panand@redhat.com>
|
|
||||||
Date: Thu, 2 Mar 2017 17:37:16 +0900
|
|
||||||
Subject: [PATCH 4/7] [PATCH v3 4/7] elf_info: kcore: check for invalid
|
|
||||||
physical address
|
|
||||||
|
|
||||||
kcore passes correct phys_start for direct mapped region and an invalid
|
|
||||||
value (-1) for all other regions after the kernel commit
|
|
||||||
464920104bf7(/proc/kcore: update physical address for kcore ram and
|
|
||||||
text). arch specific function is_phys_addr() accepts only virt_start.
|
|
||||||
Therefore, check for valid phys_start in get_kcore_dump_loads().
|
|
||||||
|
|
||||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
||||||
---
|
|
||||||
elf_info.c | 6 ++++--
|
|
||||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.1/elf_info.c b/makedumpfile-1.6.1/elf_info.c
|
|
||||||
index 65ff333cf33a..c5743b3cab28 100644
|
|
||||||
--- a/makedumpfile-1.6.1/elf_info.c
|
|
||||||
+++ b/makedumpfile-1.6.1/elf_info.c
|
|
||||||
@@ -881,7 +881,8 @@ int get_kcore_dump_loads(void)
|
|
||||||
|
|
||||||
for (i = 0; i < num_pt_loads; ++i) {
|
|
||||||
struct pt_load_segment *p = &pt_loads[i];
|
|
||||||
- if (!is_phys_addr(p->virt_start))
|
|
||||||
+ if (p->phys_start == NOT_PADDR
|
|
||||||
+ || !is_phys_addr(p->virt_start))
|
|
||||||
continue;
|
|
||||||
loads++;
|
|
||||||
}
|
|
||||||
@@ -901,7 +902,8 @@ int get_kcore_dump_loads(void)
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < num_pt_loads; ++i) {
|
|
||||||
struct pt_load_segment *p = &pt_loads[i];
|
|
||||||
- if (!is_phys_addr(p->virt_start))
|
|
||||||
+ if (p->phys_start == NOT_PADDR
|
|
||||||
+ || !is_phys_addr(p->virt_start))
|
|
||||||
continue;
|
|
||||||
if (j >= loads)
|
|
||||||
return FALSE;
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
From 8e2834bac4f62da3894da297f083068431be6d80 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <8e2834bac4f62da3894da297f083068431be6d80.1489471500.git.panand@redhat.com>
|
|
||||||
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
From: Pratyush Anand <panand@redhat.com>
|
|
||||||
Date: Thu, 2 Mar 2017 17:37:11 +0900
|
|
||||||
Subject: [PATCH 2/7] [PATCH v3 2/7] initial(): call cache_init() a bit early
|
|
||||||
|
|
||||||
Call cache_init() before get_kcore_dump_loads(), because latter uses
|
|
||||||
cache_search().
|
|
||||||
|
|
||||||
Call path is like this :
|
|
||||||
get_kcore_dump_loads() -> process_dump_load() -> vaddr_to_paddr() ->
|
|
||||||
vtop4_x86_64() -> readmem() -> cache_search()
|
|
||||||
|
|
||||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
||||||
---
|
|
||||||
makedumpfile.c | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.1/makedumpfile.c b/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
index 6942047199de..3b8e9810468d 100644
|
|
||||||
--- a/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
+++ b/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
@@ -3878,6 +3878,9 @@ initial(void)
|
|
||||||
if (!get_value_for_old_linux())
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
+ if (!is_xen_memory() && !cache_init())
|
|
||||||
+ return FALSE;
|
|
||||||
+
|
|
||||||
if (info->flag_mem_usage && !get_kcore_dump_loads())
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
@@ -4000,9 +4003,6 @@ out:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!is_xen_memory() && !cache_init())
|
|
||||||
- return FALSE;
|
|
||||||
-
|
|
||||||
if (debug_info && !get_machdep_info())
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
From 4c53423b995463067fbbd394e724b4d1d6ea3d62 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <4c53423b995463067fbbd394e724b4d1d6ea3d62.1489471500.git.panand@redhat.com>
|
|
||||||
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
From: Baoquan He <bhe@redhat.com>
|
|
||||||
Date: Thu, 2 Mar 2017 17:37:19 +0900
|
|
||||||
Subject: [PATCH 5/7] [PATCH v3 5/7] makedumpfile: Correct the calculation of
|
|
||||||
kvaddr in set_kcore_vmcoreinfo
|
|
||||||
|
|
||||||
In set_kcore_vmcoreinfo, we calculate the virtual address of vmcoreinfo
|
|
||||||
by OR operation as below:
|
|
||||||
|
|
||||||
kvaddr = (ulong)vmcoreinfo_addr | PAGE_OFFSET;
|
|
||||||
|
|
||||||
When mm sections kaslr is not enabled, this is correct since the
|
|
||||||
starting address of direct mapping section is 0xffff880000000000 which
|
|
||||||
is 1T aligned. Usually system with memory below 1T won't cause problem.
|
|
||||||
|
|
||||||
However with mm section kaslr enabled, the starting address of direct
|
|
||||||
mapping is 1G aligned. The above code makes kvaddr unsure.
|
|
||||||
|
|
||||||
So change it to adding operation:
|
|
||||||
kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET;
|
|
||||||
|
|
||||||
Signed-off-by: Baoquan He <bhe@redhat.com>
|
|
||||||
---
|
|
||||||
elf_info.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.1/elf_info.c b/makedumpfile-1.6.1/elf_info.c
|
|
||||||
index c5743b3cab28..100272f83c48 100644
|
|
||||||
--- a/makedumpfile-1.6.1/elf_info.c
|
|
||||||
+++ b/makedumpfile-1.6.1/elf_info.c
|
|
||||||
@@ -372,7 +372,7 @@ int set_kcore_vmcoreinfo(uint64_t vmcoreinfo_addr, uint64_t vmcoreinfo_len)
|
|
||||||
off_t offset_desc;
|
|
||||||
|
|
||||||
offset = UNINITIALIZED;
|
|
||||||
- kvaddr = (ulong)vmcoreinfo_addr | PAGE_OFFSET;
|
|
||||||
+ kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET;
|
|
||||||
|
|
||||||
for (i = 0; i < num_pt_loads; ++i) {
|
|
||||||
struct pt_load_segment *p = &pt_loads[i];
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
From f3ff8c6232de43fa2cc60f5ca0f233cf8eb8d2ad Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <f3ff8c6232de43fa2cc60f5ca0f233cf8eb8d2ad.1489471500.git.panand@redhat.com>
|
|
||||||
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
From: Baoquan He <bhe@redhat.com>
|
|
||||||
Date: Thu, 2 Mar 2017 17:37:23 +0900
|
|
||||||
Subject: [PATCH 6/7] [PATCH v3 6/7] makedumpfile: Discard process_dump_load
|
|
||||||
|
|
||||||
Kernel commit 464920104bf7 (/proc/kcore: update physical address for
|
|
||||||
kcore ram and text) provides physical address of direct mapping kcore
|
|
||||||
program segments. So no need to calculate it specifically now. And the
|
|
||||||
old code is not correct since it calls vaddr_to_paddr() which has not
|
|
||||||
been ready at that time.
|
|
||||||
|
|
||||||
Signed-off-by: Baoquan He <bhe@redhat.com>
|
|
||||||
---
|
|
||||||
elf_info.c | 17 -----------------
|
|
||||||
1 file changed, 17 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.1/elf_info.c b/makedumpfile-1.6.1/elf_info.c
|
|
||||||
index 100272f83c48..8e2437622141 100644
|
|
||||||
--- a/makedumpfile-1.6.1/elf_info.c
|
|
||||||
+++ b/makedumpfile-1.6.1/elf_info.c
|
|
||||||
@@ -857,22 +857,6 @@ static int exclude_segment(struct pt_load_segment **pt_loads,
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int
|
|
||||||
-process_dump_load(struct pt_load_segment *pls)
|
|
||||||
-{
|
|
||||||
- unsigned long long paddr;
|
|
||||||
-
|
|
||||||
- paddr = vaddr_to_paddr(pls->virt_start);
|
|
||||||
- pls->phys_start = paddr;
|
|
||||||
- pls->phys_end = paddr + (pls->virt_end - pls->virt_start);
|
|
||||||
- DEBUG_MSG("process_dump_load\n");
|
|
||||||
- DEBUG_MSG(" phys_start : %llx\n", pls->phys_start);
|
|
||||||
- DEBUG_MSG(" phys_end : %llx\n", pls->phys_end);
|
|
||||||
- DEBUG_MSG(" virt_start : %llx\n", pls->virt_start);
|
|
||||||
- DEBUG_MSG(" virt_end : %llx\n", pls->virt_end);
|
|
||||||
-
|
|
||||||
- return TRUE;
|
|
||||||
-}
|
|
||||||
|
|
||||||
int get_kcore_dump_loads(void)
|
|
||||||
{
|
|
||||||
@@ -917,7 +901,6 @@ int get_kcore_dump_loads(void)
|
|
||||||
}
|
|
||||||
|
|
||||||
pls[j] = *p;
|
|
||||||
- process_dump_load(&pls[j]);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
From 78cbb4035209add81563c00ba46d237f86b8c427 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <78cbb4035209add81563c00ba46d237f86b8c427.1489471500.git.panand@redhat.com>
|
|
||||||
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
From: Pratyush Anand <panand@redhat.com>
|
|
||||||
Date: Thu, 2 Mar 2017 17:37:25 +0900
|
|
||||||
Subject: [PATCH 7/7] [PATCH v3 7/7] mem-usage: allow to work only with -f for
|
|
||||||
kernel version < 4.11
|
|
||||||
|
|
||||||
PT_LOAD of kcore does not have valid p_paddr values for kernel version
|
|
||||||
less that v4.11. Therefore, older kernel will no long work for mem-usage
|
|
||||||
with current makedumpfile code. They can only work when they are patched
|
|
||||||
with fix to "update physical address for kcore ram and text".
|
|
||||||
|
|
||||||
This patch fixes the makedumpfile so that it does not allow to work
|
|
||||||
older kernel for --mem-usage until someone is sure that kernel is
|
|
||||||
rightly patched and so uses -f in command line. It also updates man page
|
|
||||||
and usage info accordingly.
|
|
||||||
|
|
||||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
||||||
---
|
|
||||||
makedumpfile.8 | 9 ++++++++-
|
|
||||||
makedumpfile.c | 6 ++++++
|
|
||||||
print_info.c | 1 +
|
|
||||||
3 files changed, 15 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.1/makedumpfile.8 b/makedumpfile-1.6.1/makedumpfile.8
|
|
||||||
index 9069fb18cdb6..993236486e77 100644
|
|
||||||
--- a/makedumpfile-1.6.1/makedumpfile.8
|
|
||||||
+++ b/makedumpfile-1.6.1/makedumpfile.8
|
|
||||||
@@ -235,13 +235,20 @@ the ELF format does not support compressed data.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\-f\fR
|
|
||||||
-Force existing DUMPFILE to be overwritten.
|
|
||||||
+Force existing DUMPFILE to be overwritten and mem-usage to work with older
|
|
||||||
+kernel as well.
|
|
||||||
.br
|
|
||||||
.B Example:
|
|
||||||
.br
|
|
||||||
# makedumpfile \-f \-d 31 \-x vmlinux /proc/vmcore dumpfile
|
|
||||||
.br
|
|
||||||
This command overwrites \fIDUMPFILE\fR even if it already exists.
|
|
||||||
+.br
|
|
||||||
+# makedumpfile \-f \-\-mem\-usage /proc/kcore
|
|
||||||
+.br
|
|
||||||
+Kernel version lesser than v4.11 will not work with \-\-mem\-usage
|
|
||||||
+functionality until it has been patched with upstream commit 464920104bf7.
|
|
||||||
+Therefore if you have patched your older kernel then use \-f.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\-x\fR \fIVMLINUX\fR
|
|
||||||
diff --git a/makedumpfile-1.6.1/makedumpfile.c b/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
index 3b8e9810468d..e3be1ab0a9ec 100644
|
|
||||||
--- a/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
+++ b/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
@@ -11269,6 +11269,12 @@ main(int argc, char *argv[])
|
|
||||||
MSG("Try `makedumpfile --help' for more information.\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
+ if (info->kernel_version < KERNEL_VERSION(4, 11, 0) &&
|
|
||||||
+ !info->flag_force) {
|
|
||||||
+ MSG("mem-usage not supported for this kernel.\n");
|
|
||||||
+ MSG("You can try with -f if your kernel's kcore has valid p_paddr\n");
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (!show_mem_usage())
|
|
||||||
goto out;
|
|
||||||
diff --git a/makedumpfile-1.6.1/print_info.c b/makedumpfile-1.6.1/print_info.c
|
|
||||||
index 392d863a4227..3c577d83cebb 100644
|
|
||||||
--- a/makedumpfile-1.6.1/print_info.c
|
|
||||||
+++ b/makedumpfile-1.6.1/print_info.c
|
|
||||||
@@ -310,6 +310,7 @@ print_usage(void)
|
|
||||||
MSG("\n");
|
|
||||||
MSG(" [-f]:\n");
|
|
||||||
MSG(" Overwrite DUMPFILE even if it already exists.\n");
|
|
||||||
+ MSG(" Force mem-usage to work with older kernel as well.\n");
|
|
||||||
MSG("\n");
|
|
||||||
MSG(" [-h, --help]:\n");
|
|
||||||
MSG(" Show help message and LZO/snappy support status (enabled/disabled).\n");
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
From 4b0bed3523a5f6c2c428d9dab3d27d4572207d52 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
From: Pratyush Anand <panand@redhat.com>
|
|
||||||
Date: Thu, 2 Mar 2017 17:37:08 +0900
|
|
||||||
Subject: [PATCH 1/7] [PATCH v3 1/7] show_mem_usage(): calculate page offset
|
|
||||||
after elf load
|
|
||||||
|
|
||||||
x86_64 calculated page offset from PT_LOAD headers. Therefore call
|
|
||||||
get_page_offset() after get_elf_loads()
|
|
||||||
|
|
||||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
||||||
---
|
|
||||||
makedumpfile.c | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.1/makedumpfile.c b/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
index e69b6df9a9ee..6942047199de 100644
|
|
||||||
--- a/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
+++ b/makedumpfile-1.6.1/makedumpfile.c
|
|
||||||
@@ -10944,15 +10944,15 @@ int show_mem_usage(void)
|
|
||||||
|
|
||||||
info->dump_level = MAX_DUMP_LEVEL;
|
|
||||||
|
|
||||||
- if (!get_page_offset())
|
|
||||||
- return FALSE;
|
|
||||||
-
|
|
||||||
if (!open_files_for_creating_dumpfile())
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!get_elf_loads(info->fd_memory, info->name_memory))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
+ if (!get_page_offset())
|
|
||||||
+ return FALSE;
|
|
||||||
+
|
|
||||||
if (!get_sys_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
From f1363023b909df886eca5efcb64b78be9b8e6086 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <f1363023b909df886eca5efcb64b78be9b8e6086.1489471500.git.panand@redhat.com>
|
|
||||||
In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand@redhat.com>
|
|
||||||
From: Pratyush Anand <panand@redhat.com>
|
|
||||||
Date: Thu, 2 Mar 2017 17:37:13 +0900
|
|
||||||
Subject: [PATCH 3/7] [PATCH v3 3/7] x86_64: check physical address in PT_LOAD
|
|
||||||
for none direct mapped regions
|
|
||||||
|
|
||||||
A kcore PT_LOAD can have a section from vmalloc region. However,
|
|
||||||
physical address in that header would be invalid (-1) after kernel
|
|
||||||
commit 464920104bf7 (/proc/kcore: update physical address for kcore ram
|
|
||||||
and text). Therefore, check for valid physical address while calculating
|
|
||||||
page_offset or phys_offset.
|
|
||||||
|
|
||||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
||||||
---
|
|
||||||
arch/x86_64.c | 6 ++++--
|
|
||||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.1/arch/x86_64.c b/makedumpfile-1.6.1/arch/x86_64.c
|
|
||||||
index 893cd516fc8b..e978a36f8878 100644
|
|
||||||
--- a/makedumpfile-1.6.1/arch/x86_64.c
|
|
||||||
+++ b/makedumpfile-1.6.1/arch/x86_64.c
|
|
||||||
@@ -41,7 +41,8 @@ get_page_offset_x86_64(void)
|
|
||||||
unsigned long long virt_start;
|
|
||||||
|
|
||||||
for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
|
|
||||||
- if (virt_start < __START_KERNEL_map) {
|
|
||||||
+ if (virt_start < __START_KERNEL_map
|
|
||||||
+ && phys_start != NOT_PADDR) {
|
|
||||||
info->page_offset = virt_start - phys_start;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
@@ -76,7 +77,8 @@ get_phys_base_x86_64(void)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
|
|
||||||
- if (virt_start >= __START_KERNEL_map) {
|
|
||||||
+ if (virt_start >= __START_KERNEL_map
|
|
||||||
+ && phys_start != NOT_PADDR) {
|
|
||||||
|
|
||||||
info->phys_base = phys_start -
|
|
||||||
(virt_start & ~(__START_KERNEL_map));
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
From fe667ab0567d5a5631809db2ce3476c83d312d21 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <fe667ab0567d5a5631809db2ce3476c83d312d21.1489504794.git.panand@redhat.com>
|
|
||||||
From: Pratyush Anand <panand@redhat.com>
|
|
||||||
Date: Tue, 14 Mar 2017 17:59:22 +0530
|
|
||||||
Subject: [PATCH] x86/x86_64: Fix format warning with die()
|
|
||||||
|
|
||||||
Fedora koji uses gcc version 7.0.1-0.12.fc27, and it generates a build
|
|
||||||
warning
|
|
||||||
|
|
||||||
kexec/arch/i386/kexec-elf-x86.c:299:3: error: format not a string
|
|
||||||
literal and no format arguments [-Werror=format-security]
|
|
||||||
die(error_msg);
|
|
||||||
^~~
|
|
||||||
cc1: some warnings being treated as errors
|
|
||||||
|
|
||||||
error_msg can have a format specifier as well in string. In such cases,
|
|
||||||
if there is no other arguments for the format variable then code will
|
|
||||||
try to access a non existing argument. Therefore, use 1st argument as
|
|
||||||
format specifier for string print and pass error_msg as the string to be
|
|
||||||
printed.
|
|
||||||
|
|
||||||
While doing that,also use const qualifier before "char *error_msg".
|
|
||||||
|
|
||||||
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
||||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
||||||
---
|
|
||||||
kexec/arch/i386/kexec-elf-x86.c | 4 ++--
|
|
||||||
kexec/arch/x86_64/kexec-elf-x86_64.c | 4 ++--
|
|
||||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
|
|
||||||
index de00dcb869d7..fedf031cdf4a 100644
|
|
||||||
--- a/kexec/arch/i386/kexec-elf-x86.c
|
|
||||||
+++ b/kexec/arch/i386/kexec-elf-x86.c
|
|
||||||
@@ -91,7 +91,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
|
|
||||||
char *command_line = NULL, *modified_cmdline = NULL;
|
|
||||||
const char *append = NULL;
|
|
||||||
char *tmp_cmdline = NULL;
|
|
||||||
- char *error_msg = NULL;
|
|
||||||
+ const char *error_msg = NULL;
|
|
||||||
int result;
|
|
||||||
int command_line_len;
|
|
||||||
const char *ramdisk;
|
|
||||||
@@ -296,6 +296,6 @@ out:
|
|
||||||
free(command_line);
|
|
||||||
free(modified_cmdline);
|
|
||||||
if (error_msg)
|
|
||||||
- die(error_msg);
|
|
||||||
+ die("%s", error_msg);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c
|
|
||||||
index ae6569220bc8..ad2231193eb1 100644
|
|
||||||
--- a/kexec/arch/x86_64/kexec-elf-x86_64.c
|
|
||||||
+++ b/kexec/arch/x86_64/kexec-elf-x86_64.c
|
|
||||||
@@ -99,7 +99,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
|
|
||||||
#define ARG_STYLE_NONE 2
|
|
||||||
int opt;
|
|
||||||
int result = 0;
|
|
||||||
- char *error_msg = NULL;
|
|
||||||
+ const char *error_msg = NULL;
|
|
||||||
|
|
||||||
/* See options.h and add any new options there too! */
|
|
||||||
static const struct option options[] = {
|
|
||||||
@@ -276,6 +276,6 @@ out:
|
|
||||||
free(command_line);
|
|
||||||
free(modified_cmdline);
|
|
||||||
if (error_msg)
|
|
||||||
- die(error_msg);
|
|
||||||
+ die("%s", error_msg);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
Version: 2.0.15
|
Version: 2.0.15
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Summary: The kexec/kdump userspace component
|
Summary: The kexec/kdump userspace component
|
||||||
|
@ -13,7 +13,7 @@ Source4: kdump.sysconfig.i386
|
||||||
Source5: kdump.sysconfig.ppc64
|
Source5: kdump.sysconfig.ppc64
|
||||||
Source7: mkdumprd
|
Source7: mkdumprd
|
||||||
Source8: kdump.conf
|
Source8: kdump.conf
|
||||||
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.1/makedumpfile-1.6.1.tar.gz
|
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.2/makedumpfile-1.6.2.tar.gz
|
||||||
Source10: kexec-kdump-howto.txt
|
Source10: kexec-kdump-howto.txt
|
||||||
Source12: mkdumprd.8
|
Source12: mkdumprd.8
|
||||||
Source14: 98-kexec.rules
|
Source14: 98-kexec.rules
|
||||||
|
@ -85,13 +85,6 @@ Obsoletes: diskdumputils netdump kexec-tools-eppic
|
||||||
# Patches 601 onward are generic patches
|
# Patches 601 onward are generic patches
|
||||||
#
|
#
|
||||||
Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
|
Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
|
||||||
Patch603: kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch
|
|
||||||
Patch604: kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch
|
|
||||||
Patch605: kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch
|
|
||||||
Patch606: kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch
|
|
||||||
Patch607: kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch
|
|
||||||
Patch608: kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch
|
|
||||||
Patch609: kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch
|
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
|
@ -116,13 +109,6 @@ tar -z -x -v -f %{SOURCE19}
|
||||||
tar -z -x -v -f %{SOURCE23}
|
tar -z -x -v -f %{SOURCE23}
|
||||||
|
|
||||||
%patch601 -p1
|
%patch601 -p1
|
||||||
%patch603 -p1
|
|
||||||
%patch604 -p1
|
|
||||||
%patch605 -p1
|
|
||||||
%patch606 -p1
|
|
||||||
%patch607 -p1
|
|
||||||
%patch608 -p1
|
|
||||||
%patch609 -p1
|
|
||||||
|
|
||||||
%ifarch ppc
|
%ifarch ppc
|
||||||
%define archdef ARCH=ppc
|
%define archdef ARCH=ppc
|
||||||
|
@ -149,8 +135,8 @@ cp %{SOURCE27} .
|
||||||
make
|
make
|
||||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||||
make -C eppic/libeppic
|
make -C eppic/libeppic
|
||||||
make -C makedumpfile-1.6.1 LINKTYPE=dynamic USELZO=on USESNAPPY=on
|
make -C makedumpfile-1.6.2 LINKTYPE=dynamic USELZO=on USESNAPPY=on
|
||||||
make -C makedumpfile-1.6.1 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
|
make -C makedumpfile-1.6.2 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
|
||||||
%endif
|
%endif
|
||||||
make -C kdump-anaconda-addon/po
|
make -C kdump-anaconda-addon/po
|
||||||
|
|
||||||
|
@ -191,13 +177,13 @@ install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
|
||||||
install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
|
install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
|
||||||
|
|
||||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||||
install -m 755 makedumpfile-1.6.1/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile
|
install -m 755 makedumpfile-1.6.2/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile
|
||||||
install -m 644 makedumpfile-1.6.1/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
|
install -m 644 makedumpfile-1.6.2/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
|
||||||
install -m 644 makedumpfile-1.6.1/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
|
install -m 644 makedumpfile-1.6.2/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
|
||||||
install -m 644 makedumpfile-1.6.1/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
|
install -m 644 makedumpfile-1.6.2/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
|
||||||
install -m 755 makedumpfile-1.6.1/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
|
install -m 755 makedumpfile-1.6.2/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
||||||
install -m 644 makedumpfile-1.6.1/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
install -m 644 makedumpfile-1.6.2/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
||||||
%endif
|
%endif
|
||||||
make -C kdump-anaconda-addon install DESTDIR=$RPM_BUILD_ROOT
|
make -C kdump-anaconda-addon install DESTDIR=$RPM_BUILD_ROOT
|
||||||
%find_lang kdump-anaconda-addon
|
%find_lang kdump-anaconda-addon
|
||||||
|
@ -327,6 +313,9 @@ done
|
||||||
%doc
|
%doc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jul 28 2017 Dave Young <dyoung@redhat.com> - 2.0.15-6
|
||||||
|
- update upstream makedumpfile 1.6.2
|
||||||
|
|
||||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-5
|
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-5
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||||
|
|
||||||
|
|
1
sources
1
sources
|
@ -3,3 +3,4 @@ SHA512 (kexec-tools-2.0.14.tar.xz) = 8c1f9d1f4bb69a621961d45091f9c8349535ae69b80
|
||||||
SHA512 (kdump-anaconda-addon-005-25-g2a4398f.tar.gz) = 0ce8602607a8d781e1804973e6affef1ed3dce729bb1a5525b2a8129f28bcb88713f6e8be5e3f41151223518096f7eed33dd3ea0e63ac7dc338b21fb78664e7e
|
SHA512 (kdump-anaconda-addon-005-25-g2a4398f.tar.gz) = 0ce8602607a8d781e1804973e6affef1ed3dce729bb1a5525b2a8129f28bcb88713f6e8be5e3f41151223518096f7eed33dd3ea0e63ac7dc338b21fb78664e7e
|
||||||
SHA512 (makedumpfile-1.6.1.tar.gz) = fd343e8117e38f9fd608f914297dfe54e0b677733db1871db5824d8ca549e6b8709ae5df6ec82362c100c6d8f35815c39c48e0c87395a30e6305aba7d11c8708
|
SHA512 (makedumpfile-1.6.1.tar.gz) = fd343e8117e38f9fd608f914297dfe54e0b677733db1871db5824d8ca549e6b8709ae5df6ec82362c100c6d8f35815c39c48e0c87395a30e6305aba7d11c8708
|
||||||
SHA512 (kexec-tools-2.0.15.tar.xz) = 0bddf31b9bb0e203b813d820e1e248974c2d62cb388dfaf4f2f4971f764cc71e54edbaeaeb663c15d6fa06574beceb87d9ffd7d822ac6699d86c54645096e7e9
|
SHA512 (kexec-tools-2.0.15.tar.xz) = 0bddf31b9bb0e203b813d820e1e248974c2d62cb388dfaf4f2f4971f764cc71e54edbaeaeb663c15d6fa06574beceb87d9ffd7d822ac6699d86c54645096e7e9
|
||||||
|
SHA512 (makedumpfile-1.6.2.tar.gz) = 436a787c9da7f0278289b22489936f0a06eb0cc558792245c513e4a5ad733057a9d0fb9c5e2e7ed887b1bdd128f9f016ce9c263f912dcc8636fd82637fc25658
|
||||||
|
|
Loading…
Reference in New Issue