[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
6 years, 5 months
[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
6 years, 5 months
[RFC PATCH v2 0/6] introduce a mechanism for doing something regarding the dump target
by Xunlei Pang
v1->v2:
Add the hook in kdumpctl, so we use this hook anywhere, this helps a loot
for the "all_root" checklist(see PATCH4).
We add a generic dump target hook for kdump, supposed to monitor all the
devices mounted by kdump.
PATCH2 implements the basic framework, add a hook kdump_target_hook(),
and provide a generic helper kdump_targets_tell() for use.
We prepare a checklist(jobs) in the hook, to implement a checklist:
Add your new checklist(job) "xxx" separated by whitespace, and
implement its logic to update its tag value in the tag inventory.
Then "kdump_targets_tell xxx" will be available for you to use.
PATCH4(remove root=X via "all_root" checklist) and PATCH5(remove "lvm"
via "any_lvm" checklist) are applications under this framework.
PATCH6 is an issue we want to solve to reduce "lvm2" memory consumption
under kdump.
Xunlei Pang (6):
kdump-lib.sh: fix inproper get_block_dump_target()
kdumpctl: add a generic hook for kdump targets
kdumpctl: fix a bug in remove_cmdline_param()
kdumpctl: remove "root=X" for kdump boot
mkdumprd: omit "lvm" dracut module if no lvm target
mkdumprd: reduce lvm2 memory under kdump
dracut-module-setup.sh | 6 ++
dracut-process-lvmconf.sh | 6 ++
kdump-lib.sh | 78 +++++++++++++++++++---
kdumpctl | 162 ++++++++++++++++++++++++++++++++++++++++++----
kexec-tools.spec | 3 +
mkdumprd | 24 ++-----
6 files changed, 241 insertions(+), 38 deletions(-)
create mode 100644 dracut-process-lvmconf.sh
--
1.8.3.1
6 years, 6 months
[PATCH v2] mkdumprd: reduce lvm2 memory under kdump
by Xunlei Pang
We replace "reserved_memory = XXXX"(default value is 8192) with
"reserved_memory = 1024" in /etc/lvm/lvm.conf used by "lvm2", it
can save 7MB peak memory consumption, so lower the possibility of
OOM under kdump.
For kdump, we don't have too many lvm targets, lvm2 locates in the
RAM(rootfs), so don't need that much memory, as discussed with lvm
people, they agreed that we use 1MB under kdump as long as there
are not that many lvm targets invloved.
We modify /etc/lvm/lvm.conf when "99kdumpbase" install() is executed,
because it is parsed after "90lvm" by dracut.
We add the code unconditionally with &>/dev/null to ignore errors, it
doesn't matter in case of "lvm" not included(i.e. there is no lvm.conf).
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
dracut-module-setup.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1f96bb8..5b2c942 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -743,4 +743,13 @@ install() {
# target. Ideally all this should be pushed into dracut iscsi module
# at some point of time.
kdump_check_iscsi_targets
+
+ # For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
+ # safely replace "reserved_memory=XXXX"(default value is 8192) with
+ # "reserved_memory=1024" to lower memory pressure under kdump. We do
+ # it unconditionally here, if "/etc/lvm/lvm.conf" doesn't exist, it
+ # actually does nothing.
+ sed -i -e \
+ 's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
+ ${initdir}/etc/lvm/lvm.conf &>/dev/null
}
--
1.8.3.1
6 years, 6 months
[PATCH] mkdumprd: reduce lvm2 memory under kdump
by Xunlei Pang
We replace "reserved_memory= 8192" with "reserved_memory = 1024"
in /etc/lvm/lvm.conf used by "lvm2", this can save 7MB peak memory
consumption, so we lower the possibility of kdump OOM.
For kdump, we don't have too many lvm targets, lvm2 locates in the
RAM(rootfs), so don't need that much memory, as discussed with lvm
people, they agree that we can use 1MB under kdump as long as there
are not so many lvm targets invloved.
We modify /etc/lvm/lvm.conf when "99kdumpbase" install() is executed,
because it is parsed after "90lvm" by dracut.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
dracut-module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1f96bb8..674f3ee 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -743,4 +743,9 @@ install() {
# target. Ideally all this should be pushed into dracut iscsi module
# at some point of time.
kdump_check_iscsi_targets
+
+ # For the lvm type target under kdump, in /etc/lvm/lvm.conf we can safely replace
+ # "reserved_memory = 8192" with "reserved_memory = 1024" to lower memory pressure
+ sed -i -e 's/\(^[[:space:]]*\)reserved_memory[[:space:]]*=[[:space:]]*[[:digit:]]*/ \
+ \1reserved_memory = 1024/' ${initdir}/etc/lvm/lvm.conf &>/dev/null
}
--
1.8.3.1
6 years, 6 months
[RFC PATCH 0/8] introduce a mechanism for doing something regarding the dump target
by Xunlei Pang
We add a generic dump target hook for kdump, supposed to monitor all the
devices mounted by kdump.
PATCH6 implements the basic framework, add a hook kdump_target_hook(),
and provide a generic helper kdump_target_check() for use(must use
it under mkdump/dracut).
The first five patches are prerequisites for the mechanism, this will
ensure us only have one device(our dump target) mounted after kdump boot,
there still are corner cases like the special "x-initrd.mount" in /etc/fstab,
we can discuss it further to see if we should mount it by kdump or handle it?
PATCH7 is an application of this mechanism(add the "lvm_linear" checklist),
if the dump target is linear type lvm volume, we reduce the "reserved_memory"
in "/etc/lvm/lvm.conf" from 8MB to 1MB(we discussed this with lvm team, they
agree that we can safely set it to 1MB in case of only one lvm linear target).
PATCH8 is another application(add the "lvm" checklist) to remove "lvm" dracut
module when no lvm target needed by kdump.
Xunlei Pang (8):
kdumpctl: fix a bug in remove_cmdline_param()
kdumpctl: remove "root=X" for kdump boot
kdumpctl: fix the rebuild issue after removing "root=X"
Revert "kdumpctl: filter 'root' kernel parameter when running in live
images"
kdumpctl: move is_fadump_capable() into kdump-lib.sh
mkdumprd: add a generic hook for the dump target
mkdumprd: reduce lvm2 memory in case of linear volume
mkdumprd: omit "lvm" dracut module if no lvm target
dracut-module-setup.sh | 6 +++
dracut-process-lvmconf.sh | 6 +++
kdump-lib.sh | 25 +++++++++
kdumpctl | 36 +++++--------
kexec-tools.spec | 3 ++
mkdumprd | 128 +++++++++++++++++++++++++++++++++++++++-------
6 files changed, 163 insertions(+), 41 deletions(-)
create mode 100644 dracut-process-lvmconf.sh
--
1.8.3.1
6 years, 6 months
[PATCH] Fix `makedumpfile --mem-usage /proc/kcore`
by Pratyush Anand
Patches have been taken from kexec-tools and makedumpfile to fix issue
with `makedumpfile --mem-usage /proc/kcore`.
One of the patch is from kexec-tools and rest are from makedumpfile.
All the patches have been acked upstream and applies without conflict.
There is one patch
(kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch), which
fixes koji build issue.
All the patches are backport of upstream commits.
Patches has been tested with kernel 4.11.0-0.rc1.git0.1.fc26.x86_64.
# makedumpfile --mem-usage /proc/kcore -f
The kernel version is not supported.
The makedumpfile operation may be incomplete.
TYPE PAGES EXCLUDABLE DESCRIPTION
----------------------------------------------------------------------
ZERO 1960 yes Pages filled
with zero
NON_PRI_CACHE 22850 yes Cache pages
without private flag
PRI_CACHE 1517 yes Cache pages with
private flag
USER 32522 yes User process
pages
FREE 1898981 yes Free pages
KERN_DATA 78721 no Dumpable kernel
data
page size: 4096
Total pages on system: 2036551
Total size on system: 8341712896 Byte
We won't need to pass -f once fedora kernel is rebased with v4.12.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
...ild_mem_phdrs-check-if-p_paddr-is-invalid.patch | 43 +++++++++++
...e-elf_info-kcore-check-for-invalid-physic.patch | 47 ++++++++++++
...pfile-initial-call-cache_init-a-bit-early.patch | 47 ++++++++++++
...e-makedumpfile-Correct-the-calculation-of.patch | 45 ++++++++++++
...le-makedumpfile-Discard-process_dump_load.patch | 57 +++++++++++++++
...e-mem-usage-allow-to-work-only-with-f-for.patch | 84 ++++++++++++++++++++++
...e-show_mem_usage-calculate-page-offset-af.patch | 41 +++++++++++
...e-x86_64-check-physical-address-in-PT_LOA.patch | 47 ++++++++++++
...14-x86-x86_64-Fix-format-warning-with-die.patch | 75 +++++++++++++++++++
kexec-tools.spec | 19 +++++
10 files changed, 505 insertions(+)
create mode 100644 kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
create mode 100644 kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch
create mode 100644 kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch
create mode 100644 kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch
create mode 100644 kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch
create mode 100644 kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch
create mode 100644 kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch
create mode 100644 kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch
create mode 100644 kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch
diff --git a/kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch b/kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
new file mode 100644
index 000000000000..f479086389ab
--- /dev/null
+++ b/kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
@@ -0,0 +1,43 @@
+From 5520739f1e6e31c7731d34d384bbaf4904282931 Mon Sep 17 00:00:00 2001
+Message-Id: <5520739f1e6e31c7731d34d384bbaf4904282931.1489470510.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.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch b/kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch
new file mode 100644
index 000000000000..1edff59abe2f
--- /dev/null
+++ b/kexec-tools-2.0.14-makedumpfile-elf_info-kcore-check-for-invalid-physic.patch
@@ -0,0 +1,47 @@
+From f4ab6897a716d3f3959f6cb8cab27744eaecb5a6 Mon Sep 17 00:00:00 2001
+Message-Id: <f4ab6897a716d3f3959f6cb8cab27744eaecb5a6.1489471500.git.panand(a)redhat.com>
+In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)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
+
diff --git a/kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch b/kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch
new file mode 100644
index 000000000000..8523767519b9
--- /dev/null
+++ b/kexec-tools-2.0.14-makedumpfile-initial-call-cache_init-a-bit-early.patch
@@ -0,0 +1,47 @@
+From 8e2834bac4f62da3894da297f083068431be6d80 Mon Sep 17 00:00:00 2001
+Message-Id: <8e2834bac4f62da3894da297f083068431be6d80.1489471500.git.panand(a)redhat.com>
+In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)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
+
diff --git a/kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch
new file mode 100644
index 000000000000..16388c83f5cc
--- /dev/null
+++ b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Correct-the-calculation-of.patch
@@ -0,0 +1,45 @@
+From 4c53423b995463067fbbd394e724b4d1d6ea3d62 Mon Sep 17 00:00:00 2001
+Message-Id: <4c53423b995463067fbbd394e724b4d1d6ea3d62.1489471500.git.panand(a)redhat.com>
+In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+From: Baoquan He <bhe(a)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(a)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
+
diff --git a/kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch
new file mode 100644
index 000000000000..30b0e0e1d038
--- /dev/null
+++ b/kexec-tools-2.0.14-makedumpfile-makedumpfile-Discard-process_dump_load.patch
@@ -0,0 +1,57 @@
+From f3ff8c6232de43fa2cc60f5ca0f233cf8eb8d2ad Mon Sep 17 00:00:00 2001
+Message-Id: <f3ff8c6232de43fa2cc60f5ca0f233cf8eb8d2ad.1489471500.git.panand(a)redhat.com>
+In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+From: Baoquan He <bhe(a)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(a)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
+
diff --git a/kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch b/kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch
new file mode 100644
index 000000000000..9282a3732c16
--- /dev/null
+++ b/kexec-tools-2.0.14-makedumpfile-mem-usage-allow-to-work-only-with-f-for.patch
@@ -0,0 +1,84 @@
+From 78cbb4035209add81563c00ba46d237f86b8c427 Mon Sep 17 00:00:00 2001
+Message-Id: <78cbb4035209add81563c00ba46d237f86b8c427.1489471500.git.panand(a)redhat.com>
+In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)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
+
diff --git a/kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch b/kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch
new file mode 100644
index 000000000000..5f30a2a78e30
--- /dev/null
+++ b/kexec-tools-2.0.14-makedumpfile-show_mem_usage-calculate-page-offset-af.patch
@@ -0,0 +1,41 @@
+From 4b0bed3523a5f6c2c428d9dab3d27d4572207d52 Mon Sep 17 00:00:00 2001
+Message-Id: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)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
+
diff --git a/kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch b/kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch
new file mode 100644
index 000000000000..02deed846a19
--- /dev/null
+++ b/kexec-tools-2.0.14-makedumpfile-x86_64-check-physical-address-in-PT_LOA.patch
@@ -0,0 +1,47 @@
+From f1363023b909df886eca5efcb64b78be9b8e6086 Mon Sep 17 00:00:00 2001
+Message-Id: <f1363023b909df886eca5efcb64b78be9b8e6086.1489471500.git.panand(a)redhat.com>
+In-Reply-To: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+References: <4b0bed3523a5f6c2c428d9dab3d27d4572207d52.1489471500.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)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
+
diff --git a/kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch b/kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch
new file mode 100644
index 000000000000..537a2345ae97
--- /dev/null
+++ b/kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch
@@ -0,0 +1,75 @@
+From fe667ab0567d5a5631809db2ce3476c83d312d21 Mon Sep 17 00:00:00 2001
+Message-Id: <fe667ab0567d5a5631809db2ce3476c83d312d21.1489504794.git.panand(a)redhat.com>
+From: Pratyush Anand <panand(a)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(a)redhat.com>
+Signed-off-by: Simon Horman <horms(a)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
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 2a176f390ae2..9e5a61fbb935 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -84,6 +84,16 @@ Obsoletes: diskdumputils netdump kexec-tools-eppic
# Patches 601 onward are generic patches
#
Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
+Patch602: kexec-tools-2.0.14-build_mem_phdrs-check-if-p_paddr-is-invalid.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
+Patch610: kexec-tools-2.0.14-x86-x86_64-Fix-format-warning-with-die.patch
+
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -107,6 +117,15 @@ tar -z -x -v -f %{SOURCE19}
tar -z -x -v -f %{SOURCE23}
%patch601 -p1
+%patch602 -p1
+%patch603 -p1
+%patch604 -p1
+%patch605 -p1
+%patch606 -p1
+%patch607 -p1
+%patch608 -p1
+%patch609 -p1
+%patch610 -p1
%ifarch ppc
%define archdef ARCH=ppc
--
2.9.3
6 years, 6 months
[PATCHv2] Document: fix incorrect link in fadump-how.txt
by Pingfan Liu
The file fadump-howto.txt has an incorrect link for further information
about sysrq usage. Fix it.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
fadump-howto.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fadump-howto.txt b/fadump-howto.txt
index cfde878..be17da3 100644
--- a/fadump-howto.txt
+++ b/fadump-howto.txt
@@ -163,7 +163,7 @@ on your system, with the scripts enabled as described in the section above.
FAdump can be triggered with the combination of the 'Alt','SysRq' and 'C'
keyboard keys. Please refer to the following link for more details:
-http://kbase.redhat.com/faq/FAQ_43_5559.shtm
+https://fedoraproject.org/wiki/QA/Sysrq
In addition, on PowerPC boxes, fadump can also be triggered via Hardware
Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys.
--
2.7.4
6 years, 6 months
[PATCH rhel7.4] Document: fix incorrect link in fadump-how.txt
by Pingfan Liu
The file fadump-howto.txt has an incorrect link for further information
about sysrq usage. Fix it.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
fadump-howto.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fadump-howto.txt b/fadump-howto.txt
index cfde878..1613d02 100644
--- a/fadump-howto.txt
+++ b/fadump-howto.txt
@@ -163,7 +163,7 @@ on your system, with the scripts enabled as described in the section above.
FAdump can be triggered with the combination of the 'Alt','SysRq' and 'C'
keyboard keys. Please refer to the following link for more details:
-http://kbase.redhat.com/faq/FAQ_43_5559.shtm
+https://access.redhat.com/articles/231663
In addition, on PowerPC boxes, fadump can also be triggered via Hardware
Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys.
--
1.8.3.1
6 years, 7 months
[PATCH] kdump-lib.sh: fix incorrect usage with pipe as input for grep -q in is_pcs_fence_kdump()
by Pingfan Liu
For -q option, as man grep says: Exit immediately with zero status if
any match is found, even if an error was detected.
So when matching, the read side of pipe is closed by "grep -q", while
the write side still try to write more data, which cause SIGPIPE to the
process, and the shell can not exit with 0. It depends on the kernel's
implementation of pipe to decide how much data written by the producer
can trigger the bug.
Bash test script:
#!/bin/sh
set -o pipefail
dd if=/dev/zero of=text.file bs=1M count=1
sed -i '1s/^/keyword /' text.file
cat text.file | grep -q keyword
echo $?
Notice the "set -o pipefail" is set by dracut, so
mkdumprd -> dracut -> dracut-module-setup.sh -> is_pcs_fence_kdump()
trigger the bug.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e3b5a01..8ebad70 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -63,7 +63,7 @@ is_pcs_fence_kdump()
[ -x $FENCE_KDUMP_SEND ] || return 1
# fence kdump not configured?
- (pcs cluster cib | grep -q 'type="fence_kdump"') &> /dev/null || return 1
+ (pcs cluster cib | grep 'type="fence_kdump"') &> /dev/null || return 1
}
# Check if fence_kdump is configured using kdump options
--
2.7.4
6 years, 7 months