[PATCH v3] kdump: Introduce 'force_no_rebuild' option
by Bhupesh Sharma
This patch introduces the 'force_no_rebuild' option
inside the 'kdump.conf' and its handling inside the 'kdumpctl'
script.
There might be several use cases, where a system admin
decides that he doesn't need to rebuild the kdump initrd
and wants to use an existing version of the same. In such cases,
he can set the 'force_no_rebuild' option inside 'kdump.conf'
to 1, to force the 'kdumpctl' script not to rebuild the kdump
initrd.
Signed-off-by: Bhupesh Sharma <bhsharma(a)redhat.com>
---
kdump.conf | 8 ++++++++
kdump.conf.5 | 10 ++++++++++
kdumpctl | 26 +++++++++++++++++++++++---
3 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/kdump.conf b/kdump.conf
index ebf9587a6522..1e24e1bd9d61 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -115,6 +115,13 @@
# Specify 1 to force rebuilding kdump initrd every time when kdump
# service starts.
#
+# force_no_rebuild <0 | 1>
+# - By default, kdump initrd will be rebuilt when necessary.
+# Specify 1 to bypass rebuilding of kdump initrd.
+#
+# force_no_rebuild and force_rebuild options are mutually
+# exclusive and they should not be set to 1 simultaneously.
+#
# override_resettable <0 | 1>
# - Usually an unresettable block device can't be a dump target.
# Specifying 1 when you want to dump even though the block
@@ -150,6 +157,7 @@ core_collector makedumpfile -l --message-level 1 -d 31
#extra_modules gfs2
#default shell
#force_rebuild 1
+#force_no_rebuild 1
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
#fence_kdump_args -p 7410 -f auto -c 0 -i 10
#fence_kdump_nodes node1 node2
diff --git a/kdump.conf.5 b/kdump.conf.5
index ca427699be53..b581964b906e 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -166,6 +166,16 @@ By default, kdump initrd will only be rebuilt when necessary.
Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
.RE
+.B force_no_rebuild <0 | 1>
+.RS
+By default, kdump initrd will be rebuilt when necessary.
+Specify 1 to bypass rebuilding of kdump initrd.
+
+.PP
+force_no_rebuild and force_rebuild options are mutually exclusive and
+they should not be set to 1 simultaneously.
+.RE
+
.B override_resettable <0 | 1>
.RS
Usually an unresettable block device can't be a dump target. Specifying 1 means
diff --git a/kdumpctl b/kdumpctl
index 4d68be0c292d..ec8fae1e5b5f 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -354,7 +354,7 @@ check_config()
case "$config_opt" in
\#* | "")
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
[ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt."
return 1;
@@ -582,8 +582,6 @@ check_system_modified()
{
local ret
- [[ -f $TARGET_INITRD ]] || return 1
-
check_files_modified
ret=$?
if [ $ret -ne 0 ]; then
@@ -609,6 +607,7 @@ check_rebuild()
{
local extra_modules
local _force_rebuild force_rebuild="0"
+ local _force_no_rebuild force_no_rebuild="0"
local ret system_modified="0"
check_boot_dir
@@ -625,6 +624,17 @@ check_rebuild()
return 1
fi
+ [[ -f $TARGET_INITRD ]] || return 1
+
+ _force_no_rebuild=`grep ^force_no_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
+ if [ $? -eq 0 ]; then
+ force_no_rebuild=`echo $_force_no_rebuild | cut -d' ' -f2`
+ if [ "$force_no_rebuild" != "0" ] && [ "$force_no_rebuild" != "1" ];then
+ echo "Error: force_no_rebuild value is invalid"
+ return 1
+ fi
+ fi
+
_force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
if [ $? -eq 0 ]; then
force_rebuild=`echo $_force_rebuild | cut -d' ' -f2`
@@ -634,6 +644,16 @@ check_rebuild()
fi
fi
+ if [[ "$force_no_rebuild" == "1" && "$force_rebuild" == "1" ]]; then
+ echo "Error: force_rebuild and force_no_rebuild are enabled simultaneously in kdump.conf"
+ exit 1
+ fi
+
+ # Will not rebuild kdump initrd
+ if [ "$force_no_rebuild" == "1" ]; then
+ return 0
+ fi
+
#will rebuild every time if extra_modules are specified
extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
[ -n "$extra_modules" ] && force_rebuild="1"
--
2.7.4
7 years
[PATCH FC25 v2] kexec-tools fixes for 4.9+ kernels
by Pratyush Anand
Resolves: bz1440587
https://bugzilla.redhat.com/show_bug.cgi?id=1440587
Current fc25 kernel version is v4.10.
4.9+ kernel has phys_base virtual address in vmcoreinfo rather it's
symbol address. Therefore, backport makedumpfile patch "Adapt code to
get value of phys_base"
While doing that, also backport "kexec-tools/x86:
get_kernel_vaddr_and_size off-by-one fix" to fix following with kexec
-p:
"Can't find kernel text map area from kcore"
v4.11 kernel will have another fix for kcore ( 464920104bf7 /proc/kcore:
update physical address for kcore ram and text)which allows only valid
physical address to pass in PT_LOAD.With that fix in kernel, kexec-tools
may not work always until we backport "build_mem_phdrs(): check if
p_paddr is invalid" from kexec-tools. Since there does not seem any side
effect of taking that kexec-tools commit even for v4.10 because
"phdr->p_paddr != (unsigned long long)-1" will always be TRUE for them,
therefore we take that kexec-tools patch as well.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
Build info: https://koji.fedoraproject.org/koji/taskinfo?taskID=18908776
FC25 crash does not like the vmcore, however crash/master worked fine.
Probably, FC25 crash will need to backport atleast following commit:
commit 24a696228c56fd4354d29abe05b206373e0c8bfb
Fix for Linux 4.10 commit 7fd8329ba502ef76dd91db561c7aed696b2c7720
"taint/module: Clean up global and module taint flags handling".
v1 -> v2:
v1 missed to apply Patchc611 in spec file. Since that patch does
not affect kernel < v4.11, so it had worked. However, v2 fixes that as we
talk about it in commit log.
...ild_mem_phdrs-check-if-p_paddr-is-invalid.patch | 43 +++++++
...-x86-get_kernel_vaddr_and_size-off-by-one.patch | 43 +++++++
...file-Adapt-code-to-get-value-of-phys_base.patch | 126 +++++++++++++++++++++
kexec-tools.spec | 6 +
4 files changed, 218 insertions(+)
create mode 100644 kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
create mode 100644 kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
create mode 100644 kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
diff --git a/kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch b/kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
new file mode 100644
index 000000000000..4d4f34361b45
--- /dev/null
+++ b/kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
@@ -0,0 +1,43 @@
+From ed15ba1b9977e506637ff1697821d97127b2c919 Mon Sep 17 00:00:00 2001
+Message-Id: <ed15ba1b9977e506637ff1697821d97127b2c919.1491794671.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)redhat.com>
+Acked-by: Dave Young <dyoung(a)redhat.com>
+Signed-off-by: Simon Horman <horms(a)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
+
diff --git a/kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch b/kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
new file mode 100644
index 000000000000..c707c8ec0e07
--- /dev/null
+++ b/kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
@@ -0,0 +1,43 @@
+From dbb99d938810b60035122a1bcc68c4d585a0e57f Mon Sep 17 00:00:00 2001
+Message-Id: <dbb99d938810b60035122a1bcc68c4d585a0e57f.1491799333.git.panand(a)redhat.com>
+From: Dave Young <dyoung(a)redhat.com>
+Date: Thu, 8 Dec 2016 10:52:22 +0800
+Subject: [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
+
+I got below error while tesing kexec -p:
+"Can't find kernel text map area from kcore"
+
+The case is the pt_load start addr was same as stext_sym. The checking
+code should really be saddr <= stext_sym so that the right pt_load area
+includes stext_sym can be matched.
+
+This was not reported by people previously because it will fail over to
+use hardcode X86_64__START_KERNEL_map to match the pt_load areas again
+in later code and it sometimes succeeds because of kernel address
+randomization.
+
+With this change according to my test stext_sym checking can garantee
+falling into right pt_load area if we get correct stext_sym.
+
+Signed-off-by: Dave Young <dyoung(a)redhat.com>
+Signed-off-by: Simon Horman <horms(a)verge.net.au>
+---
+ kexec/arch/i386/crashdump-x86.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
+index ab833d416320..88aeee33572b 100644
+--- a/kexec/arch/i386/crashdump-x86.c
++++ b/kexec/arch/i386/crashdump-x86.c
+@@ -205,7 +205,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
+ unsigned long long size;
+
+ /* Look for kernel text mapping header. */
+- if (saddr < stext_sym && eaddr > stext_sym) {
++ if (saddr <= stext_sym && eaddr > stext_sym) {
+ saddr = _ALIGN_DOWN(saddr, X86_64_KERN_VADDR_ALIGN);
+ elf_info->kern_vaddr_start = saddr;
+ size = eaddr - saddr;
+--
+2.9.3
+
diff --git a/kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch b/kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
new file mode 100644
index 000000000000..c0b16655dc4d
--- /dev/null
+++ b/kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
@@ -0,0 +1,126 @@
+From acdbb1d6aee9207ccdea697326574e8d6142cd73 Mon Sep 17 00:00:00 2001
+Message-Id: <acdbb1d6aee9207ccdea697326574e8d6142cd73.1491806706.git.panand(a)redhat.com>
+From: Baoquan He <bhe(a)redhat.com>
+Date: Thu, 10 Nov 2016 15:30:57 +0900
+Subject: [PATCH] [PATCH v2 1/2] Adapt code to get value of phys_base
+
+* Required for kernel 4.9
+
+Kernel code only exports virtual address of phys_base now and it's helpless
+for Crash and Makedumpfile. Below patch which changes code to export value
+of phys_base has been posted to upstream. So adapt code to get it.
+
+kexec: Change to export the value of phys_base instead of symbol address
+marc.info/?l=linux-kernel&m=147856863629624&w=2
+
+Signed-off-by: Baoquan He <bhe(a)redhat.com>
+---
+ arch/x86_64.c | 12 +++++-------
+ makedumpfile.c | 5 ++---
+ makedumpfile.h | 2 +-
+ 3 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/makedumpfile-1.6.0/arch/x86_64.c b/makedumpfile-1.6.0/arch/x86_64.c
+index 3ef33ae4ef2d..010ea10e6fa8 100644
+--- a/makedumpfile-1.6.0/arch/x86_64.c
++++ b/makedumpfile-1.6.0/arch/x86_64.c
+@@ -62,6 +62,10 @@ get_phys_base_x86_64(void)
+ * Get the relocatable offset
+ */
+ info->phys_base = 0; /* default/traditional */
++ if (NUMBER(phys_base) != NOT_FOUND_NUMBER) {
++ info->phys_base = NUMBER(phys_base);
++ return TRUE;
++ }
+
+ for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
+ if (virt_start >= __START_KERNEL_map) {
+@@ -187,12 +191,6 @@ vtop4_x86_64(unsigned long vaddr)
+ {
+ unsigned long page_dir, pml4, pgd_paddr, pgd_pte, pmd_paddr, pmd_pte;
+ unsigned long pte_paddr, pte;
+- unsigned long phys_base;
+-
+- if (SYMBOL(phys_base) != NOT_FOUND_SYMBOL)
+- phys_base = info->phys_base;
+- else
+- phys_base = 0;
+
+ if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) {
+ ERRMSG("Can't get the symbol of init_level4_pgt.\n");
+@@ -202,7 +200,7 @@ vtop4_x86_64(unsigned long vaddr)
+ /*
+ * Get PGD.
+ */
+- page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + phys_base;
++ page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + info->phys_base;
+ page_dir += pml4_index(vaddr) * sizeof(unsigned long);
+ if (!readmem(PADDR, page_dir, &pml4, sizeof pml4)) {
+ ERRMSG("Can't get pml4 (page_dir:%lx).\n", page_dir);
+diff --git a/makedumpfile-1.6.0/makedumpfile.c b/makedumpfile-1.6.0/makedumpfile.c
+index b916dfb8b189..a3f711e3e9bf 100644
+--- a/makedumpfile-1.6.0/makedumpfile.c
++++ b/makedumpfile-1.6.0/makedumpfile.c
+@@ -1507,7 +1507,6 @@ get_symbol_info(void)
+ SYMBOL_INIT(init_level4_pgt, "init_level4_pgt");
+ SYMBOL_INIT(vmlist, "vmlist");
+ SYMBOL_INIT(vmap_area_list, "vmap_area_list");
+- SYMBOL_INIT(phys_base, "phys_base");
+ SYMBOL_INIT(node_online_map, "node_online_map");
+ SYMBOL_INIT(node_states, "node_states");
+ SYMBOL_INIT(node_memblk, "node_memblk");
+@@ -2134,7 +2133,6 @@ write_vmcoreinfo_data(void)
+ WRITE_SYMBOL("init_level4_pgt", init_level4_pgt);
+ WRITE_SYMBOL("vmlist", vmlist);
+ WRITE_SYMBOL("vmap_area_list", vmap_area_list);
+- WRITE_SYMBOL("phys_base", phys_base);
+ WRITE_SYMBOL("node_online_map", node_online_map);
+ WRITE_SYMBOL("node_states", node_states);
+ WRITE_SYMBOL("node_data", node_data);
+@@ -2261,6 +2259,7 @@ write_vmcoreinfo_data(void)
+
+ WRITE_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
+ WRITE_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
++ WRITE_NUMBER("phys_base", phys_base);
+
+ WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
+
+@@ -2488,7 +2487,6 @@ read_vmcoreinfo(void)
+ READ_SYMBOL("init_level4_pgt", init_level4_pgt);
+ READ_SYMBOL("vmlist", vmlist);
+ READ_SYMBOL("vmap_area_list", vmap_area_list);
+- READ_SYMBOL("phys_base", phys_base);
+ READ_SYMBOL("node_online_map", node_online_map);
+ READ_SYMBOL("node_states", node_states);
+ READ_SYMBOL("node_data", node_data);
+@@ -2609,6 +2607,7 @@ read_vmcoreinfo(void)
+
+ READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
+ READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
++ READ_NUMBER("phys_base", phys_base);
+
+ READ_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
+
+diff --git a/makedumpfile-1.6.0/makedumpfile.h b/makedumpfile-1.6.0/makedumpfile.h
+index 338c651388f0..422b6bed102b 100644
+--- a/makedumpfile-1.6.0/makedumpfile.h
++++ b/makedumpfile-1.6.0/makedumpfile.h
+@@ -1394,7 +1394,6 @@ struct symbol_table {
+ unsigned long long init_level4_pgt;
+ unsigned long long vmlist;
+ unsigned long long vmap_area_list;
+- unsigned long long phys_base;
+ unsigned long long node_online_map;
+ unsigned long long node_states;
+ unsigned long long node_memblk;
+@@ -1718,6 +1717,7 @@ struct number_table {
+ long SECTION_SIZE_BITS;
+ long MAX_PHYSMEM_BITS;
+ long HUGETLB_PAGE_DTOR;
++ long phys_base;
+ };
+
+ struct srcfile_table {
+--
+2.9.3
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 3f9f9ae668fb..71c2979563c7 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -97,6 +97,9 @@ Patch605: kexec-tools-2.0.13-makedumpfile-x86-64-translate-all-VA-to-PA-using-pa
Patch606: kexec-tools-2.0.13-makedumpfile-x86-64-kill-is-vmalloc-addr-x86-64.patch
Patch607: kexec-tools-2.0.13-makedumpfile-x86-64-kill-some-unused-initialization.patch
Patch608: kexec-tools-2.0.13-makedumpfile-x86_64-fix-page_offset-calculation.patch
+Patch609: kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
+Patch610: kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
+Patch611: kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -134,6 +137,9 @@ tar -z -x -v -f %{SOURCE23}
%patch606 -p1
%patch607 -p1
%patch608 -p1
+%patch609 -p1
+%patch610 -p1
+%patch611 -p1
%ifarch ppc
%define archdef ARCH=ppc
--
2.9.3
7 years
[PATCH FC25] kexec-tools fixes for 4.9+ kernels
by Pratyush Anand
Resolves: bz1440587
https://bugzilla.redhat.com/show_bug.cgi?id=1440587
Current fc25 kernel version is v4.10.
4.9+ kernel has phys_base virtual address in vmcoreinfo rather it's
symbol address. Therefore, backport makedumpfile patch "Adapt code to
get value of phys_base"
While doing that, also backport "kexec-tools/x86:
get_kernel_vaddr_and_size off-by-one fix" to fix following with kexec
-p:
"Can't find kernel text map area from kcore"
v4.11 kernel will have another fix for kcore ( 464920104bf7 /proc/kcore:
update physical address for kcore ram and text)which allows only valid
physical address to pass in PT_LOAD.With that fix in kernel, kexec-tools
may not work always until we backport "build_mem_phdrs(): check if
p_paddr is invalid" from kexec-tools. Since there does not seem any side
effect of taking that kexec-tools commit even for v4.10 because
"phdr->p_paddr != (unsigned long long)-1" will always be TRUE for them,
therefore we take that kexec-tools patch as well.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
...ild_mem_phdrs-check-if-p_paddr-is-invalid.patch | 43 +++++++
...-x86-get_kernel_vaddr_and_size-off-by-one.patch | 43 +++++++
...file-Adapt-code-to-get-value-of-phys_base.patch | 126 +++++++++++++++++++++
kexec-tools.spec | 5 +
4 files changed, 217 insertions(+)
create mode 100644 kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
create mode 100644 kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
create mode 100644 kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
diff --git a/kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch b/kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
new file mode 100644
index 000000000000..4d4f34361b45
--- /dev/null
+++ b/kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
@@ -0,0 +1,43 @@
+From ed15ba1b9977e506637ff1697821d97127b2c919 Mon Sep 17 00:00:00 2001
+Message-Id: <ed15ba1b9977e506637ff1697821d97127b2c919.1491794671.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)redhat.com>
+Acked-by: Dave Young <dyoung(a)redhat.com>
+Signed-off-by: Simon Horman <horms(a)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
+
diff --git a/kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch b/kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
new file mode 100644
index 000000000000..c707c8ec0e07
--- /dev/null
+++ b/kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
@@ -0,0 +1,43 @@
+From dbb99d938810b60035122a1bcc68c4d585a0e57f Mon Sep 17 00:00:00 2001
+Message-Id: <dbb99d938810b60035122a1bcc68c4d585a0e57f.1491799333.git.panand(a)redhat.com>
+From: Dave Young <dyoung(a)redhat.com>
+Date: Thu, 8 Dec 2016 10:52:22 +0800
+Subject: [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
+
+I got below error while tesing kexec -p:
+"Can't find kernel text map area from kcore"
+
+The case is the pt_load start addr was same as stext_sym. The checking
+code should really be saddr <= stext_sym so that the right pt_load area
+includes stext_sym can be matched.
+
+This was not reported by people previously because it will fail over to
+use hardcode X86_64__START_KERNEL_map to match the pt_load areas again
+in later code and it sometimes succeeds because of kernel address
+randomization.
+
+With this change according to my test stext_sym checking can garantee
+falling into right pt_load area if we get correct stext_sym.
+
+Signed-off-by: Dave Young <dyoung(a)redhat.com>
+Signed-off-by: Simon Horman <horms(a)verge.net.au>
+---
+ kexec/arch/i386/crashdump-x86.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
+index ab833d416320..88aeee33572b 100644
+--- a/kexec/arch/i386/crashdump-x86.c
++++ b/kexec/arch/i386/crashdump-x86.c
+@@ -205,7 +205,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
+ unsigned long long size;
+
+ /* Look for kernel text mapping header. */
+- if (saddr < stext_sym && eaddr > stext_sym) {
++ if (saddr <= stext_sym && eaddr > stext_sym) {
+ saddr = _ALIGN_DOWN(saddr, X86_64_KERN_VADDR_ALIGN);
+ elf_info->kern_vaddr_start = saddr;
+ size = eaddr - saddr;
+--
+2.9.3
+
diff --git a/kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch b/kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
new file mode 100644
index 000000000000..c0b16655dc4d
--- /dev/null
+++ b/kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
@@ -0,0 +1,126 @@
+From acdbb1d6aee9207ccdea697326574e8d6142cd73 Mon Sep 17 00:00:00 2001
+Message-Id: <acdbb1d6aee9207ccdea697326574e8d6142cd73.1491806706.git.panand(a)redhat.com>
+From: Baoquan He <bhe(a)redhat.com>
+Date: Thu, 10 Nov 2016 15:30:57 +0900
+Subject: [PATCH] [PATCH v2 1/2] Adapt code to get value of phys_base
+
+* Required for kernel 4.9
+
+Kernel code only exports virtual address of phys_base now and it's helpless
+for Crash and Makedumpfile. Below patch which changes code to export value
+of phys_base has been posted to upstream. So adapt code to get it.
+
+kexec: Change to export the value of phys_base instead of symbol address
+marc.info/?l=linux-kernel&m=147856863629624&w=2
+
+Signed-off-by: Baoquan He <bhe(a)redhat.com>
+---
+ arch/x86_64.c | 12 +++++-------
+ makedumpfile.c | 5 ++---
+ makedumpfile.h | 2 +-
+ 3 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/makedumpfile-1.6.0/arch/x86_64.c b/makedumpfile-1.6.0/arch/x86_64.c
+index 3ef33ae4ef2d..010ea10e6fa8 100644
+--- a/makedumpfile-1.6.0/arch/x86_64.c
++++ b/makedumpfile-1.6.0/arch/x86_64.c
+@@ -62,6 +62,10 @@ get_phys_base_x86_64(void)
+ * Get the relocatable offset
+ */
+ info->phys_base = 0; /* default/traditional */
++ if (NUMBER(phys_base) != NOT_FOUND_NUMBER) {
++ info->phys_base = NUMBER(phys_base);
++ return TRUE;
++ }
+
+ for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) {
+ if (virt_start >= __START_KERNEL_map) {
+@@ -187,12 +191,6 @@ vtop4_x86_64(unsigned long vaddr)
+ {
+ unsigned long page_dir, pml4, pgd_paddr, pgd_pte, pmd_paddr, pmd_pte;
+ unsigned long pte_paddr, pte;
+- unsigned long phys_base;
+-
+- if (SYMBOL(phys_base) != NOT_FOUND_SYMBOL)
+- phys_base = info->phys_base;
+- else
+- phys_base = 0;
+
+ if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) {
+ ERRMSG("Can't get the symbol of init_level4_pgt.\n");
+@@ -202,7 +200,7 @@ vtop4_x86_64(unsigned long vaddr)
+ /*
+ * Get PGD.
+ */
+- page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + phys_base;
++ page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + info->phys_base;
+ page_dir += pml4_index(vaddr) * sizeof(unsigned long);
+ if (!readmem(PADDR, page_dir, &pml4, sizeof pml4)) {
+ ERRMSG("Can't get pml4 (page_dir:%lx).\n", page_dir);
+diff --git a/makedumpfile-1.6.0/makedumpfile.c b/makedumpfile-1.6.0/makedumpfile.c
+index b916dfb8b189..a3f711e3e9bf 100644
+--- a/makedumpfile-1.6.0/makedumpfile.c
++++ b/makedumpfile-1.6.0/makedumpfile.c
+@@ -1507,7 +1507,6 @@ get_symbol_info(void)
+ SYMBOL_INIT(init_level4_pgt, "init_level4_pgt");
+ SYMBOL_INIT(vmlist, "vmlist");
+ SYMBOL_INIT(vmap_area_list, "vmap_area_list");
+- SYMBOL_INIT(phys_base, "phys_base");
+ SYMBOL_INIT(node_online_map, "node_online_map");
+ SYMBOL_INIT(node_states, "node_states");
+ SYMBOL_INIT(node_memblk, "node_memblk");
+@@ -2134,7 +2133,6 @@ write_vmcoreinfo_data(void)
+ WRITE_SYMBOL("init_level4_pgt", init_level4_pgt);
+ WRITE_SYMBOL("vmlist", vmlist);
+ WRITE_SYMBOL("vmap_area_list", vmap_area_list);
+- WRITE_SYMBOL("phys_base", phys_base);
+ WRITE_SYMBOL("node_online_map", node_online_map);
+ WRITE_SYMBOL("node_states", node_states);
+ WRITE_SYMBOL("node_data", node_data);
+@@ -2261,6 +2259,7 @@ write_vmcoreinfo_data(void)
+
+ WRITE_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
+ WRITE_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
++ WRITE_NUMBER("phys_base", phys_base);
+
+ WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
+
+@@ -2488,7 +2487,6 @@ read_vmcoreinfo(void)
+ READ_SYMBOL("init_level4_pgt", init_level4_pgt);
+ READ_SYMBOL("vmlist", vmlist);
+ READ_SYMBOL("vmap_area_list", vmap_area_list);
+- READ_SYMBOL("phys_base", phys_base);
+ READ_SYMBOL("node_online_map", node_online_map);
+ READ_SYMBOL("node_states", node_states);
+ READ_SYMBOL("node_data", node_data);
+@@ -2609,6 +2607,7 @@ read_vmcoreinfo(void)
+
+ READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE);
+ READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
++ READ_NUMBER("phys_base", phys_base);
+
+ READ_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
+
+diff --git a/makedumpfile-1.6.0/makedumpfile.h b/makedumpfile-1.6.0/makedumpfile.h
+index 338c651388f0..422b6bed102b 100644
+--- a/makedumpfile-1.6.0/makedumpfile.h
++++ b/makedumpfile-1.6.0/makedumpfile.h
+@@ -1394,7 +1394,6 @@ struct symbol_table {
+ unsigned long long init_level4_pgt;
+ unsigned long long vmlist;
+ unsigned long long vmap_area_list;
+- unsigned long long phys_base;
+ unsigned long long node_online_map;
+ unsigned long long node_states;
+ unsigned long long node_memblk;
+@@ -1718,6 +1717,7 @@ struct number_table {
+ long SECTION_SIZE_BITS;
+ long MAX_PHYSMEM_BITS;
+ long HUGETLB_PAGE_DTOR;
++ long phys_base;
+ };
+
+ struct srcfile_table {
+--
+2.9.3
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 3f9f9ae668fb..091eb787bcb0 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -97,6 +97,9 @@ Patch605: kexec-tools-2.0.13-makedumpfile-x86-64-translate-all-VA-to-PA-using-pa
Patch606: kexec-tools-2.0.13-makedumpfile-x86-64-kill-is-vmalloc-addr-x86-64.patch
Patch607: kexec-tools-2.0.13-makedumpfile-x86-64-kill-some-unused-initialization.patch
Patch608: kexec-tools-2.0.13-makedumpfile-x86_64-fix-page_offset-calculation.patch
+Patch609: kexec-tools-2.0.13-makedumpfile-Adapt-code-to-get-value-of-phys_base.patch
+Patch610: kexec-tools-2.0.13-kexec-tools-x86-get_kernel_vaddr_and_size-off-by-one.patch
+Patch611: kexec-tools-2.0.13-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -134,6 +137,8 @@ tar -z -x -v -f %{SOURCE23}
%patch606 -p1
%patch607 -p1
%patch608 -p1
+%patch609 -p1
+%patch610 -p1
%ifarch ppc
%define archdef ARCH=ppc
--
2.9.3
7 years
[PATCH v2] kdump: Introduce 'force_no_rebuild' option
by Bhupesh Sharma
This patch introduces the 'force_no_rebuild' option
inside the 'kdump.conf' and its handling inside the 'kdumpctl'
script.
There might be several use cases, where a system admin
decides that he doesn't need to rebuild the kdump initrd
and wants to use an existing version of the same. In such cases,
he can set the 'force_no_rebuild' option inside 'kdump.conf'
to 1, to force the 'kdumpctl' script not to rebuild the kdump
initrd.
Signed-off-by: Bhupesh Sharma <bhsharma(a)redhat.com>
---
Changes since v1:
- Removed extra handling introduced for /boot being RO
kdump.conf | 8 ++++++++
kdump.conf.5 | 10 ++++++++++
kdumpctl | 26 +++++++++++++++++++++++++-
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/kdump.conf b/kdump.conf
index ebf9587a6522..18bbd4ace971 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -115,6 +115,13 @@
# Specify 1 to force rebuilding kdump initrd every time when kdump
# service starts.
#
+# force_no_rebuild <0 | 1>
+# - By default, kdump initrd will only be rebuilt when necessary.
+# Specify 1 to force no rebuild of kdump initrd.
+#
+# force_no_rebuild and force_rebuild options are mutually exclusive and
+# both should not be set to 1 simultaneously.
+#
# override_resettable <0 | 1>
# - Usually an unresettable block device can't be a dump target.
# Specifying 1 when you want to dump even though the block
@@ -150,6 +157,7 @@ core_collector makedumpfile -l --message-level 1 -d 31
#extra_modules gfs2
#default shell
#force_rebuild 1
+#force_no_rebuild 1
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
#fence_kdump_args -p 7410 -f auto -c 0 -i 10
#fence_kdump_nodes node1 node2
diff --git a/kdump.conf.5 b/kdump.conf.5
index ca427699be53..265a67f5d575 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -166,6 +166,16 @@ By default, kdump initrd will only be rebuilt when necessary.
Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
.RE
+.B force_no_rebuild <0 | 1>
+.RS
+By default, kdump initrd will only be rebuilt when necessary.
+Specify 1 to force no rebuild of kdump initrd.
+
+.PP
+force_no_rebuild and force_rebuild options are mutually exclusive and
+both should not be set to 1 simultaneously.
+.RE
+
.B override_resettable <0 | 1>
.RS
Usually an unresettable block device can't be a dump target. Specifying 1 means
diff --git a/kdumpctl b/kdumpctl
index 4d68be0c292d..63bc7adce422 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -335,6 +335,8 @@ restore_default_initrd()
check_config()
{
local nr
+ local force_rebuild=0
+ local force_no_rebuild=0
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
[ $nr -gt 1 ] && {
@@ -354,11 +356,18 @@ check_config()
case "$config_opt" in
\#* | "")
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
[ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt."
return 1;
}
+
+ [[ "$config_opt" == "force_no_rebuild" && "$config_val" == "1" ]] && force_no_rebuild=1
+ [[ "$config_opt" == "force_rebuild" && "$config_val" == "1" ]] && force_rebuild=1
+ [[ "$force_no_rebuild" == "1" && "$force_rebuild" == "1" ]] && {
+ echo "Error: both force_rebuild and force_no_rebuild cannot be set in kdump.conf"
+ return 1;
+ }
;;
net|options|link_delay|disk_timeout|debug_mem_level|blacklist)
echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
@@ -609,6 +618,7 @@ check_rebuild()
{
local extra_modules
local _force_rebuild force_rebuild="0"
+ local _force_no_rebuild force_no_rebuild="0"
local ret system_modified="0"
check_boot_dir
@@ -625,6 +635,15 @@ check_rebuild()
return 1
fi
+ _force_no_rebuild=`grep ^force_no_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
+ if [ $? -eq 0 ]; then
+ force_no_rebuild=`echo $_force_no_rebuild | cut -d' ' -f2`
+ if [ "$force_no_rebuild" != "0" ] && [ "$force_no_rebuild" != "1" ];then
+ echo "Error: force_no_rebuild value is invalid"
+ return 1
+ fi
+ fi
+
_force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
if [ $? -eq 0 ]; then
force_rebuild=`echo $_force_rebuild | cut -d' ' -f2`
@@ -634,6 +653,11 @@ check_rebuild()
fi
fi
+ # Will not rebuild kdump initrd
+ if [ "$force_no_rebuild" == "1" ]; then
+ return 0
+ fi
+
#will rebuild every time if extra_modules are specified
extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
[ -n "$extra_modules" ] && force_rebuild="1"
--
2.7.4
7 years
[PATCH v2 0/3] remove "root=X" for kdump boot
by Xunlei Pang
v1->v2:
- Merge Patch1 into Patch3(now Patch2).
Previously, I've sent out two versions of the targets hook framework.
after discussion we decided to finish "removing root=X" first using
the approach of v1, thus I drafted this patch series. We can continue
the targets hook framework if we really need it in the future.
This patch series focuses on removing "root=X" for kdump, and always
add the dump target(even for root target) via dracut's "--mount ..."
explicitly.
There are two cases we don't remove "root=X":
1) "default dump_to_rootfs" is specified.
2) fadump, becuase fadump can directly switch to root after vmcore dumping,
it needs the same cmdline as 1st kernel.
PATCH1 is a bug fix needed by PATCH2.
PATCH2 is the actual implemenation.
PATCH3 is a natural revert patch due to having PATCH2.
Xunlei Pang (3):
kdumpctl: fix a bug in remove_cmdline_param()
kdumpctl: remove "root=X" for kdump boot
Revert "kdumpctl: filter 'root' kernel parameter when running in live
images"
dracut-module-setup.sh | 24 ++++++++++++------------
kdumpctl | 40 +++++++++++++++++++++++++++++-----------
live-image-kdump-howto.txt | 2 ++
mkdumprd | 29 +++++++++--------------------
4 files changed, 52 insertions(+), 43 deletions(-)
--
1.8.3.1
7 years
[PATCH] kdump: Introduce 'force_no_rebuild' option
by Bhupesh Sharma
This patch introduces the 'force_no_rebuild' option
inside the 'kdump.conf' and its handling inside the 'kdumpctl'
script.
There might be several use cases, where a system admin
decides that he doesn't need to rebuild the kdump initrd
and wants to use an existing version of the same. In such cases,
he can set the 'force_no_rebuild' option inside 'kdump.conf'
to 1, to force the 'kdumpctl' script not to rebuild the kdump
initrd.
This change also handles existing issues with kdump initrd
rebuild, when the /boot (and/or /root) are set as read-only
by a system admin. In such cases, this patch proposes the
following approach to decide as to whether the kdump initrd needs to be
rebuild:
-------------------------------------------------------------------------
| Options |Val| /boot is RO | /boot is WRITABLE |
| | | | |
-------------------------------------------------------------------------
| force_rebuild | 0 |WARN that kdump initrd |kdumpctl decides if|
| | |will not be rebuilt |kdump initrd |
| | |but proceed with |rebuild in required|
| | |loading the kdump | |
| | |kernel | |
-------------------------------------------------------------------------
| force_rebuild | 1 |Bail out with |Proceed with kdump |
| | |an ERROR |initrd rebuild |
-------------------------------------------------------------------------
| force_no_rebuild | 0 |Check force_rebuild value and act |
| | |accordingly |
-------------------------------------------------------------------------
| force_no_rebuild | 1 |WARN that kdump initrd |Do not rebuild |
| | |will not be rebuilt |kdump initrd |
| | |but proceed with | |
| | |loading the kdump | |
| | |kernel | |
-------------------------------------------------------------------------
Signed-off-by: Bhupesh Sharma <bhsharma(a)redhat.com>
---
kdump.conf | 8 +++++
kdump.conf.5 | 10 ++++++
kdumpctl | 100 ++++++++++++++++++++++++++++++++++++++---------------------
3 files changed, 82 insertions(+), 36 deletions(-)
diff --git a/kdump.conf b/kdump.conf
index ebf9587a6522..18bbd4ace971 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -115,6 +115,13 @@
# Specify 1 to force rebuilding kdump initrd every time when kdump
# service starts.
#
+# force_no_rebuild <0 | 1>
+# - By default, kdump initrd will only be rebuilt when necessary.
+# Specify 1 to force no rebuild of kdump initrd.
+#
+# force_no_rebuild and force_rebuild options are mutually exclusive and
+# both should not be set to 1 simultaneously.
+#
# override_resettable <0 | 1>
# - Usually an unresettable block device can't be a dump target.
# Specifying 1 when you want to dump even though the block
@@ -150,6 +157,7 @@ core_collector makedumpfile -l --message-level 1 -d 31
#extra_modules gfs2
#default shell
#force_rebuild 1
+#force_no_rebuild 1
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
#fence_kdump_args -p 7410 -f auto -c 0 -i 10
#fence_kdump_nodes node1 node2
diff --git a/kdump.conf.5 b/kdump.conf.5
index ca427699be53..265a67f5d575 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -166,6 +166,16 @@ By default, kdump initrd will only be rebuilt when necessary.
Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
.RE
+.B force_no_rebuild <0 | 1>
+.RS
+By default, kdump initrd will only be rebuilt when necessary.
+Specify 1 to force no rebuild of kdump initrd.
+
+.PP
+force_no_rebuild and force_rebuild options are mutually exclusive and
+both should not be set to 1 simultaneously.
+.RE
+
.B override_resettable <0 | 1>
.RS
Usually an unresettable block device can't be a dump target. Specifying 1 means
diff --git a/kdumpctl b/kdumpctl
index 4d68be0c292d..01c62d1b6782 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -354,7 +354,7 @@ check_config()
case "$config_opt" in
\#* | "")
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
[ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt."
return 1;
@@ -610,6 +610,7 @@ check_rebuild()
local extra_modules
local _force_rebuild force_rebuild="0"
local ret system_modified="0"
+ local _force_no_rebuild force_no_rebuild="0"
check_boot_dir
@@ -625,6 +626,15 @@ check_rebuild()
return 1
fi
+ _force_no_rebuild=`grep ^force_no_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
+ if [ $? -eq 0 ]; then
+ force_no_rebuild=`echo $_force_no_rebuild | cut -d' ' -f2`
+ if [ "$force_no_rebuild" != "0" ] && [ "$force_no_rebuild" != "1" ];then
+ echo "Error: force_no_rebuild value is invalid"
+ return 1
+ fi
+ fi
+
_force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
if [ $? -eq 0 ]; then
force_rebuild=`echo $_force_rebuild | cut -d' ' -f2`
@@ -634,45 +644,63 @@ check_rebuild()
fi
fi
- #will rebuild every time if extra_modules are specified
- extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
- [ -n "$extra_modules" ] && force_rebuild="1"
-
- #check to see if dependent files has been modified
- #since last build of the image file
- if [ -f $TARGET_INITRD ]; then
- image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null`
- fi
+ if [ "$force_no_rebuild" == "1" ]; then
+ if [ "$force_rebuild" == "1" ]; then
+ echo "Error: both force_rebuild and force_no_rebuild cannot be set in kdump.conf"
+ exit 1
+ else
+ if [[ ! -w "$KDUMP_BOOTDIR" ]];then
+ echo "$KDUMP_BOOTDIR does not have write permission. Will not rebuild $TARGET_INITRD"
+ fi
- check_system_modified
- ret=$?
- if [ $ret -eq 2 ]; then
- return 1
- elif [ $ret -eq 1 ];then
- system_modified="1"
- fi
-
- if is_mode_switched; then
- echo -n "Dump mode changed from last boot."; echo
- handle_mode_switch
- elif [ $image_time -eq 0 ]; then
- echo -n "No kdump initial ramdisk found."; echo
- elif [ "$force_rebuild" != "0" ]; then
- echo -n "Force rebuild $TARGET_INITRD"; echo
- elif [ "$system_modified" != "0" ]; then
- :
+ return 0
+ fi
else
- return 0
- fi
+ if [[ ! -w "$KDUMP_BOOTDIR" ]]; then
+ if [ "$force_rebuild" == "1" ];then
+ echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD"
+ return 1
+ else
+ echo "$KDUMP_BOOTDIR does not have write permission. Will not rebuild $TARGET_INITRD"
+ return 0
+ fi
+ fi
- if [[ ! -w "$KDUMP_BOOTDIR" ]];then
- echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD"
- return 1
- fi
+ #will rebuild every time if extra_modules are specified
+ extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
+ [ -n "$extra_modules" ] && force_rebuild="1"
- echo "Rebuilding $TARGET_INITRD"
- rebuild_initrd
- return $?
+ #check to see if dependent files has been modified
+ #since last build of the image file
+ if [ -f $TARGET_INITRD ]; then
+ image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null`
+ fi
+
+ check_system_modified
+ ret=$?
+ if [ $ret -eq 2 ]; then
+ return 1
+ elif [ $ret -eq 1 ];then
+ system_modified="1"
+ fi
+
+ if is_mode_switched; then
+ echo -n "Dump mode changed from last boot."; echo
+ handle_mode_switch
+ elif [ $image_time -eq 0 ]; then
+ echo -n "No kdump initial ramdisk found."; echo
+ elif [ "$force_rebuild" != "0" ]; then
+ echo -n "Force rebuild $TARGET_INITRD"; echo
+ elif [ "$system_modified" != "0" ]; then
+ :
+ else
+ return 0
+ fi
+
+ echo "Rebuilding $TARGET_INITRD"
+ rebuild_initrd
+ return $?
+ fi
}
# This function check iomem and determines if we have more than
--
2.7.4
7 years
[PATCH 0/4] remove "root=X" for kdump boot
by Xunlei Pang
Previously, I've sent out two versions of the targets hook framework.
after discussion we decided to finish "removing root=X" first using
the approach of v1, thus I drafted this patch series. We can continue
the targets hook framework if we really need it in the future.
This patch series focuses on removing "root=X" for kdump, and always
add the dump target(even for root target) via dracut's "--mount ..."
explicitly.
There are two cases we don't remove "root=X":
1) "default dump_to_rootfs" is specified.
2) fadump, AFAIK fadump can directly switch to root after vmcore dumping,
I am not sure, would be apprieciated if someone has a clear answer.
PATCH1 is a bug fix I found during my nfs diskless tests.
PATCH2 is a bug fix needed by PATCH3.
PATCH3 is the actual implemenation.
PATCH4 is a revert patch due to having PATCH3.
Xunlei Pang (4):
module-setup: install network for diskless environment
kdumpctl: fix a bug in remove_cmdline_param()
kdumpctl: remove "root=X" for kdump boot
Revert "kdumpctl: filter 'root' kernel parameter when running in live
images"
dracut-module-setup.sh | 8 +++++---
kdumpctl | 42 +++++++++++++++++++++++++++++++-----------
live-image-kdump-howto.txt | 2 ++
mkdumprd | 29 +++++++++--------------------
4 files changed, 47 insertions(+), 34 deletions(-)
--
1.8.3.1
7 years
[PATCH 1/2] mkdumprd: don't add "x-initrd.mount" if nfs mounted to the save path
by Xunlei Pang
I found this problem when debugging "Transaction is destructive"
(see the following patch) issue using nfs, in the case that nfs
is mounted implicitly to the save path other than explicitly
using the "nfs" directive in /etc/kdump.conf, "is_nfs_dump_target"
will return false, so this nfs mount will be added "x-initrd.mount"
option wrongly.
It affects the systemd service behaviours when emergency failure
happens as the code comment described.
To fix it, we use "is_fs_type_nfs $_fstype" instead.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index f30d9c2..f1bac01 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -120,7 +120,7 @@ to_mount() {
# If remote mount fails, dracut-initqueue will still start and once
# dracut-initqueue finishes, kdump service will start. Because remote mount
# failed, kdump service will fail and it will lead to kdump error handler.
- if ! is_nfs_dump_target; then
+ if ! is_fs_type_nfs $_fstype; then
_options="$_options,x-initrd.mount"
fi
_mntopts="$_target $_fstype $_options"
--
1.8.3.1
7 years