diff --git a/.gitignore b/.gitignore index 297060f..abb4bc8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ SOURCES/eppic_050615.tar.gz -SOURCES/kexec-tools-2.0.19.tar.xz -SOURCES/makedumpfile-1.6.5.tar.gz +SOURCES/kexec-tools-2.0.20.tar.xz +SOURCES/makedumpfile-1.6.6.tar.gz diff --git a/.kexec-tools.metadata b/.kexec-tools.metadata index b43204b..11cef96 100644 --- a/.kexec-tools.metadata +++ b/.kexec-tools.metadata @@ -1,3 +1,3 @@ a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz -5d080337da7a1603e542fc3db1f08cf8685eda02 SOURCES/kexec-tools-2.0.19.tar.xz -700f2ff13f75d97a0df2303ff9f580cdddadf7b0 SOURCES/makedumpfile-1.6.5.tar.gz +5d9acd2e741d356d4a48fe4f2d63f66ba431051d SOURCES/kexec-tools-2.0.20.tar.xz +68f5276d82091b54452f754aa41e2e8746f47814 SOURCES/makedumpfile-1.6.6.tar.gz diff --git a/SOURCES/dracut-module-setup.sh b/SOURCES/dracut-module-setup.sh index e3dc198..c6d2d8c 100755 --- a/SOURCES/dracut-module-setup.sh +++ b/SOURCES/dracut-module-setup.sh @@ -30,7 +30,7 @@ depends() { done } - if is_squash_available; then + if is_squash_available && ! is_fadump_capable; then _dep="$_dep squash" else dwarning "Required modules to build a squashed kdump image is missing!" @@ -40,7 +40,7 @@ depends() { _dep="$_dep drm" fi - if is_generic_fence_kdump -o is_pcs_fence_kdump; then + if is_generic_fence_kdump || is_pcs_fence_kdump; then _dep="$_dep network" fi @@ -225,7 +225,7 @@ kdump_setup_bond() { source_ifcfg_file $_netdev - bondoptions="$(echo :$BONDING_OPTS | sed 's/\s\+/,/')" + bondoptions=":$(echo $BONDING_OPTS | xargs echo | tr " " ",")" echo "$bondoptions" >> ${initdir}/etc/cmdline.d/42bond.conf } @@ -650,6 +650,40 @@ kdump_check_iscsi_targets () { } } +# hostname -a is deprecated, do it by ourself +get_alias() { + local ips + local entries + local alias_set + + ips=$(hostname -I) + for ip in $ips + do + entries=$(grep $ip /etc/hosts | awk '{ $1=$2=""; print $0 }') + if [ $? -eq 0 ]; then + alias_set="$alias_set $entries" + fi + done + + echo $alias_set +} + +is_localhost() { + local hostnames=$(hostname -A) + local shortnames=$(hostname -A -s) + local aliasname=$(get_alias) + local nodename=$1 + + hostnames="$hostnames $shortnames $aliasname" + + for name in ${hostnames}; do + if [ "$name" == "$nodename" ]; then + return 0 + fi + done + return 1 +} + # retrieves fence_kdump nodes from Pacemaker cluster configuration get_pcs_fence_kdump_nodes() { local nodes @@ -681,6 +715,21 @@ get_pcs_fence_kdump_args() { fi } +get_generic_fence_kdump_nodes() { + local filtered + local nodes + + nodes=$(get_option_value "fence_kdump_nodes") + for node in ${nodes}; do + # Skip its own node name + if is_localhost $node; then + continue + fi + filtered="$filtered $node" + done + echo $filtered +} + # setup fence_kdump in cluster # setup proper network and install needed files kdump_configure_fence_kdump () { @@ -689,7 +738,7 @@ kdump_configure_fence_kdump () { local args if is_generic_fence_kdump; then - nodes=$(get_option_value "fence_kdump_nodes") + nodes=$(get_generic_fence_kdump_nodes) elif is_pcs_fence_kdump; then nodes=$(get_pcs_fence_kdump_nodes) @@ -801,4 +850,17 @@ install() { echo "[Manager]" > ${initdir}/etc/systemd/system.conf.d/kdump.conf echo "DefaultTimeoutStartSec=300s" >> ${initdir}/etc/systemd/system.conf.d/kdump.conf fi + + if ! is_fadump_capable; then + # Forward logs to console directly, this avoids unneccessary memory + # consumption and make console output more useful. + # Only do so for non fadump image. + mkdir -p ${initdir}/etc/systemd/journald.conf.d + echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf + echo "Storage=none" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf + echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf + + # Save more memory by dropping switch root capability + dracut_no_switch_root + fi } diff --git a/SOURCES/kdump-lib-initramfs.sh b/SOURCES/kdump-lib-initramfs.sh index 817ba01..c7f9522 100755 --- a/SOURCES/kdump-lib-initramfs.sh +++ b/SOURCES/kdump-lib-initramfs.sh @@ -56,13 +56,13 @@ get_kdump_confs() FAILURE_ACTION="kdump_emergency_shell" ;; reboot) - FAILURE_ACTION="systemctl reboot -f" + FAILURE_ACTION="systemctl reboot -f && exit" ;; halt) - FAILURE_ACTION="halt" + FAILURE_ACTION="halt && exit" ;; poweroff) - FAILURE_ACTION="systemctl poweroff -f" + FAILURE_ACTION="systemctl poweroff -f && exit" ;; dump_to_rootfs) FAILURE_ACTION="dump_to_rootfs" @@ -96,15 +96,31 @@ get_kdump_confs() # dump_fs dump_fs() { - + local _do_umount="" local _dev=$(findmnt -k -f -n -r -o SOURCE $1) local _mp=$(findmnt -k -f -n -r -o TARGET $1) - - echo "kdump: dump target is $_dev" + local _op=$(findmnt -k -f -n -r -o OPTIONS $1) if [ -z "$_mp" ]; then - echo "kdump: error: Dump target $_dev is not mounted." - return 1 + _dev=$(findmnt -s -f -n -r -o SOURCE $1) + _mp=$(findmnt -s -f -n -r -o TARGET $1) + _op=$(findmnt -s -f -n -r -o OPTIONS $1) + + if [ -n "$_dev" ] && [ -n "$_mp" ]; then + echo "kdump: dump target $_dev is not mounted, trying to mount..." + mkdir -p $_mp + mount -o $_op $_dev $_mp + + if [ $? -ne 0 ]; then + echo "kdump: mounting failed (mount point: $_mp, option: $_op)" + return 1 + fi + _do_umount=1 + else + echo "kdump: error: Dump target $_dev is not usable" + fi + else + echo "kdump: dump target is $_dev" fi # Remove -F in makedumpfile case. We don't want a flat format dump here. @@ -123,6 +139,11 @@ dump_fs() sync echo "kdump: saving vmcore complete" + + if [ $_do_umount ]; then + umount $_mp || echo "kdump: warn: failed to umount target" + fi + # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure return 0 } diff --git a/SOURCES/kdump.conf.5 b/SOURCES/kdump.conf.5 index fda3770..adfc372 100644 --- a/SOURCES/kdump.conf.5 +++ b/SOURCES/kdump.conf.5 @@ -275,7 +275,7 @@ retaining blacklist option creates more confusing behavior. It has been deprecated. .PP Instead, use rd.driver.blacklist option on second kernel to blacklist -a certain module. One can edit /etc/sysconfig/kdump.conf and edit +a certain module. One can edit /etc/sysconfig/kdump and edit KDUMP_COMMANDLINE_APPEND to pass kernel command line options. Refer to dracut.cmdline man page for more details on module blacklist option. .RE diff --git a/SOURCES/kdump.sysconfig.x86_64 b/SOURCES/kdump.sysconfig.x86_64 index 64432ac..e4aafc9 100644 --- a/SOURCES/kdump.sysconfig.x86_64 +++ b/SOURCES/kdump.sysconfig.x86_64 @@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet" # This variable lets us append arguments to the current kdump commandline # after processed by KDUMP_COMMANDLINE_REMOVE -KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd" +KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd hest_disable" # Any additional kexec arguments required. In most situations, this should # be left empty diff --git a/SOURCES/kdumpctl b/SOURCES/kdumpctl index c6c1736..694c7ae 100755 --- a/SOURCES/kdumpctl +++ b/SOURCES/kdumpctl @@ -727,13 +727,60 @@ check_ssh_config() return 0 } +# ipv6 host address may takes a long time to be ready. +# Instead of checking against ipv6 address, we just check the network reachable +# by the return val of 'ssh' +check_and_wait_network_ready() +{ + local start_time=$(date +%s) + local warn_once=1 + local cur + local diff + local retval + local errmsg + + while true; do + errmsg=$(ssh -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH 2>&1) + retval=$? + + # ssh exits with the exit status of the remote command or with 255 if an error occurred + if [ $retval -eq 0 ]; then + return 0 + elif [ $retval -ne 255 ]; then + echo "Could not create $DUMP_TARGET:$SAVE_PATH, you should check the privilege on server side" >&2 + return 1 + fi + + # if server removes the authorized_keys or, no /root/.ssh/kdump_id_rsa + echo $errmsg | grep -q "Permission denied\|No such file or directory\|Host key verification failed" + if [ $? -eq 0 ]; then + echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" >&2 + return 1 + fi + + if [ $warn_once -eq 1 ]; then + echo "Network dump target is not usable, waiting for it to be ready" + warn_once=0 + fi + echo -n . + + cur=$(date +%s) + let "diff = $cur - $start_time" + # 60s time out + if [ $diff -gt 180 ]; then + break; + fi + sleep 1 + done + + echo "Could not create $DUMP_TARGET:$SAVE_PATH, ipaddr is not ready yet. You should check network connection" >&2 + return 1 +} + check_ssh_target() { - local _ret - ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH - _ret=$? - if [ $_ret -ne 0 ]; then - echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" >&2 + check_and_wait_network_ready + if [ $? -ne 0 ]; then return 1 fi return 0 @@ -1061,8 +1108,7 @@ reload() { check_current_status if [ $? -ne 0 ]; then - echo "Kdump is not running: [WARNING]" - return 0 + echo "Kdump was not running: [WARNING]" fi if [ $DEFAULT_DUMP_MODE == "fadump" ]; then diff --git a/SOURCES/kexec-tools-2.0.16-koji-build-fail-workaround.patch b/SOURCES/kexec-tools-2.0.16-koji-build-fail-workaround.patch deleted file mode 100644 index c406063..0000000 --- a/SOURCES/kexec-tools-2.0.16-koji-build-fail-workaround.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/purgatory/Makefile b/purgatory/Makefile -index 49ce80a..97b7a03 100644 ---- a/purgatory/Makefile -+++ b/purgatory/Makefile -@@ -67,7 +67,7 @@ $(PURGATORY): $(PURGATORY_OBJS) - $(MKDIR) -p $(@D) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@.sym $^ - # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) -- $(STRIP) --strip-debug -o $@ $@.sym -+ $(STRIP) --strip-debug --no-merge-notes -o $@ $@.sym - - echo:: - @echo "PURGATORY_SRCS $(PURGATORY_SRCS)" diff --git a/SOURCES/kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch b/SOURCES/kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch deleted file mode 100644 index 0eee6ea..0000000 --- a/SOURCES/kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ce720608d5933e62f77f2c2f216859cf4f06adf8 Mon Sep 17 00:00:00 2001 -From: Kairui Song -Date: Wed, 13 Feb 2019 00:03:51 +0800 -Subject: [PATCH] Fix eppic issue with hardening flags - -This is stash of two commits: - -commit f98cf5fe07f390554696755f0a5843f6bb9c4716 -Author: ryncsn -Date: Tue Mar 19 13:39:25 2019 +0800 - - Tell gcc not to omit frame pointer - - After commit 0209874, it's now possible to enable optimization above O0. - But eppic might call __builtin_return_address(1). With O1, - -fomit-frame-pointer is enabled gcc may omit frame pointer. - __builtin_return_address(1) relies on callee preserves RBP as the stack - base, which is untrue if optimization is usded. In this case it may return - wrong value or crash. - - In case of any potential failure, use -fno-omit-frame-pointer globally. - - Signed-off-by: Kairui Song - -commit 0209874f4b46b8af5a2d42662ba6775cf5a1dc44 -Author: Kairui Song -Date: Wed Feb 13 00:03:51 2019 +0800 - - Drop O0 CFLAGS override in Makefile - -Signed-off-by: Kairui Song ---- - libeppic/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libeppic/Makefile b/libeppic/Makefile -index bcf2edf..8b97c87 100644 ---- a/eppic/libeppic/Makefile -+++ b/eppic/libeppic/Makefile -@@ -24,7 +24,7 @@ LDIRT = lex.eppic.c lex.eppicpp.c eppic.tab.c eppic.tab.h eppicpp.tab.c \ - LIBDIR = /usr/lib - TARGETS = libeppic.a - --CFLAGS += -O0 -g -fPIC -+CFLAGS += -g -fno-omit-frame-pointer -fPIC - ifeq ($(TARGET), PPC64) - CFLAGS += -m64 - endif --- -2.20.1 - diff --git a/SOURCES/kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch b/SOURCES/kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch deleted file mode 100644 index 9825ef4..0000000 --- a/SOURCES/kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 0f9ee000904ffd1e171ba1f000a83e5ce3717e45 Mon Sep 17 00:00:00 2001 -From: David Hildenbrand -Date: Thu, 22 Nov 2018 11:09:38 +0100 -Subject: [PATCH] [PATCH] exclude pages that are logically offline - -Linux marks pages that are logically offline via a page flag (map count). -Such pages e.g. include pages infated as part of a balloon driver or -pages that were not actually onlined when onlining the whole section. - -While the hypervisor usually allows to read such inflated memory, we -basically read and dump data that is completely irrelevant. Also, this -might result in quite some overhead in the hypervisor. In addition, -we saw some problems under Hyper-V, whereby we can crash the kernel by -dumping, when reading memory of a partially onlined memory segment -(for memory added by the Hyper-V balloon driver). - -Therefore, don't read and dump pages that are marked as being logically -offline. - -Signed-off-by: David Hildenbrand -Signed-off-by: Pingfan Liu ---- - makedumpfile.c | 34 ++++++++++++++++++++++++++++++---- - makedumpfile.h | 1 + - 2 files changed, 31 insertions(+), 4 deletions(-) - -diff --git a/makedumpfile.c b/makedumpfile.c -index 8923538..a5f2ea9 100644 ---- a/makedumpfile-1.6.5/makedumpfile.c -+++ b/makedumpfile-1.6.5/makedumpfile.c -@@ -88,6 +88,7 @@ mdf_pfn_t pfn_cache_private; - mdf_pfn_t pfn_user; - mdf_pfn_t pfn_free; - mdf_pfn_t pfn_hwpoison; -+mdf_pfn_t pfn_offline; - - mdf_pfn_t num_dumped; - -@@ -250,6 +251,21 @@ isHugetlb(unsigned long dtor) - } - - static int -+isOffline(unsigned long flags, unsigned int _mapcount) -+{ -+ if (NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE) == NOT_FOUND_NUMBER) -+ return FALSE; -+ -+ if (flags & (1UL << NUMBER(PG_slab))) -+ return FALSE; -+ -+ if (_mapcount == (int)NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE)) -+ return TRUE; -+ -+ return FALSE; -+} -+ -+static int - is_cache_page(unsigned long flags) - { - if (isLRU(flags)) -@@ -2287,6 +2303,8 @@ write_vmcoreinfo_data(void) - WRITE_NUMBER("PG_hwpoison", PG_hwpoison); - - WRITE_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE); -+ WRITE_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", -+ PAGE_OFFLINE_MAPCOUNT_VALUE); - WRITE_NUMBER("phys_base", phys_base); - - WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR); -@@ -2687,6 +2705,7 @@ read_vmcoreinfo(void) - READ_SRCFILE("pud_t", pud_t); - - READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE); -+ READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE); - READ_NUMBER("phys_base", phys_base); - #ifdef __aarch64__ - READ_NUMBER("VA_BITS", VA_BITS); -@@ -6042,6 +6061,12 @@ __exclude_unnecessary_pages(unsigned long mem_map, - pfn_counter = &pfn_hwpoison; - } - /* -+ * Exclude pages that are logically offline. -+ */ -+ else if (isOffline(flags, _mapcount)) { -+ pfn_counter = &pfn_offline; -+ } -+ /* - * Unexcludable page - */ - else -@@ -7522,7 +7547,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - */ - if (info->flag_cyclic) { - pfn_zero = pfn_cache = pfn_cache_private = 0; -- pfn_user = pfn_free = pfn_hwpoison = 0; -+ pfn_user = pfn_free = pfn_hwpoison = pfn_offline = 0; - pfn_memhole = info->max_mapnr; - } - -@@ -8804,7 +8829,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d - * Reset counter for debug message. - */ - pfn_zero = pfn_cache = pfn_cache_private = 0; -- pfn_user = pfn_free = pfn_hwpoison = 0; -+ pfn_user = pfn_free = pfn_hwpoison = pfn_offline = 0; - pfn_memhole = info->max_mapnr; - - /* -@@ -9749,7 +9774,7 @@ print_report(void) - pfn_original = info->max_mapnr - pfn_memhole; - - pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private -- + pfn_user + pfn_free + pfn_hwpoison; -+ + pfn_user + pfn_free + pfn_hwpoison + pfn_offline; - shrinking = (pfn_original - pfn_excluded) * 100; - shrinking = shrinking / pfn_original; - -@@ -9763,6 +9788,7 @@ print_report(void) - REPORT_MSG(" User process data pages : 0x%016llx\n", pfn_user); - REPORT_MSG(" Free pages : 0x%016llx\n", pfn_free); - REPORT_MSG(" Hwpoison pages : 0x%016llx\n", pfn_hwpoison); -+ REPORT_MSG(" Offline pages : 0x%016llx\n", pfn_offline); - REPORT_MSG(" Remaining pages : 0x%016llx\n", - pfn_original - pfn_excluded); - REPORT_MSG(" (The number of pages is reduced to %lld%%.)\n", -@@ -9790,7 +9816,7 @@ print_mem_usage(void) - pfn_original = info->max_mapnr - pfn_memhole; - - pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private -- + pfn_user + pfn_free + pfn_hwpoison; -+ + pfn_user + pfn_free + pfn_hwpoison + pfn_offline; - shrinking = (pfn_original - pfn_excluded) * 100; - shrinking = shrinking / pfn_original; - total_size = info->page_size * pfn_original; -diff --git a/makedumpfile.h b/makedumpfile.h -index 73813ed..04c903f 100644 ---- a/makedumpfile-1.6.5/makedumpfile.h -+++ b/makedumpfile-1.6.5/makedumpfile.h -@@ -1927,6 +1927,7 @@ struct number_table { - long PG_hwpoison; - - long PAGE_BUDDY_MAPCOUNT_VALUE; -+ long PAGE_OFFLINE_MAPCOUNT_VALUE; - long SECTION_SIZE_BITS; - long MAX_PHYSMEM_BITS; - long HUGETLB_PAGE_DTOR; --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch b/SOURCES/kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch deleted file mode 100644 index e4052fa..0000000 --- a/SOURCES/kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 2f007b48c581a81d7e95678b6bcb77cfbe177135 Mon Sep 17 00:00:00 2001 -From: Kairui Song -Date: Tue, 29 Jan 2019 11:14:15 +0800 -Subject: [PATCH] [PATCH v2] honor the CFLAGS from environment variables - -This makes it possible to pass in extra cflags, for example, hardening -flags could be passed in with environment variable when building a -hardened package. - -Also introduce a CFLAGS_BASE to hold common CFLAGS, which simplify the -CFLAGS definition. - -Suggested-by: Kazuhito Hagio -Signed-off-by: Kairui Song ---- - Makefile | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/Makefile b/Makefile -index ea3c47d..bd681d2 100644 ---- a/makedumpfile-1.6.5/Makefile -+++ b/makedumpfile-1.6.5/Makefile -@@ -8,11 +8,10 @@ ifeq ($(strip $CC),) - CC = gcc - endif - --CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \ -- -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \ -- -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"' --CFLAGS_ARCH = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \ -- -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -+CFLAGS_BASE := $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \ -+ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -+CFLAGS := $(CFLAGS_BASE) -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"' -+CFLAGS_ARCH := $(CFLAGS_BASE) - # LDFLAGS = -L/usr/local/lib -I/usr/local/include - - HOST_ARCH := $(shell uname -m) --- -2.20.1 - diff --git a/SOURCES/kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch b/SOURCES/kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch deleted file mode 100644 index 662fd27..0000000 --- a/SOURCES/kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch +++ /dev/null @@ -1,198 +0,0 @@ -From d222b01e516bba73ef9fefee4146734a5f260fa1 Mon Sep 17 00:00:00 2001 -From: Lianbo Jiang -Date: Wed, 30 Jan 2019 10:48:53 +0800 -Subject: [PATCH] [PATCH] x86_64: Add support for AMD Secure Memory Encryption - -On AMD machine with Secure Memory Encryption (SME) feature, if SME is -enabled, page tables contain a specific attribute bit (C-bit) in their -entries to indicate whether a page is encrypted or unencrypted. - -So get NUMBER(sme_mask) from vmcoreinfo, which stores the value of -the C-bit position, and drop it to obtain the true physical address. - -Signed-off-by: Lianbo Jiang ---- - arch/x86_64.c | 30 +++++++++++++++++++----------- - makedumpfile.c | 4 ++++ - makedumpfile.h | 1 + - 3 files changed, 24 insertions(+), 11 deletions(-) - -diff --git a/arch/x86_64.c b/arch/x86_64.c -index 9db1f8139f28..46e93366f0be 100644 ---- a/makedumpfile-1.6.5/arch/x86_64.c -+++ b/makedumpfile-1.6.5/arch/x86_64.c -@@ -297,6 +297,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - unsigned long page_dir, pgd, pud_paddr, pud_pte, pmd_paddr, pmd_pte; - unsigned long pte_paddr, pte; - unsigned long p4d_paddr, p4d_pte; -+ unsigned long entry_mask = ENTRY_MASK; - - /* - * Get PGD. -@@ -308,6 +309,9 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - return NOT_PADDR; - } - -+ if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) -+ entry_mask &= ~(NUMBER(sme_mask)); -+ - if (check_5level_paging()) { - page_dir += pgd5_index(vaddr) * sizeof(unsigned long); - if (!readmem(PADDR, page_dir, &pgd, sizeof pgd)) { -@@ -324,7 +328,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - /* - * Get P4D. - */ -- p4d_paddr = pgd & ENTRY_MASK; -+ p4d_paddr = pgd & entry_mask; - p4d_paddr += p4d_index(vaddr) * sizeof(unsigned long); - if (!readmem(PADDR, p4d_paddr, &p4d_pte, sizeof p4d_pte)) { - ERRMSG("Can't get p4d_pte (p4d_paddr:%lx).\n", p4d_paddr); -@@ -337,7 +341,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - ERRMSG("Can't get a valid p4d_pte.\n"); - return NOT_PADDR; - } -- pud_paddr = p4d_pte & ENTRY_MASK; -+ pud_paddr = p4d_pte & entry_mask; - }else { - page_dir += pgd_index(vaddr) * sizeof(unsigned long); - if (!readmem(PADDR, page_dir, &pgd, sizeof pgd)) { -@@ -351,7 +355,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - ERRMSG("Can't get a valid pgd.\n"); - return NOT_PADDR; - } -- pud_paddr = pgd & ENTRY_MASK; -+ pud_paddr = pgd & entry_mask; - } - - /* -@@ -370,13 +374,13 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - return NOT_PADDR; - } - if (pud_pte & _PAGE_PSE) /* 1GB pages */ -- return (pud_pte & ENTRY_MASK & PUD_MASK) + -+ return (pud_pte & entry_mask & PUD_MASK) + - (vaddr & ~PUD_MASK); - - /* - * Get PMD. - */ -- pmd_paddr = pud_pte & ENTRY_MASK; -+ pmd_paddr = pud_pte & entry_mask; - pmd_paddr += pmd_index(vaddr) * sizeof(unsigned long); - if (!readmem(PADDR, pmd_paddr, &pmd_pte, sizeof pmd_pte)) { - ERRMSG("Can't get pmd_pte (pmd_paddr:%lx).\n", pmd_paddr); -@@ -390,13 +394,13 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - return NOT_PADDR; - } - if (pmd_pte & _PAGE_PSE) /* 2MB pages */ -- return (pmd_pte & ENTRY_MASK & PMD_MASK) + -+ return (pmd_pte & entry_mask & PMD_MASK) + - (vaddr & ~PMD_MASK); - - /* - * Get PTE. - */ -- pte_paddr = pmd_pte & ENTRY_MASK; -+ pte_paddr = pmd_pte & entry_mask; - pte_paddr += pte_index(vaddr) * sizeof(unsigned long); - if (!readmem(PADDR, pte_paddr, &pte, sizeof pte)) { - ERRMSG("Can't get pte (pte_paddr:%lx).\n", pte_paddr); -@@ -409,7 +413,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) - ERRMSG("Can't get a valid pte.\n"); - return NOT_PADDR; - } -- return (pte & ENTRY_MASK) + PAGEOFFSET(vaddr); -+ return (pte & entry_mask) + PAGEOFFSET(vaddr); - } - - unsigned long long -@@ -642,6 +646,7 @@ find_vmemmap_x86_64() - unsigned long pmd, tpfn; - unsigned long pvaddr = 0; - unsigned long data_addr = 0, last_data_addr = 0, start_data_addr = 0; -+ unsigned long pmask = PMASK; - /* - * data_addr is the paddr of the page holding the page structs. - * We keep lists of contiguous pages and the pfn's that their -@@ -662,6 +667,9 @@ find_vmemmap_x86_64() - return FAILED; - } - -+ if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) -+ pmask &= ~(NUMBER(sme_mask)); -+ - pagestructsize = size_table.page; - hugepagesize = PTRS_PER_PMD * info->page_size; - vaddr_base = info->vmemmap_start; -@@ -692,7 +700,7 @@ find_vmemmap_x86_64() - } - - /* mask the pgd entry for the address of the pud page */ -- pud_addr &= PMASK; -+ pud_addr &= pmask; - if (pud_addr == 0) - continue; - /* read the entire pud page */ -@@ -705,7 +713,7 @@ find_vmemmap_x86_64() - /* pudp points to an entry in the pud page */ - for (pudp = (unsigned long *)pud_page, pudindex = 0; - pudindex < PTRS_PER_PUD; pudindex++, pudp++) { -- pmd_addr = *pudp & PMASK; -+ pmd_addr = *pudp & pmask; - /* read the entire pmd page */ - if (pmd_addr == 0) - continue; -@@ -747,7 +755,7 @@ find_vmemmap_x86_64() - * - we discontiguous page is a string of valids - */ - if (pmd) { -- data_addr = (pmd & PMASK); -+ data_addr = (pmd & pmask); - if (start_range) { - /* first-time kludge */ - start_data_addr = data_addr; -diff --git a/makedumpfile.c b/makedumpfile.c -index 7dfe70fb8792..590f759c84f1 100644 ---- a/makedumpfile-1.6.5/makedumpfile.c -+++ b/makedumpfile-1.6.5/makedumpfile.c -@@ -993,6 +993,8 @@ next_page: - read_size = MIN(info->page_size - PAGEOFFSET(paddr), size); - - pgaddr = PAGEBASE(paddr); -+ if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) -+ pgaddr = pgaddr & ~(NUMBER(sme_mask)); - pgbuf = cache_search(pgaddr, read_size); - if (!pgbuf) { - ++cache_miss; -@@ -2292,6 +2294,7 @@ write_vmcoreinfo_data(void) - WRITE_NUMBER("NR_FREE_PAGES", NR_FREE_PAGES); - WRITE_NUMBER("N_ONLINE", N_ONLINE); - WRITE_NUMBER("pgtable_l5_enabled", pgtable_l5_enabled); -+ WRITE_NUMBER("sme_mask", sme_mask); - - WRITE_NUMBER("PG_lru", PG_lru); - WRITE_NUMBER("PG_private", PG_private); -@@ -2695,6 +2698,7 @@ read_vmcoreinfo(void) - READ_NUMBER("NR_FREE_PAGES", NR_FREE_PAGES); - READ_NUMBER("N_ONLINE", N_ONLINE); - READ_NUMBER("pgtable_l5_enabled", pgtable_l5_enabled); -+ READ_NUMBER("sme_mask", sme_mask); - - READ_NUMBER("PG_lru", PG_lru); - READ_NUMBER("PG_private", PG_private); -diff --git a/makedumpfile.h b/makedumpfile.h -index 2e73beca48c5..5ad38e9ae40c 100644 ---- a/makedumpfile-1.6.5/makedumpfile.h -+++ b/makedumpfile-1.6.5/makedumpfile.h -@@ -1913,6 +1913,7 @@ struct number_table { - long NR_FREE_PAGES; - long N_ONLINE; - long pgtable_l5_enabled; -+ long sme_mask; - - /* - * Page flags --- -2.17.1 - diff --git a/SOURCES/kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch b/SOURCES/kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch deleted file mode 100644 index 90481a1..0000000 --- a/SOURCES/kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch +++ /dev/null @@ -1,129 +0,0 @@ -From fb5a8792e6e4ee7de7ae3e06d193ea5beaaececc Mon Sep 17 00:00:00 2001 -From: Kairui Song -Date: Tue, 5 Mar 2019 19:34:33 +0800 -Subject: [PATCH] x86: Introduce a new option --reuse-video-type - -After commit 060eee58 "x86: use old screen_info if needed", kexec-tools -will force use old screen_info and vga type if failed to determine -current vga type. But it is not always a good idea. - -Currently kernel hanging is inspected on some hyper-v VMs after this -commit, because hyperv_fb will mimic EFI (or VESA) VGA on first boot -up, but after the real driver is loaded, it will switch to new mode -and no longer compatible with EFI/VESA VGA. Keep setting -orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and -try to manipulate the framebuffer in a wrong way. - -We can't ensure this won't happen on other framebuffer drivers, But -it's a helpful feature if the framebuffer drivers just work. So this -patch introduce a --reuse-video-type options to let user decide if the -old screen_info hould be used unconditional or not. - -Signed-off-by: Kairui Song -Reviewed-by: Dave Young -Signed-off-by: Simon Horman ---- - kexec/arch/i386/include/arch/options.h | 2 ++ - kexec/arch/i386/kexec-x86.h | 1 + - kexec/arch/i386/x86-linux-setup.c | 8 ++++++-- - kexec/arch/x86_64/kexec-x86_64.c | 5 +++++ - 4 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/kexec/arch/i386/include/arch/options.h b/kexec/arch/i386/include/arch/options.h -index c113a83..0e57951 100644 ---- a/kexec/arch/i386/include/arch/options.h -+++ b/kexec/arch/i386/include/arch/options.h -@@ -32,6 +32,7 @@ - #define OPT_ENTRY_32BIT (OPT_ARCH_MAX+10) - #define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11) - #define OPT_NOEFI (OPT_ARCH_MAX+12) -+#define OPT_REUSE_VIDEO_TYPE (OPT_ARCH_MAX+13) - - /* Options relevant to the architecture (excluding loader-specific ones): */ - #define KEXEC_ARCH_OPTIONS \ -@@ -45,6 +46,7 @@ - { "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \ - { "pass-memmap-cmdline", 0, 0, OPT_PASS_MEMMAP_CMDLINE }, \ - { "noefi", 0, 0, OPT_NOEFI}, \ -+ { "reuse-video-type", 0, 0, OPT_REUSE_VIDEO_TYPE }, \ - - #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" - -diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h -index 51855f8..c2bcd37 100644 ---- a/kexec/arch/i386/kexec-x86.h -+++ b/kexec/arch/i386/kexec-x86.h -@@ -52,6 +52,7 @@ struct arch_options_t { - enum coretype core_header_type; - uint8_t pass_memmap_cmdline; - uint8_t noefi; -+ uint8_t reuse_video_type; - }; - - int multiboot_x86_probe(const char *buf, off_t len); -diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c -index 1bd408b..8fad115 100644 ---- a/kexec/arch/i386/x86-linux-setup.c -+++ b/kexec/arch/i386/x86-linux-setup.c -@@ -144,7 +144,7 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) - } else if (0 == strcmp(fix.id, "EFI VGA")) { - /* VIDEO_TYPE_EFI */ - real_mode->orig_video_isVGA = 0x70; -- } else { -+ } else if (arch_options.reuse_video_type) { - int err; - off_t offset = offsetof(typeof(*real_mode), orig_video_isVGA); - -@@ -152,6 +152,10 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) - err = get_bootparam(&real_mode->orig_video_isVGA, offset, 1); - if (err) - goto out; -+ } else { -+ real_mode->orig_video_isVGA = 0; -+ close(fd); -+ return 0; - } - close(fd); - -@@ -844,7 +848,7 @@ void setup_linux_system_parameters(struct kexec_info *info, - setup_subarch(real_mode); - if (bzImage_support_efi_boot && !arch_options.noefi) - setup_efi_info(info, real_mode); -- -+ - /* Default screen size */ - real_mode->orig_x = 0; - real_mode->orig_y = 0; -diff --git a/kexec/arch/x86_64/kexec-x86_64.c b/kexec/arch/x86_64/kexec-x86_64.c -index 041b007..ccdc980 100644 ---- a/kexec/arch/x86_64/kexec-x86_64.c -+++ b/kexec/arch/x86_64/kexec-x86_64.c -@@ -55,6 +55,7 @@ void arch_usage(void) - " --console-serial Enable the serial console\n" - " --pass-memmap-cmdline Pass memory map via command line in kexec on panic case\n" - " --noefi Disable efi support\n" -+ " --reuse-video-type Reuse old boot time video type blindly\n" - ); - } - -@@ -67,6 +68,7 @@ struct arch_options_t arch_options = { - .core_header_type = CORE_TYPE_ELF64, - .pass_memmap_cmdline = 0, - .noefi = 0, -+ .reuse_video_type = 0, - }; - - int arch_process_options(int argc, char **argv) -@@ -136,6 +138,9 @@ int arch_process_options(int argc, char **argv) - case OPT_NOEFI: - arch_options.noefi = 1; - break; -+ case OPT_REUSE_VIDEO_TYPE: -+ arch_options.reuse_video_type = 1; -+ break; - } - } - /* Reset getopt for the next pass; called in other source modules */ --- -2.20.1 - diff --git a/SOURCES/kexec-tools-2.0.20-Cleanup-move-it-back-from-util_lib-elf_info.c.patch b/SOURCES/kexec-tools-2.0.20-Cleanup-move-it-back-from-util_lib-elf_info.c.patch new file mode 100644 index 0000000..b8759ee --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-Cleanup-move-it-back-from-util_lib-elf_info.c.patch @@ -0,0 +1,181 @@ +From a7c4cb8e998571cb3dd62e907935a1e052b15d6c Mon Sep 17 00:00:00 2001 +From: Lianbo Jiang +Date: Fri, 23 Aug 2019 20:05:38 +0800 +Subject: [PATCH 3/5] Cleanup: move it back from util_lib/elf_info.c + +Some code related to vmcore-dmesg.c is put into the util_lib, which +is not very reasonable, so lets move it back and tidy up those code. + +In addition, that will also help to limit the size of vmcore-dmesg.txt +in vmcore-dmesg.c instead of elf_info.c. + +Signed-off-by: Lianbo Jiang +Signed-off-by: Simon Horman +--- + util_lib/elf_info.c | 48 +++++++++---------------------------- + util_lib/include/elf_info.h | 2 +- + vmcore-dmesg/vmcore-dmesg.c | 30 ++++++++++++++++++++++- + 3 files changed, 41 insertions(+), 39 deletions(-) + +diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c +index 5d0efaafab53..2bce5cb1713c 100644 +--- a/util_lib/elf_info.c ++++ b/util_lib/elf_info.c +@@ -531,19 +531,7 @@ static int32_t read_file_s32(int fd, uint64_t addr) + return read_file_u32(fd, addr); + } + +-static void write_to_stdout(char *buf, unsigned int nr) +-{ +- ssize_t ret; +- +- ret = write(STDOUT_FILENO, buf, nr); +- if (ret != nr) { +- fprintf(stderr, "Failed to write out the dmesg log buffer!:" +- " %s\n", strerror(errno)); +- exit(54); +- } +-} +- +-static void dump_dmesg_legacy(int fd) ++static void dump_dmesg_legacy(int fd, void (*handler)(char*, unsigned int)) + { + uint64_t log_buf, log_buf_offset; + unsigned log_end, logged_chars, log_end_wrapped; +@@ -604,7 +592,8 @@ static void dump_dmesg_legacy(int fd) + */ + logged_chars = log_end < log_buf_len ? log_end : log_buf_len; + +- write_to_stdout(buf + (log_buf_len - logged_chars), logged_chars); ++ if (handler) ++ handler(buf + (log_buf_len - logged_chars), logged_chars); + } + + static inline uint16_t struct_val_u16(char *ptr, unsigned int offset) +@@ -623,7 +612,7 @@ static inline uint64_t struct_val_u64(char *ptr, unsigned int offset) + } + + /* Read headers of log records and dump accordingly */ +-static void dump_dmesg_structured(int fd) ++static void dump_dmesg_structured(int fd, void (*handler)(char*, unsigned int)) + { + #define OUT_BUF_SIZE 4096 + uint64_t log_buf, log_buf_offset, ts_nsec; +@@ -733,7 +722,8 @@ static void dump_dmesg_structured(int fd) + out_buf[len++] = c; + + if (len >= OUT_BUF_SIZE - 64) { +- write_to_stdout(out_buf, len); ++ if (handler) ++ handler(out_buf, len); + len = 0; + } + } +@@ -752,16 +742,16 @@ static void dump_dmesg_structured(int fd) + current_idx += loglen; + } + free(buf); +- if (len) +- write_to_stdout(out_buf, len); ++ if (len && handler) ++ handler(out_buf, len); + } + +-static void dump_dmesg(int fd) ++void dump_dmesg(int fd, void (*handler)(char*, unsigned int)) + { + if (log_first_idx_vaddr) +- dump_dmesg_structured(fd); ++ dump_dmesg_structured(fd, handler); + else +- dump_dmesg_legacy(fd); ++ dump_dmesg_legacy(fd, handler); + } + + int read_elf(int fd) +@@ -808,22 +798,6 @@ int read_elf(int fd) + return 0; + } + +-int read_elf_vmcore(int fd) +-{ +- int ret; +- +- ret = read_elf(fd); +- if (ret > 0) { +- fprintf(stderr, "Unable to read ELF information" +- " from vmcore\n"); +- return ret; +- } +- +- dump_dmesg(fd); +- +- return 0; +-} +- + int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off) + { + int ret; +diff --git a/util_lib/include/elf_info.h b/util_lib/include/elf_info.h +index c328a1b0ecf2..4bc9279ba603 100644 +--- a/util_lib/include/elf_info.h ++++ b/util_lib/include/elf_info.h +@@ -30,6 +30,6 @@ int get_pt_load(int idx, + unsigned long long *virt_end); + int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off); + int read_elf(int fd); +-int read_elf_vmcore(int fd); ++void dump_dmesg(int fd, void (*handler)(char*, unsigned int)); + + #endif /* ELF_INFO_H */ +diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c +index bebc348a657e..fe7df8ec372c 100644 +--- a/vmcore-dmesg/vmcore-dmesg.c ++++ b/vmcore-dmesg/vmcore-dmesg.c +@@ -5,6 +5,34 @@ typedef Elf32_Nhdr Elf_Nhdr; + + extern const char *fname; + ++static void write_to_stdout(char *buf, unsigned int nr) ++{ ++ ssize_t ret; ++ ++ ret = write(STDOUT_FILENO, buf, nr); ++ if (ret != nr) { ++ fprintf(stderr, "Failed to write out the dmesg log buffer!:" ++ " %s\n", strerror(errno)); ++ exit(54); ++ } ++} ++ ++static int read_vmcore_dmesg(int fd, void (*handler)(char*, unsigned int)) ++{ ++ int ret; ++ ++ ret = read_elf(fd); ++ if (ret > 0) { ++ fprintf(stderr, "Unable to read ELF information" ++ " from vmcore\n"); ++ return ret; ++ } ++ ++ dump_dmesg(fd, handler); ++ ++ return 0; ++} ++ + int main(int argc, char **argv) + { + ssize_t ret; +@@ -23,7 +51,7 @@ int main(int argc, char **argv) + return 2; + } + +- ret = read_elf_vmcore(fd); ++ ret = read_vmcore_dmesg(fd, write_to_stdout); + + close(fd); + +-- +2.17.1 + diff --git a/SOURCES/kexec-tools-2.0.20-Cleanup-remove-the-read_elf_kcore.patch b/SOURCES/kexec-tools-2.0.20-Cleanup-remove-the-read_elf_kcore.patch new file mode 100644 index 0000000..f47b8f6 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-Cleanup-remove-the-read_elf_kcore.patch @@ -0,0 +1,84 @@ +From 545c811050a375f79e0fa0e107cb35b9ae3a1599 Mon Sep 17 00:00:00 2001 +From: Lianbo Jiang +Date: Fri, 23 Aug 2019 20:05:36 +0800 +Subject: [PATCH 1/5] Cleanup: remove the read_elf_kcore() + +Here, no need to wrap the read_elf() again, lets invoke it directly. +So remove the read_elf_kcore() and clean up redundant code. + +Signed-off-by: Lianbo Jiang +Signed-off-by: Simon Horman +--- + kexec/arch/arm64/kexec-arm64.c | 2 +- + util_lib/elf_info.c | 15 ++------------- + util_lib/include/elf_info.h | 2 +- + 3 files changed, 4 insertions(+), 15 deletions(-) + +diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c +index eb3a3a37307c..6ad3b0a134b3 100644 +--- a/kexec/arch/arm64/kexec-arm64.c ++++ b/kexec/arch/arm64/kexec-arm64.c +@@ -889,7 +889,7 @@ int get_phys_base_from_pt_load(unsigned long *phys_offset) + return EFAILED; + } + +- read_elf_kcore(fd); ++ read_elf(fd); + + for (i = 0; get_pt_load(i, + &phys_start, NULL, &virt_start, NULL); +diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c +index 90a3b21662e7..d9397ecd8626 100644 +--- a/util_lib/elf_info.c ++++ b/util_lib/elf_info.c +@@ -764,7 +764,7 @@ static void dump_dmesg(int fd) + dump_dmesg_legacy(fd); + } + +-static int read_elf(int fd) ++int read_elf(int fd) + { + int ret; + +@@ -824,24 +824,13 @@ int read_elf_vmcore(int fd) + return 0; + } + +-int read_elf_kcore(int fd) +-{ +- int ret; +- +- ret = read_elf(fd); +- if (ret != 0) +- return ret; +- +- return 0; +-} +- + int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off) + { + int ret; + + *phys_off = UINT64_MAX; + +- ret = read_elf_kcore(fd); ++ ret = read_elf(fd); + if (!ret) { + /* If we have a valid 'PHYS_OFFSET' by now, + * return it to the caller now. +diff --git a/util_lib/include/elf_info.h b/util_lib/include/elf_info.h +index 1a4debd2d4ba..c328a1b0ecf2 100644 +--- a/util_lib/include/elf_info.h ++++ b/util_lib/include/elf_info.h +@@ -29,7 +29,7 @@ int get_pt_load(int idx, + unsigned long long *virt_start, + unsigned long long *virt_end); + int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off); +-int read_elf_kcore(int fd); ++int read_elf(int fd); + int read_elf_vmcore(int fd); + + #endif /* ELF_INFO_H */ +-- +2.17.1 + diff --git a/SOURCES/kexec-tools-2.0.20-Fix-an-error-definition-about-the-variable-fname.patch b/SOURCES/kexec-tools-2.0.20-Fix-an-error-definition-about-the-variable-fname.patch new file mode 100644 index 0000000..d68b211 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-Fix-an-error-definition-about-the-variable-fname.patch @@ -0,0 +1,47 @@ +From 14ad054e7baa788a6629385ffe5e0f1996b7de02 Mon Sep 17 00:00:00 2001 +From: Lianbo Jiang +Date: Fri, 23 Aug 2019 20:05:37 +0800 +Subject: [PATCH 2/5] Fix an error definition about the variable 'fname' + +The variable 'fname' is mistakenly defined two twice, the first definition +is in the vmcore-dmesg.c, and the second definition is in the elf_info.c. +That is confused and incorrect although it's a static type, because the +value of variable 'fname' is not assigned(set) in elf_info.c. Anyway, its +value will be always 'null' when printing an error information. + +Signed-off-by: Lianbo Jiang +Signed-off-by: Simon Horman +--- + util_lib/elf_info.c | 2 +- + vmcore-dmesg/vmcore-dmesg.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c +index d9397ecd8626..5d0efaafab53 100644 +--- a/util_lib/elf_info.c ++++ b/util_lib/elf_info.c +@@ -20,7 +20,7 @@ + /* The 32bit and 64bit note headers make it clear we don't care */ + typedef Elf32_Nhdr Elf_Nhdr; + +-static const char *fname; ++const char *fname; + static Elf64_Ehdr ehdr; + static Elf64_Phdr *phdr; + static int num_pt_loads; +diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c +index 7a386b380291..bebc348a657e 100644 +--- a/vmcore-dmesg/vmcore-dmesg.c ++++ b/vmcore-dmesg/vmcore-dmesg.c +@@ -3,7 +3,7 @@ + /* The 32bit and 64bit note headers make it clear we don't care */ + typedef Elf32_Nhdr Elf_Nhdr; + +-static const char *fname; ++extern const char *fname; + + int main(int argc, char **argv) + { +-- +2.17.1 + diff --git a/SOURCES/kexec-tools-2.0.20-Limit-the-size-of-vmcore-dmesg.txt-to-2G.patch b/SOURCES/kexec-tools-2.0.20-Limit-the-size-of-vmcore-dmesg.txt-to-2G.patch new file mode 100644 index 0000000..0146da0 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-Limit-the-size-of-vmcore-dmesg.txt-to-2G.patch @@ -0,0 +1,55 @@ +From fa3f0ed47f3e6dbee485722d13713ad495571b7e Mon Sep 17 00:00:00 2001 +From: Lianbo Jiang +Date: Fri, 23 Aug 2019 20:05:39 +0800 +Subject: [PATCH 4/5] Limit the size of vmcore-dmesg.txt to 2G + +With some corrupted vmcore files, the vmcore-dmesg.txt file may grow +forever till the kdump disk becomes full, and also probably causes +the disk error messages as follow: +... +sd 0:0:0:0: [sda] tag#6 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK +sd 0:0:0:0: [sda] tag#6 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00 +blk_update_request: I/O error, dev sda, sector 134630552 +sd 0:0:0:0: [sda] tag#7 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK +sd 0:0:0:0: [sda] tag#7 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00 +blk_update_request: I/O error, dev sda, sector 134630552 +... + +If vmcore-dmesg.txt occupies the whole disk, the vmcore can not be +saved, this is also a problem. + +Lets limit the size of vmcore-dmesg.txt to avoid such problems. + +Signed-off-by: Lianbo Jiang +Signed-off-by: Simon Horman +--- + vmcore-dmesg/vmcore-dmesg.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c +index fe7df8ec372c..81c2a58c9d86 100644 +--- a/vmcore-dmesg/vmcore-dmesg.c ++++ b/vmcore-dmesg/vmcore-dmesg.c +@@ -5,9 +5,19 @@ typedef Elf32_Nhdr Elf_Nhdr; + + extern const char *fname; + ++/* stole this macro from kernel printk.c */ ++#define LOG_BUF_LEN_MAX (uint32_t)(1 << 31) ++ + static void write_to_stdout(char *buf, unsigned int nr) + { + ssize_t ret; ++ static uint32_t n_bytes = 0; ++ ++ n_bytes += nr; ++ if (n_bytes > LOG_BUF_LEN_MAX) { ++ fprintf(stderr, "The vmcore-dmesg.txt over 2G in size is not supported.\n"); ++ exit(53); ++ } + + ret = write(STDOUT_FILENO, buf, nr); + if (ret != nr) { +-- +2.17.1 + diff --git a/SOURCES/kexec-tools-2.0.20-makedumpfile-Fix-off-by-one-issue-in-exclude_nodata_pages.patch b/SOURCES/kexec-tools-2.0.20-makedumpfile-Fix-off-by-one-issue-in-exclude_nodata_pages.patch new file mode 100644 index 0000000..454b3a3 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-makedumpfile-Fix-off-by-one-issue-in-exclude_nodata_pages.patch @@ -0,0 +1,42 @@ +From 56511628fa6714b189509b2842eadce0842bfeb5 Mon Sep 17 00:00:00 2001 +From: Mikhail Zaslonko +Date: Mon, 4 Nov 2019 14:05:15 +0100 +Subject: [PATCH] [PATCH] Fix off-by-one issue in exclude_nodata_pages() + +When building a dump bitmap (2nd bitmap) for the ELF dump, the last pfn +of the cycle is always ignored in exclude_nodata_pages() function due to +off-by-one error on cycle boundary check. Thus, the respective bit of +the bitmap is never cleared. + +That can lead to the error when such a pfn should not be dumpable (e.g. +the last pfn of the ELF-load of zero filesize). Based on the bit in the +bitmap the page is treated as dumpable in write_elf_pages_cyclic() function +and the follow on error is triggered in write_elf_load_segment() function +due to the failing sanity check of paddr_to_offset2(): + + $ makedumpfile -E dump.elf dump.elf.E + Checking for memory holes : [100.0 %] | + write_elf_load_segment: Can't convert physaddr(7ffff000) to an offset. + makedumpfile Failed. + +Signed-off-by: Mikhail Zaslonko +--- + makedumpfile.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c +index de0973f9e763..4a000112ba59 100644 +--- a/makedumpfile-1.6.6/makedumpfile.c ++++ b/makedumpfile-1.6.6/makedumpfile.c +@@ -4740,7 +4740,7 @@ exclude_nodata_pages(struct cycle *cycle) + if (pfn < cycle->start_pfn) + pfn = cycle->start_pfn; + if (pfn_end >= cycle->end_pfn) +- pfn_end = cycle->end_pfn - 1; ++ pfn_end = cycle->end_pfn; + while (pfn < pfn_end) { + clear_bit_on_2nd_bitmap(pfn, cycle); + ++pfn; +-- +2.17.1 + diff --git a/SOURCES/kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch b/SOURCES/kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch new file mode 100644 index 0000000..b9c5eff --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch @@ -0,0 +1,38 @@ +From 7bdb468c2c99dd780c9a5321f93c79cbfdce2527 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio +Date: Tue, 23 Jul 2019 12:24:47 -0400 +Subject: [PATCH] [PATCH] Increase SECTION_MAP_LAST_BIT to 4 + +kernel commit 326e1b8f83a4 ("mm/sparsemem: introduce a SECTION_IS_EARLY +flag") added the flag to mem_section->section_mem_map value, and it caused +makedumpfile an error like the following: + + readmem: Can't convert a virtual address(fffffc97d1000000) to physical address. + readmem: type_addr: 0, addr:fffffc97d1000000, size:32768 + __exclude_unnecessary_pages: Can't read the buffer of struct page. + create_2nd_bitmap: Can't exclude unnecessary pages. + +To fix this, SECTION_MAP_LAST_BIT needs to be updated. The bit has not +been used until the addition, so we can just increase the value. + +Signed-off-by: Kazuhito Hagio +--- + makedumpfile.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makedumpfile-1.6.6/makedumpfile.h b/makedumpfile-1.6.6/makedumpfile.h +index 24b2f69f400c..df745b9f53e5 100644 +--- a/makedumpfile-1.6.6/makedumpfile.h ++++ b/makedumpfile-1.6.6/makedumpfile.h +@@ -195,7 +195,7 @@ isAnon(unsigned long mapping) + * 2. it has been verified that (1UL<<2) was never set, so it is + * safe to mask that bit off even in old kernels. + */ +-#define SECTION_MAP_LAST_BIT (1UL<<3) ++#define SECTION_MAP_LAST_BIT (1UL<<4) + #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) + #define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT()) + #define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT()) +-- +2.17.2 + diff --git a/SOURCES/kexec-tools-2.0.20-makedumpfile-assign-bitmap1-2-fd-for-subprocess-in-non-cycl.patch b/SOURCES/kexec-tools-2.0.20-makedumpfile-assign-bitmap1-2-fd-for-subprocess-in-non-cycl.patch new file mode 100644 index 0000000..7f347cc --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-makedumpfile-assign-bitmap1-2-fd-for-subprocess-in-non-cycl.patch @@ -0,0 +1,44 @@ +From 5519b3eba68544dc484d85e9540d440d93f8c924 Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Tue, 3 Dec 2019 15:37:07 +0800 +Subject: [PATCH] [PATCH] assign bitmap1/2 fd for subprocess in non-cyclic mode + +In non-cyclic mode with the --split option, each subprocess inherits +bitmap1/2->fd from parent. Then they lseek()/read() on the same fd, +which means that they interfere with each other. + +This breaks the purpose of SPLITTING_FD_BITMAP(i) for each subprocess. +Without this patch, makedumpfile can fail with error like the following +in refiltering, or can break the dumpfile silently by excluding pages +wrongly. + + readpage_kdump_compressed: pfn(2fc1000) is excluded from vmcore. + readmem: type_addr: 1, addr:2fc1000000, size:4096 + read_pfn: Can't get the page data. + +Fix it by assigning a subprocess dedicated fd to bitmap1/2->fd. + +Signed-off-by: Pingfan Liu +Signed-off-by: Kazuhito Hagio +--- + makedumpfile.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c +index 43107d9..7586d7c 100644 +--- a/makedumpfile-1.6.6/makedumpfile.c ++++ b/makedumpfile-1.6.6/makedumpfile.c +@@ -10091,6 +10091,10 @@ writeout_multiple_dumpfiles(void) + info->split_start_pfn = SPLITTING_START_PFN(i); + info->split_end_pfn = SPLITTING_END_PFN(i); + ++ if (!info->flag_cyclic) { ++ info->bitmap1->fd = info->fd_bitmap; ++ info->bitmap2->fd = info->fd_bitmap; ++ } + if (!reopen_dump_memory()) + exit(1); + if ((status = writeout_dumpfile()) == FALSE) +-- +2.7.5 + diff --git a/SOURCES/kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option-wit.patch b/SOURCES/kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option-wit.patch new file mode 100644 index 0000000..343c83d --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option-wit.patch @@ -0,0 +1,41 @@ +From aa5ab4cf6c7335392094577380d2eaee8a0a8d52 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio +Date: Thu, 29 Aug 2019 12:26:34 -0400 +Subject: [PATCH] x86_64: Fix incorrect exclusion by -e option with KASLR + +The -e option uses info->vmemmap_start for creating a table to determine +the positions of page structures that should be excluded, but it is a +hardcoded value even with KASLR-enabled vmcore. As a result, the option +excludes incorrect pages from it. + +To fix this, get the vmemmap start address from info->mem_map_data. + +Signed-off-by: Kazuhito Hagio +--- + arch/x86_64.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/makedumpfile-1.6.6/arch/x86_64.c b/makedumpfile-1.6.6/arch/x86_64.c +index 3c0fdc5e72fb..4eeaf4925f43 100644 +--- a/makedumpfile-1.6.6/arch/x86_64.c ++++ b/makedumpfile-1.6.6/arch/x86_64.c +@@ -679,6 +679,16 @@ find_vmemmap_x86_64() + if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) + pmask &= ~(NUMBER(sme_mask)); + ++ /* ++ * vmemmap region can be randomized by KASLR. ++ * (currently we don't utilize info->vmemmap_end on x86_64.) ++ */ ++ if (info->mem_map_data && ++ info->mem_map_data[0].mem_map != NOT_MEMMAP_ADDR) ++ info->vmemmap_start = info->mem_map_data[0].mem_map; ++ ++ DEBUG_MSG("vmemmap_start: %16lx\n", info->vmemmap_start); ++ + pagestructsize = size_table.page; + hugepagesize = PTRS_PER_PMD * info->page_size; + vaddr_base = info->vmemmap_start; +-- +2.18.1 + diff --git a/SOURCES/kexec-tools-2.0.20-vmcore-dmesg-vmcore-dmesg.c-Fix-shifting-error-repor.patch b/SOURCES/kexec-tools-2.0.20-vmcore-dmesg-vmcore-dmesg.c-Fix-shifting-error-repor.patch new file mode 100644 index 0000000..e43b45a --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-vmcore-dmesg-vmcore-dmesg.c-Fix-shifting-error-repor.patch @@ -0,0 +1,38 @@ +From a46c686f615a86933134c0924c3391ba598a02b8 Mon Sep 17 00:00:00 2001 +From: Bhupesh Sharma +Date: Tue, 10 Sep 2019 15:51:49 +0530 +Subject: [PATCH 5/5] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported + by cppcheck + +Running 'cppcheck' static code analyzer (see cppcheck(1)) + on 'vmcore-dmesg/vmcore-dmesg.c' shows the following +shifting error: + +$ cppcheck --enable=all vmcore-dmesg/vmcore-dmesg.c +Checking vmcore-dmesg/vmcore-dmesg.c ... +[vmcore-dmesg/vmcore-dmesg.c:17]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour + +Fix the same via this patch. + +Signed-off-by: Bhupesh Sharma +Signed-off-by: Simon Horman +--- + vmcore-dmesg/vmcore-dmesg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c +index 81c2a58c9d86..122e53672e01 100644 +--- a/vmcore-dmesg/vmcore-dmesg.c ++++ b/vmcore-dmesg/vmcore-dmesg.c +@@ -6,7 +6,7 @@ typedef Elf32_Nhdr Elf_Nhdr; + extern const char *fname; + + /* stole this macro from kernel printk.c */ +-#define LOG_BUF_LEN_MAX (uint32_t)(1 << 31) ++#define LOG_BUF_LEN_MAX (uint32_t)(1U << 31) + + static void write_to_stdout(char *buf, unsigned int nr) + { +-- +2.17.1 + diff --git a/SOURCES/mkdumprd b/SOURCES/mkdumprd index e8529d6..cd1b592 100644 --- a/SOURCES/mkdumprd +++ b/SOURCES/mkdumprd @@ -108,9 +108,10 @@ to_mount() { fi #mount fs target as rw in 2nd kernel _options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g') - # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd - # kernel, filter it out here. + # filter out 'noauto' here, it will be force appended later, avoid duplication _options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g') + # only mount the dump target when needed. + _options="$_options,noauto" _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name @@ -425,10 +426,10 @@ do ssh) if strstr "$config_val" "@"; then - check_size ssh $config_val mkdir_save_path_ssh $config_val + check_size ssh $config_val add_dracut_module "ssh-client" - add_dracut_sshkey "$SSH_KEY_LOCATION" + add_dracut_sshkey "$SSH_KEY_LOCATION" else perror_exit "Bad ssh dump target $config_val" fi diff --git a/SOURCES/rhelonly-kexec-tools-2.0.16-koji-build-fail-workaround.patch b/SOURCES/rhelonly-kexec-tools-2.0.16-koji-build-fail-workaround.patch new file mode 100644 index 0000000..c406063 --- /dev/null +++ b/SOURCES/rhelonly-kexec-tools-2.0.16-koji-build-fail-workaround.patch @@ -0,0 +1,13 @@ +diff --git a/purgatory/Makefile b/purgatory/Makefile +index 49ce80a..97b7a03 100644 +--- a/purgatory/Makefile ++++ b/purgatory/Makefile +@@ -67,7 +67,7 @@ $(PURGATORY): $(PURGATORY_OBJS) + $(MKDIR) -p $(@D) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@.sym $^ + # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) +- $(STRIP) --strip-debug -o $@ $@.sym ++ $(STRIP) --strip-debug --no-merge-notes -o $@ $@.sym + + echo:: + @echo "PURGATORY_SRCS $(PURGATORY_SRCS)" diff --git a/SOURCES/rhelonly-kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch b/SOURCES/rhelonly-kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch new file mode 100644 index 0000000..0eee6ea --- /dev/null +++ b/SOURCES/rhelonly-kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch @@ -0,0 +1,51 @@ +From ce720608d5933e62f77f2c2f216859cf4f06adf8 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 13 Feb 2019 00:03:51 +0800 +Subject: [PATCH] Fix eppic issue with hardening flags + +This is stash of two commits: + +commit f98cf5fe07f390554696755f0a5843f6bb9c4716 +Author: ryncsn +Date: Tue Mar 19 13:39:25 2019 +0800 + + Tell gcc not to omit frame pointer + + After commit 0209874, it's now possible to enable optimization above O0. + But eppic might call __builtin_return_address(1). With O1, + -fomit-frame-pointer is enabled gcc may omit frame pointer. + __builtin_return_address(1) relies on callee preserves RBP as the stack + base, which is untrue if optimization is usded. In this case it may return + wrong value or crash. + + In case of any potential failure, use -fno-omit-frame-pointer globally. + + Signed-off-by: Kairui Song + +commit 0209874f4b46b8af5a2d42662ba6775cf5a1dc44 +Author: Kairui Song +Date: Wed Feb 13 00:03:51 2019 +0800 + + Drop O0 CFLAGS override in Makefile + +Signed-off-by: Kairui Song +--- + libeppic/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libeppic/Makefile b/libeppic/Makefile +index bcf2edf..8b97c87 100644 +--- a/eppic/libeppic/Makefile ++++ b/eppic/libeppic/Makefile +@@ -24,7 +24,7 @@ LDIRT = lex.eppic.c lex.eppicpp.c eppic.tab.c eppic.tab.h eppicpp.tab.c \ + LIBDIR = /usr/lib + TARGETS = libeppic.a + +-CFLAGS += -O0 -g -fPIC ++CFLAGS += -g -fno-omit-frame-pointer -fPIC + ifeq ($(TARGET), PPC64) + CFLAGS += -m64 + endif +-- +2.20.1 + diff --git a/SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-remove-lebl.patch b/SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-remove-lebl.patch new file mode 100644 index 0000000..ca63d82 --- /dev/null +++ b/SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-remove-lebl.patch @@ -0,0 +1,26 @@ +From 3beef142bc003d9cf2e957c6a21e51d661f9b13e Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Thu, 28 Nov 2019 21:23:00 +0800 +Subject: [PATCH] makedumpfile: remove -lebl + +Signed-off-by: Pingfan Liu +--- + makedumpfile-1.6.6/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makedumpfile-1.6.6/Makefile b/makedumpfile-1.6.6/Makefile +index 1fdb628..df21b93 100644 +--- a/makedumpfile-1.6.6/Makefile ++++ b/makedumpfile-1.6.6/Makefile +@@ -50,7 +50,7 @@ OBJ_PART=$(patsubst %.c,%.o,$(SRC_PART)) + SRC_ARCH = arch/arm.c arch/arm64.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c arch/sparc64.c + OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH)) + +-LIBS = -ldw -lbz2 -lebl -ldl -lelf -lz ++LIBS = -ldw -lbz2 -ldl -lelf -lz + ifneq ($(LINKTYPE), dynamic) + LIBS := -static $(LIBS) + endif +-- +2.20.1 + diff --git a/SOURCES/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch b/SOURCES/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch index 014de57..dad84d1 100644 --- a/SOURCES/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch +++ b/SOURCES/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch @@ -1,4 +1,3 @@ -From 54d6ee9d9d4ee807de32ad490040cbb9a3055a09 Mon Sep 17 00:00:00 2001 From: Bhupesh Sharma Date: Wed, 6 Feb 2019 12:31:29 +0530 Subject: [PATCH] makedumpfile/arm64: Add support for ARMv8.2-LVA (52-bit @@ -36,16 +35,17 @@ version D.a http://lists.infradead.org/pipermail/kexec/2019-February/022411.html Signed-off-by: Bhupesh Sharma + --- arch/arm64.c | 109 ++++++++++++++++++++++++++++++++++++++++++--------------- makedumpfile.c | 2 ++ makedumpfile.h | 1 + 3 files changed, 83 insertions(+), 29 deletions(-) -diff --git a/makedumpfile-1.6.5/arch/arm64.c b/makedumpfile-1.6.5/arch/arm64.c -index 053519359cbc..5fcf59d36fed 100644 ---- a/makedumpfile-1.6.5/arch/arm64.c -+++ b/makedumpfile-1.6.5/arch/arm64.c +diff --git a/makedumpfile-1.6.6/arch/arm64.c b/makedumpfile-1.6.6/arch/arm64.c +index 0535193..5fcf59d 100644 +--- a/makedumpfile-1.6.6/arch/arm64.c ++++ b/makedumpfile-1.6.6/arch/arm64.c @@ -41,6 +41,7 @@ typedef struct { static int pgtable_level; @@ -198,11 +198,11 @@ index 053519359cbc..5fcf59d36fed 100644 return TRUE; } -diff --git a/makedumpfile-1.6.5/makedumpfile.c b/makedumpfile-1.6.5/makedumpfile.c -index 590f759c84f1..b9085247375e 100644 ---- a/makedumpfile-1.6.5/makedumpfile.c -+++ b/makedumpfile-1.6.5/makedumpfile.c -@@ -2312,6 +2312,7 @@ write_vmcoreinfo_data(void) +diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c +index d76a435..c8906b5 100644 +--- a/makedumpfile-1.6.6/makedumpfile.c ++++ b/makedumpfile-1.6.6/makedumpfile.c +@@ -2313,6 +2313,7 @@ write_vmcoreinfo_data(void) WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR); #ifdef __aarch64__ @@ -210,26 +210,26 @@ index 590f759c84f1..b9085247375e 100644 WRITE_NUMBER("VA_BITS", VA_BITS); WRITE_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET); WRITE_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset); -@@ -2717,6 +2718,7 @@ read_vmcoreinfo(void) - READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE); +@@ -2719,6 +2720,7 @@ read_vmcoreinfo(void) READ_NUMBER("phys_base", phys_base); + READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE); #ifdef __aarch64__ + READ_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS); READ_NUMBER("VA_BITS", VA_BITS); READ_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET); READ_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset); -diff --git a/makedumpfile-1.6.5/makedumpfile.h b/makedumpfile-1.6.5/makedumpfile.h -index 5ad38e9ae40c..311ac05a28ab 100644 ---- a/makedumpfile-1.6.5/makedumpfile.h -+++ b/makedumpfile-1.6.5/makedumpfile.h -@@ -1935,6 +1935,7 @@ struct number_table { - long HUGETLB_PAGE_DTOR; +diff --git a/makedumpfile-1.6.6/makedumpfile.h b/makedumpfile-1.6.6/makedumpfile.h +index 24b2f69..cccb52a 100644 +--- a/makedumpfile-1.6.6/makedumpfile.h ++++ b/makedumpfile-1.6.6/makedumpfile.h +@@ -1937,6 +1937,7 @@ struct number_table { long phys_base; + long KERNEL_IMAGE_SIZE; #ifdef __aarch64__ + long MAX_USER_VA_BITS; long VA_BITS; unsigned long PHYS_OFFSET; unsigned long kimage_voffset; -- -2.7.4 +2.7.5 diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec index c38bde7..1df65a1 100644 --- a/SPECS/kexec-tools.spec +++ b/SPECS/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools -Version: 2.0.19 -Release: 7%{?dist} +Version: 2.0.20 +Release: 9%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -13,7 +13,7 @@ Source4: kdump.sysconfig.i386 Source5: kdump.sysconfig.ppc64 Source7: mkdumprd Source8: kdump.conf -Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/makedumpfile-1.6.5.tar.gz +Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.6/makedumpfile-1.6.6.tar.gz Source10: kexec-kdump-howto.txt Source12: mkdumprd.8 Source13: 98-kexec.rules @@ -53,11 +53,11 @@ Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(pre): coreutils sed zlib -Requires: dracut >= 049 +Requires: dracut >= 049-24 Requires: dracut-network >= 049 Requires: dracut-squash >= 049 Requires: ethtool -BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel +BuildRequires: zlib-devel zlib zlib-static elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel BuildRequires: pkgconfig intltool gettext BuildRequires: systemd-units BuildRequires: automake autoconf libtool @@ -65,6 +65,8 @@ BuildRequires: automake autoconf libtool Obsoletes: diskdumputils netdump kexec-tools-eppic %endif +ExcludeArch: i686 + #START INSERT # @@ -74,8 +76,7 @@ Obsoletes: diskdumputils netdump kexec-tools-eppic # # Patches 101 through 200 are meant for x86_64 kexec-tools enablement # -Patch101: kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch -Patch102: kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch + # # Patches 301 through 400 are meant for ppc64 kexec-tools enablement # @@ -90,16 +91,24 @@ Patch102: kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Mem # # Patches 601 onward are generic patches # -Patch601: kexec-tools-2.0.16-koji-build-fail-workaround.patch -Patch603: kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch -Patch604: kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch -Patch605: kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch -Patch606: rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch +Patch601: rhelonly-kexec-tools-2.0.16-koji-build-fail-workaround.patch +Patch602: rhelonly-kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch +Patch603: rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch +Patch604: kexec-tools-2.0.20-makedumpfile-x86_64-Fix-incorrect-exclusion-by-e-option-wit.patch +Patch605: kexec-tools-2.0.20-Cleanup-remove-the-read_elf_kcore.patch +Patch606: kexec-tools-2.0.20-Fix-an-error-definition-about-the-variable-fname.patch +Patch607: kexec-tools-2.0.20-Cleanup-move-it-back-from-util_lib-elf_info.c.patch +Patch608: kexec-tools-2.0.20-Limit-the-size-of-vmcore-dmesg.txt-to-2G.patch +Patch609: kexec-tools-2.0.20-vmcore-dmesg-vmcore-dmesg.c-Fix-shifting-error-repor.patch +Patch610: kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch +Patch611: kexec-tools-2.0.20-makedumpfile-Fix-off-by-one-issue-in-exclude_nodata_pages.patch +Patch612: rhelonly-kexec-tools-2.0.20-makedumpfile-remove-lebl.patch +Patch613: kexec-tools-2.0.20-makedumpfile-assign-bitmap1-2-fd-for-subprocess-in-non-cycl.patch %description -kexec-tools provides /sbin/kexec binary that facilitates a new +kexec-tools provides /usr/sbin/kexec binary that facilitates a new kernel to boot using the kernel's kexec feature either on a -normal or a panic reboot. This package contains the /sbin/kexec +normal or a panic reboot. This package contains the /usr/sbin/kexec binary and ancillary utilities that together form the userspace component of the kernel's kexec feature. @@ -110,13 +119,19 @@ mkdir -p -m755 kcp tar -z -x -v -f %{SOURCE9} tar -z -x -v -f %{SOURCE19} -%patch101 -p1 %patch601 -p1 +%patch602 -p1 %patch603 -p1 %patch604 -p1 %patch605 -p1 %patch606 -p1 -%patch102 -p1 +%patch607 -p1 +%patch608 -p1 +%patch609 -p1 +%patch610 -p1 +%patch611 -p1 +%patch612 -p1 +%patch613 -p1 %ifarch ppc %define archdef ARCH=ppc @@ -133,7 +148,7 @@ autoreconf --host=powerpc64le-redhat-linux-gnu \ --build=powerpc64le-redhat-linux-gnu \ %endif - --sbindir=/sbin + --sbindir=/usr/sbin rm -f kexec-tools.spec.in # setup the docs cp %{SOURCE10} . @@ -145,12 +160,12 @@ cp %{SOURCE28} . make %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 make -C eppic/libeppic -make -C makedumpfile-1.6.5 LINKTYPE=dynamic USELZO=on USESNAPPY=on -make -C makedumpfile-1.6.5 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so +make -C makedumpfile-1.6.6 LINKTYPE=dynamic USELZO=on USESNAPPY=on +make -C makedumpfile-1.6.6 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so %endif %install -mkdir -p -m755 $RPM_BUILD_ROOT/sbin +mkdir -p -m755 $RPM_BUILD_ROOT/usr/sbin mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig mkdir -p -m755 $RPM_BUILD_ROOT%{_localstatedir}/crash mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man8/ @@ -164,8 +179,8 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir} mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl -install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/sbin/kexec -install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/sbin/vmcore-dmesg +install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/usr/sbin/kexec +install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/usr/sbin/vmcore-dmesg install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/ install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/ @@ -174,7 +189,7 @@ SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu} [ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump -install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/sbin/mkdumprd +install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 @@ -197,13 +212,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 %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 -install -m 755 makedumpfile-1.6.5/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile -install -m 644 makedumpfile-1.6.5/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz -install -m 644 makedumpfile-1.6.5/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz -install -m 644 makedumpfile-1.6.5/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample -install -m 755 makedumpfile-1.6.5/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so +install -m 755 makedumpfile-1.6.6/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile +install -m 644 makedumpfile-1.6.6/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz +install -m 644 makedumpfile-1.6.6/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz +install -m 644 makedumpfile-1.6.6/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample +install -m 755 makedumpfile-1.6.6/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ -install -m 644 makedumpfile-1.6.5/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ +install -m 644 makedumpfile-1.6.6/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ %endif %define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g') @@ -275,7 +290,7 @@ fi /usr/bin/systemd-sysv-convert --save kdump >/dev/null 2>&1 ||: # Run these because the SysV package being removed won't do them -/sbin/chkconfig --del kdump >/dev/null 2>&1 || : +/usr/sbin/chkconfig --del kdump >/dev/null 2>&1 || : /bin/systemctl try-restart kdump.service >/dev/null 2>&1 || : @@ -302,10 +317,10 @@ do done %files -/sbin/kexec -/sbin/makedumpfile -/sbin/mkdumprd -/sbin/vmcore-dmesg +/usr/sbin/kexec +/usr/sbin/makedumpfile +/usr/sbin/mkdumprd +/usr/sbin/vmcore-dmesg %{_bindir}/* %{_datadir}/kdump %{_prefix}/lib/kdump @@ -313,7 +328,7 @@ done %{_sysconfdir}/makedumpfile.conf.sample %endif %config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump -%config(noreplace,missingok) %{_sysconfdir}/kdump.conf +%config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf %ifnarch s390x %config %{_udevrulesdir} %{_udevrulesdir}/../kdump-udev-throttler @@ -342,6 +357,63 @@ done %endif %changelog +* Thu Dec 12 2019 Pingfan Liu - 2.0.20-9 +- makedumpfile: assign bitmap1/2 fd for subprocess in non-cyclic mode + +* Mon Dec 2 2019 Pingfan Liu - 2.0.20-8 +- makedumpfile: remove -lebl + +* Thu Nov 28 2019 Pingfan Liu - 2.0.20-7 +- makedumpfile: Fix off-by-one issue in exclude_nodata_pages() + +* Wed Nov 27 2019 Pingfan Liu - 2.0.20-6 +-rhel-8.2.0, origin/rhel-8.2.0) Increase SECTION_MAP_LAST_BIT to 4 +- spec: move binaries from /sbin to /usr/sbin +- As /etc/kdump.conf timestamp is updated do not compare it when doing rpm --verify +- kdumpctl: make reload fail proof + +* Tue Nov 12 2019 Pingfan Liu - 2.0.20-5 +- Don't execute final_action if failure_action terminates the system +- module-setup: re-fix 99kdumpbase network dependency +- kdumpctl: bail out immediately if host key verification failed +- kdumpctl: echo msg when waiting for connection +- kdumpctl: distinguish the failed reason of ssh +- kdumpctl: wait a while for network ready if dump target is ssh +- dracut-module-setup: filter out localhost for generic_fence_kdump +- dracut-module-setup: get localhost alias by manual + +* Mon Oct 28 2019 Pingfan Liu - 2.0.19-12.4 +- dracut-module-setup.sh: Don't use squash module for fadump +- Don't mount the dump target unless needed +- dracut-module-setup: fix bond ifcfg processing +- Doc: amend the man page of kdump.conf + +* Mon Oct 28 2019 Pingfan Liu - 2.0.19-12.3 +- Limit the size of vmcore-dmesg.txt to 2G +- makedumpfile: x86_64: Fix incorrect exclusion by -e option with KASLR +- mkdumprd: ensure ssh path exists before check size + +* Fri Oct 18 2019 Pingfan Liu - 2.0.19-12.2 +- rebase to kexec-tools-2.0.20 and makedumpfile-1.6.6 + +* Fri Aug 9 2019 Pingfan Liu - 2.0.19-12 +- Don't forward and drop journalctl logs for fadump + +* Mon Aug 5 2019 Pingfan Liu - 2.0.19-11 +- Drop switch root capability for non fadump initramfs + +* Mon Aug 5 2019 Pingfan Liu - 2.0.19-10 +- Forward logs in kdump kernel to console directly + +* Fri Jul 19 2019 Pingfan Liu - 2.0.19-9 +- kexec/arm64: Add support for handling zlib compressed (Image.gz) image +- kexec/kexec-zlib.h: Add 'is_zlib_file()' helper function +- kexec-uImage-arm64.c: Fix return value of uImage_arm64_probe() +- kexec/kexec.c: Add the missing close() for fd used for kexec_file_load() + +* Sun Jul 14 2019 Pingfan Liu - 2.0.19-8 +- kdump.sysconfig/x86_64: Disable HEST by default + * Mon Jun 17 2019 Kairui Song - 2.0.19-7 - dracut-kdump-capture.service: Use OnFailureJobMode instead of deprecated OnFailureIsolate