diff --git a/.gitignore b/.gitignore index 1ec8a4b..297060f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ SOURCES/eppic_050615.tar.gz -SOURCES/kexec-tools-2.0.17.tar.xz -SOURCES/makedumpfile-1.6.4.tar.gz +SOURCES/kexec-tools-2.0.19.tar.xz +SOURCES/makedumpfile-1.6.5.tar.gz diff --git a/.kexec-tools.metadata b/.kexec-tools.metadata index aa72527..b43204b 100644 --- a/.kexec-tools.metadata +++ b/.kexec-tools.metadata @@ -1,3 +1,3 @@ a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz -8936b2e0eea3334c656a0004d514ed9795691393 SOURCES/kexec-tools-2.0.17.tar.xz -2ec04ae267c7a216193c1c7a227aca78fe40a3fd SOURCES/makedumpfile-1.6.4.tar.gz +5d080337da7a1603e542fc3db1f08cf8685eda02 SOURCES/kexec-tools-2.0.19.tar.xz +700f2ff13f75d97a0df2303ff9f580cdddadf7b0 SOURCES/makedumpfile-1.6.5.tar.gz diff --git a/SOURCES/98-kexec.rules.ppc64 b/SOURCES/98-kexec.rules.ppc64 new file mode 100644 index 0000000..1a91220 --- /dev/null +++ b/SOURCES/98-kexec.rules.ppc64 @@ -0,0 +1,15 @@ +SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload" +SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload" +SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload" + +GOTO="kdump_reload_end" + +LABEL="kdump_reload" + +# If kdump is not loaded, calling kdump-udev-throttle will end up +# doing nothing, but systemd-run will always generate extra logs for +# each call, so trigger the kdump-udev-throttler only if kdump +# service is active to avoid unnecessary logs +RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'" + +LABEL="kdump_reload_end" diff --git a/SOURCES/dracut-early-kdump-module-setup.sh b/SOURCES/dracut-early-kdump-module-setup.sh index a004a49..e069867 100755 --- a/SOURCES/dracut-early-kdump-module-setup.sh +++ b/SOURCES/dracut-early-kdump-module-setup.sh @@ -24,6 +24,10 @@ prepare_kernel_initrd() { KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}") if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` + if [ "$kernel" != "$kdump_kver" ]; then + dwarn "Using current kernel version '$kdump_kver' for early kdump," \ + "but the initramfs is generated for kernel version '$kernel'" + fi else kdump_kver=$KDUMP_KERNELVER fi @@ -32,14 +36,30 @@ prepare_kernel_initrd() { } install() { + prepare_kernel_initrd + if [ ! -f "$KDUMP_KERNEL" ]; then + derror "Could not find required kernel for earlykdump," \ + "earlykdump will not work!" + return 1 + fi + if [ ! -f "$KDUMP_INITRD" ]; then + derror "Could not find required kdump initramfs for earlykdump," \ + "please ensure kdump initramfs is generated first," \ + "earlykdump will not work!" + return 1 + fi + inst_multiple tail find cut dirname hexdump inst_simple "/etc/sysconfig/kdump" inst_binary "/usr/sbin/kexec" inst_binary "/usr/bin/gawk" "/usr/bin/awk" inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh" inst_hook cmdline 00 "$moddir/early-kdump.sh" - prepare_kernel_initrd inst_binary "$KDUMP_KERNEL" inst_binary "$KDUMP_INITRD" + + ln_r "$KDUMP_KERNEL" "${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}" + ln_r "$KDUMP_INITRD" "${KDUMP_BOOTDIR}/initramfs-earlykdump.img" + chmod -x "${initdir}/$KDUMP_KERNEL" } diff --git a/SOURCES/dracut-early-kdump.sh b/SOURCES/dracut-early-kdump.sh index 34a9909..69a34eb 100755 --- a/SOURCES/dracut-early-kdump.sh +++ b/SOURCES/dracut-early-kdump.sh @@ -18,17 +18,8 @@ prepare_parameters() EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}") KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}") - #make early-kdump kernel string - if [ -z "$KDUMP_KERNELVER" ]; then - EARLY_KDUMP_KERNELVER=`uname -r` - else - EARLY_KDUMP_KERNELVER=$KDUMP_KERNELVER - fi - - EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${EARLY_KDUMP_KERNELVER}${KDUMP_IMG_EXT}" - - #make early-kdump initrd string - EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-${EARLY_KDUMP_KERNELVER}kdump.img" + EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}" + EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-earlykdump.img" } early_kdump_load() diff --git a/SOURCES/dracut-kdump-capture.service b/SOURCES/dracut-kdump-capture.service index 57139c9..3f20aba 100644 --- a/SOURCES/dracut-kdump-capture.service +++ b/SOURCES/dracut-kdump-capture.service @@ -12,7 +12,7 @@ After=dracut-initqueue.service dracut-pre-mount.service dracut-mount.service dra Before=initrd-cleanup.service ConditionPathExists=/etc/initrd-release OnFailure=emergency.target -OnFailureIsolate=yes +OnFailureJobMode=isolate [Service] Environment=DRACUT_SYSTEMD=1 diff --git a/SOURCES/dracut-kdump-error-handler.service b/SOURCES/dracut-kdump-error-handler.service index 13090be..32b74ab 100644 --- a/SOURCES/dracut-kdump-error-handler.service +++ b/SOURCES/dracut-kdump-error-handler.service @@ -6,7 +6,7 @@ # (at your option) any later version. # This service will run the real kdump error handler code. Executing the -# default action configured in kdump.conf +# failure action configured in kdump.conf [Unit] Description=Kdump Error Handler diff --git a/SOURCES/dracut-kdump-error-handler.sh b/SOURCES/dracut-kdump-error-handler.sh index 2f0f1d1..fc2b932 100755 --- a/SOURCES/dracut-kdump-error-handler.sh +++ b/SOURCES/dracut-kdump-error-handler.sh @@ -6,5 +6,5 @@ set -o pipefail export PATH=$PATH:$KDUMP_SCRIPT_DIR get_kdump_confs -do_default_action +do_failure_action do_final_action diff --git a/SOURCES/dracut-kdump.sh b/SOURCES/dracut-kdump.sh index b75c2a5..2ae1c7c 100755 --- a/SOURCES/dracut-kdump.sh +++ b/SOURCES/dracut-kdump.sh @@ -144,7 +144,6 @@ read_kdump_conf() while read config_opt config_val; do # remove inline comments after the end of a directive. - config_val=$(strip_comments $config_val) case "$config_opt" in dracut_args) config_val=$(get_dracut_args_target "$config_val") @@ -160,7 +159,7 @@ read_kdump_conf() add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val" ;; esac - done < $KDUMP_CONF + done <<< "$(read_strip_comments $KDUMP_CONF)" } fence_kdump_notify() diff --git a/SOURCES/dracut-module-setup.sh b/SOURCES/dracut-module-setup.sh index ce66e6b..21a357d 100755 --- a/SOURCES/dracut-module-setup.sh +++ b/SOURCES/dracut-module-setup.sh @@ -462,7 +462,6 @@ kdump_install_conf() { while read _opt _val; do # remove inline comments after the end of a directive. - _val=$(strip_comments $_val) case "$_opt" in raw) _pdev=$(persistent_policy="by-id" kdump_get_persistent_dev $_val) @@ -490,7 +489,7 @@ kdump_install_conf() { dracut_install "${_val%%[[:blank:]]*}" ;; esac - done < /etc/kdump.conf + done <<< "$(read_strip_comments /etc/kdump.conf)" default_dump_target_install_conf @@ -802,4 +801,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/early-kdump-howto.txt b/SOURCES/early-kdump-howto.txt index fe4f13f..b8cab6a 100644 --- a/SOURCES/early-kdump-howto.txt +++ b/SOURCES/early-kdump-howto.txt @@ -1,6 +1,7 @@ Early Kdump HOWTO Introduction +------------ Kdump service starts too late, so early crashes will have no chance to get kdump kernel booting, this will cause crash information to be lost. It is @@ -12,7 +13,8 @@ which is disabled by default. For the normal kdump service, it can check whether the early kdump has loaded the crash kernel and initramfs. It has no conflict with the early kdump. -How to configure early kdump: +How to configure early kdump +---------------------------- We assume if you're reading this document, you should already have kexec-tools installed. @@ -21,15 +23,32 @@ You can rebuild the initramfs with earlykdump support with below steps: 1. start kdump service to make sure kdump initramfs is created. # systemctl start kdump + NOTE: If a crash occurs during boot process, early kdump captures a vmcore + and reboot the system by default, so the system might go into crash loop. + You can avoid such a crash loop by adding the following settings, which + power off the system after dump capturing, to kdump.conf in advance: + + final_action poweroff + failure_action poweroff + + For the failure_action, you can choose anything other than "reboot". + 2. rebuild system initramfs with earlykdump support. # dracut --add earlykdump 3. add rd.earlykdump in grub kernel command line. -Note: earlykdump initramfs size will be large because it includes vmlinuz and +Note: +[1]. Early kdump initramfs size will be large because it includes vmlinuz and kdump initramfs. And for step 2 if you are sure to overwrite system initramfs you can backup the original initramfs and use "--force" option. +[2]. Early kdump inherits the settings of normal kdump, so any changes that +caused normal kdump rebuilding also require rebuilding the system initramfs +to make sure that the changes take effect for early kdump. Therefore, after +the rebuilding of kdump initramfs is completed, provide a prompt message to +tell the fact. + After making said changes, reboot your system to take effect. Of course, if you want to disable early kdump, you can simply remove "rd.earlykdump" from kernel boot parameters in grub, and reboot system like above. @@ -50,5 +69,6 @@ kdump kernel Mar 09 10:02:47 localhost.localdomain dracut-cmdline[189]: early-kdump is disabled. Limitation +---------- At present, early kdump doesn't support fadump. diff --git a/SOURCES/kdump-lib-initramfs.sh b/SOURCES/kdump-lib-initramfs.sh index 7ba99b6..817ba01 100755 --- a/SOURCES/kdump-lib-initramfs.sh +++ b/SOURCES/kdump-lib-initramfs.sh @@ -6,7 +6,7 @@ KDUMP_PATH="/var/crash" CORE_COLLECTOR="" DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 1 -d 31" DMESG_COLLECTOR="/sbin/vmcore-dmesg" -DEFAULT_ACTION="systemctl reboot -f" +FAILURE_ACTION="systemctl reboot -f" DATEDIR=`date +%Y-%m-%d-%T` HOST_IP='127.0.0.1' DUMP_INSTRUCTION="" @@ -26,7 +26,6 @@ get_kdump_confs() while read config_opt config_val; do # remove inline comments after the end of a directive. - config_val=$(strip_comments $config_val) case "$config_opt" in path) KDUMP_PATH="$config_val" @@ -51,27 +50,40 @@ get_kdump_confs() fence_kdump_nodes) FENCE_KDUMP_NODES="$config_val" ;; - default) + failure_action|default) case $config_val in shell) - DEFAULT_ACTION="kdump_emergency_shell" + FAILURE_ACTION="kdump_emergency_shell" ;; reboot) - DEFAULT_ACTION="systemctl reboot -f" + FAILURE_ACTION="systemctl reboot -f" ;; halt) - DEFAULT_ACTION="halt" + FAILURE_ACTION="halt" ;; poweroff) - DEFAULT_ACTION="systemctl poweroff -f" + FAILURE_ACTION="systemctl poweroff -f" ;; dump_to_rootfs) - DEFAULT_ACTION="dump_to_rootfs" + FAILURE_ACTION="dump_to_rootfs" + ;; + esac + ;; + final_action) + case $config_val in + reboot) + FINAL_ACTION="systemctl reboot -f" + ;; + halt) + FINAL_ACTION="halt" + ;; + poweroff) + FINAL_ACTION="systemctl poweroff -f" ;; esac ;; esac - done < $KDUMP_CONF + done <<< "$(read_strip_comments $KDUMP_CONF)" if [ -z "$CORE_COLLECTOR" ]; then CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR" @@ -153,10 +165,10 @@ kdump_emergency_shell() rm -f /etc/profile } -do_default_action() +do_failure_action() { - echo "Kdump: Executing default action $DEFAULT_ACTION" - eval $DEFAULT_ACTION + echo "Kdump: Executing failure action $FAILURE_ACTION" + eval $FAILURE_ACTION } do_final_action() diff --git a/SOURCES/kdump-lib.sh b/SOURCES/kdump-lib.sh index 5ad176e..ef0151f 100755 --- a/SOURCES/kdump-lib.sh +++ b/SOURCES/kdump-lib.sh @@ -61,6 +61,14 @@ strip_comments() echo $@ | sed -e 's/\(.*\)#.*/\1/' } +# Read from kdump config file stripping all comments +read_strip_comments() +{ + # strip heading spaces, and print any content starting with + # neither space or #, and strip everything after # + sed -n -e "s/^\s*\([^# \t][^#]\+\).*/\1/gp" $1 +} + # Check if fence kdump is configured in Pacemaker cluster is_pcs_fence_kdump() { @@ -149,10 +157,10 @@ get_block_dump_target() is_dump_to_rootfs() { - grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null + grep -E "^(failure_action|default)[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null } -get_default_action_target() +get_failure_action_target() { local _target @@ -181,7 +189,7 @@ get_kdump_targets() fi # Add the root device if dump_to_rootfs is specified. - _root=$(get_default_action_target) + _root=$(get_failure_action_target) if [ -n "$_root" -a "$kdump_targets" != "$_root" ]; then kdump_targets="$kdump_targets $_root" fi diff --git a/SOURCES/kdump.conf b/SOURCES/kdump.conf index 57af7b6..2b2fc89 100644 --- a/SOURCES/kdump.conf +++ b/SOURCES/kdump.conf @@ -6,8 +6,8 @@ # processed. # # Currently, only one dump target and path can be specified. If the dumping to -# the configured target fails, the default action which can be configured via -# the "default" directive will be performed. +# the configured target fails, the failure action which can be configured via +# the "failure_action" directive will be performed. # # Supported options: # @@ -99,17 +99,29 @@ # Multiple modules can be listed, separated by spaces, and any # dependent modules will automatically be included. # -# default +# failure_action # - Action to perform in case dumping fails. # reboot: Reboot the system. # halt: Halt the system. # poweroff: Power down the system. # shell: Drop to a bash shell. -# Exiting the shell reboots the system. +# Exiting the shell reboots the system by default, +# or perform "final_action". # dump_to_rootfs: Dump vmcore to rootfs from initramfs context and -# reboot. Useful when non-root dump target is specified. +# reboot by default or perform "final_action". +# Useful when non-root dump target is specified. # The default option is "reboot". # +# default +# - Same as the "failure_action" directive above, but this directive +# is obsolete and will be removed in the future. +# +# final_action +# - Action to perform in case dumping succeeds. Also performed +# when "shell" or "dump_to_rootfs" failure action finishes. +# Each action is same as the "failure_action" directive above. +# The default is "reboot". +# # force_rebuild <0 | 1> # - By default, kdump initrd will only be rebuilt when necessary. # Specify 1 to force rebuilding kdump initrd every time when kdump @@ -155,7 +167,7 @@ core_collector makedumpfile -l --message-level 1 -d 31 #kdump_pre /var/crash/scripts/kdump-pre.sh #extra_bins /usr/bin/lftp #extra_modules gfs2 -#default shell +#failure_action shell #force_rebuild 1 #force_no_rebuild 1 #dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" diff --git a/SOURCES/kdump.conf.5 b/SOURCES/kdump.conf.5 index 11b1fad..fda3770 100644 --- a/SOURCES/kdump.conf.5 +++ b/SOURCES/kdump.conf.5 @@ -148,16 +148,32 @@ modules can be listed, separated by spaces, and any dependent modules will automatically be included. .RE -.B default +.B failure_action .RS Action to perform in case dumping to the intended target fails. The default is "reboot". reboot: Reboot the system (this is what most people will want, as it returns the system to a normal state). halt: Halt the system and lose the vmcore. poweroff: The system will be powered down. shell: Drop to a shell session inside the initramfs, from which you can manually perform additional recovery actions. Exiting this shell reboots the -system. Note: kdump uses bash as the default shell. dump_to_rootfs: If non-root dump -target is specified, the default action can be set as dump_to_rootfs. That means when -dumping to target fails, dump vmcore to rootfs from initramfs context and reboot. +system by default or performs "final_action". +Note: kdump uses bash as the default shell. dump_to_rootfs: If non-root dump +target is specified, the failure action can be set as dump_to_rootfs. That means when +dumping to target fails, dump vmcore to rootfs from initramfs context and reboot +by default or perform "final_action". +.RE + +.B default +.RS +Same as the "failure_action" directive above, but this directive is obsolete +and will be removed in the future. +.RE + +.B final_action +.RS +Action to perform in case dumping to the intended target succeeds. +Also performed when "shell" or "dump_to_rootfs" failure action finishes. +Each action is same as the "failure_action" directive above. +The default is "reboot". .RE .B force_rebuild <0 | 1> diff --git a/SOURCES/kdump.sysconfig b/SOURCES/kdump.sysconfig index ffe1df8..df518d6 100644 --- a/SOURCES/kdump.sysconfig +++ b/SOURCES/kdump.sysconfig @@ -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 maxcpus=1 reset_devices" +KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd" # Any additional kexec arguments required. In most situations, this should # be left empty diff --git a/SOURCES/kdump.sysconfig.aarch64 b/SOURCES/kdump.sysconfig.aarch64 index 0a6b14c..d5d7624 100644 --- a/SOURCES/kdump.sysconfig.aarch64 +++ b/SOURCES/kdump.sysconfig.aarch64 @@ -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 swiotlb=noforce reset_devices" +KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd" # Any additional kexec arguments required. In most situations, this should # be left empty diff --git a/SOURCES/kdump.sysconfig.i386 b/SOURCES/kdump.sysconfig.i386 index 18c407e..976aea6 100644 --- a/SOURCES/kdump.sysconfig.i386 +++ b/SOURCES/kdump.sysconfig.i386 @@ -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 numa=off udev.children-max=2 panic=10 rootflags=nofail transparent_hugepage=never" +KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 rootflags=nofail transparent_hugepage=never novmcoredd" # Any additional kexec arguments required. In most situations, this should # be left empty diff --git a/SOURCES/kdump.sysconfig.ppc64 b/SOURCES/kdump.sysconfig.ppc64 index 55a01cc..6ddfc3d 100644 --- a/SOURCES/kdump.sysconfig.ppc64 +++ b/SOURCES/kdump.sysconfig.ppc64 @@ -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 maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never" +KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd" # Any additional kexec arguments required. In most situations, this should # be left empty diff --git a/SOURCES/kdump.sysconfig.ppc64le b/SOURCES/kdump.sysconfig.ppc64le index 55a01cc..6ddfc3d 100644 --- a/SOURCES/kdump.sysconfig.ppc64le +++ b/SOURCES/kdump.sysconfig.ppc64le @@ -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 maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never" +KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd" # Any additional kexec arguments required. In most situations, this should # be left empty diff --git a/SOURCES/kdump.sysconfig.s390x b/SOURCES/kdump.sysconfig.s390x index b3aec3c..68705f9 100644 --- a/SOURCES/kdump.sysconfig.s390x +++ b/SOURCES/kdump.sysconfig.s390x @@ -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="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 rootflags=nofail transparent_hugepage=never" +KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 rootflags=nofail transparent_hugepage=never novmcoredd" # Any additional /sbin/mkdumprd arguments required. MKDUMPRD_ARGS="" diff --git a/SOURCES/kdump.sysconfig.x86_64 b/SOURCES/kdump.sysconfig.x86_64 index f269d02..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" +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 fe6af22..c6c1736 100755 --- a/SOURCES/kdumpctl +++ b/SOURCES/kdumpctl @@ -94,7 +94,7 @@ rebuild_fadump_initrd() # this file tells the initrd is fadump enabled touch /tmp/fadump.initramfs target_initrd_tmp="$TARGET_INITRD.tmp" - $MKDUMPRD $target_initrd_tmp --rebuild $TARGET_INITRD --kver $kdump_kver \ + $MKDUMPRD $target_initrd_tmp --rebuild $DEFAULT_INITRD_BAK --kver $kdump_kver \ -i /tmp/fadump.initramfs /etc/fadump.initramfs if [ $? != 0 ]; then echo "mkdumprd: failed to rebuild initrd with fadump support" >&2 @@ -110,6 +110,12 @@ rebuild_fadump_initrd() return 0 } +check_earlykdump_is_enabled() +{ + grep -q -w "rd.earlykdump" /proc/cmdline + return $? +} + rebuild_kdump_initrd() { $MKDUMPRD $TARGET_INITRD $kdump_kver @@ -118,11 +124,20 @@ rebuild_kdump_initrd() return 1 fi + if check_earlykdump_is_enabled; then + echo "Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump." + fi + return 0 } rebuild_initrd() { + if [[ ! -w "$KDUMP_BOOTDIR" ]];then + echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD" + return 1 + fi + if [ $DEFAULT_DUMP_MODE == "fadump" ]; then rebuild_fadump_initrd else @@ -221,9 +236,8 @@ check_config() case "$config_opt" in \#* | "") ;; - raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes) + raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes) # remove inline comments after the end of a directive. - config_val=$(strip_comments $config_val) [ -z "$config_val" ] && { echo "Invalid kdump config value for option $config_opt." return 1; @@ -238,9 +252,10 @@ check_config() return 1; ;; esac - done < $KDUMP_CONFIG_FILE + done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)" - check_default_config || return 1 + check_failure_action_config || return 1 + check_final_action_config || return 1 check_fence_kdump_config || return 1 @@ -294,8 +309,17 @@ setup_initrd() echo "Error: No initrd found to rebuild!" return 1 fi + + # backup initrd for reference before replacing it + # with fadump aware initrd + backup_default_initrd else TARGET_INITRD="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}kdump.img" + + # check if a backup of default initrd exists. If yes, + # it signifies a switch from fadump mode. So, restore + # the backed up default initrd. + restore_default_initrd fi } @@ -316,15 +340,49 @@ check_files_modified() files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS $CORE_COLLECTOR" [[ -e /etc/fstab ]] && files="$files /etc/fstab" + # Check for any updated extra module + EXTRA_MODULES="$(grep ^extra_modules $KDUMP_CONFIG_FILE | sed 's/^extra_modules\s*//')" + if [ -n "$EXTRA_MODULES" ]; then + if [ -e /lib/modules/$kdump_kver/modules.dep ]; then + files="$files /lib/modules/$kdump_kver/modules.dep" + fi + for _module in $EXTRA_MODULES; do + _module_file="$(modinfo --set-version "$kdump_kver" --filename "$_module" 2>/dev/null)" + if [[ $? -eq 0 ]]; then + files="$files $_module_file" + for _dep_modules in $(modinfo -F depends $_module | tr ',' ' '); do + files="$files $(modinfo --set-version "$kdump_kver" --filename $_dep_modules 2>/dev/null)" + done + else + # If it's not a module nor builtin, give an error + if ! ( modprobe --set-version "$kdump_kver" --dry-run "$_module" &>/dev/null ); then + echo "Module $_module not found" + fi + fi + done + fi + check_exist "$files" && check_executable "$EXTRA_BINS" [ $? -ne 0 ] && return 2 for file in $files; do - time_stamp=`stat -c "%Y" $file` - if [ "$time_stamp" -gt "$image_time" ]; then - modified_files="$modified_files $file" + if [ -e "$file" ]; then + time_stamp=`stat -c "%Y" $file` + if [ "$time_stamp" -gt "$image_time" ]; then + modified_files="$modified_files $file" + fi + if [ -L "$file" ]; then + file=$(readlink -m $file) + time_stamp=`stat -c "%Y" $file` + if [ "$time_stamp" -gt "$image_time" ]; then + modified_files="$modified_files $file" + fi + fi + else + echo "$file doesn't exist" fi done + if [ -n "$modified_files" ]; then echo "Detected change(s) in the following file(s):" echo -n " "; echo "$modified_files" | sed 's/\s/\n /g' @@ -339,6 +397,9 @@ check_dump_fs_modified() local _old_dev _old_mntpoint _old_fstype local _new_dev _new_mntpoint _new_fstype local _target _path _dracut_args + local _target_drivers _module_name + + local _old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')" # No need to check in case of mount target specified via "dracut_args". if is_mount_in_dracut_args; then @@ -367,6 +428,36 @@ check_dump_fs_modified() fi fi + _record_block_drivers() { + local _drivers + if [[ -b /dev/block/$1 ]]; then + _drivers=$(udevadm info -a "/dev/block/$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p') + fi + if [[ -b $1 ]]; then + _drivers=$(udevadm info -a "$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p') + fi + for _driver in $_drivers; do + if ! [[ " $_target_drivers " == *" $_driver "* ]]; then + _target_drivers="$_target_drivers $_driver" + fi + done + return 1 + } + + check_block_and_slaves_all _record_block_drivers "$(get_maj_min "$_target")" + for _driver in $_target_drivers; do + # Target is mounted already, if module is not included by current kernel, + # could be a deprecated/invalid driver name or a built-in module + _module_name=$(modinfo --set-version "$kdump_kver" -F name $_driver 2>/dev/null) + if [ $? -ne 0 ] || [ -z "$_module_name" ]; then + continue + fi + if ! [[ " $_old_drivers " == *" $_module_name "* ]]; then + echo "Detected change in block device driver, new loaded module: $_module_name" + return 1 + fi + done + if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then _new_dev=$_target else @@ -468,31 +559,6 @@ check_wdt_modified() return 1 } -check_kmodules_modified() -{ - # always sort again to avoid LANG/LC inconsistent problem - local _old_modules="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | sort)" - local _new_modules="$(get_loaded_kernel_modules | sort)" - - [[ -z $_old_modules ]] && echo "Warning: Previous loaded kernel module list is absent or empty" - - local _added_modules=$(comm -13 <(echo "$_old_modules") <(echo "$_new_modules")) - local _dropped_modules=$(comm -23 <(echo "$_old_modules") <(echo "$_new_modules")) - - if [ "$_old_modules" != "$_new_modules" ]; then - echo "Detected change(s) of loaded kernel modules list:" - [[ -n $_added_modules ]] && for _module in $_added_modules; do - echo " +$_module" - done - [[ -n $_dropped_modules ]] && for _module in $_dropped_modules; do - echo " -$_module" - done - return 1 - fi - - return 0 -} - # returns 0 if system is not modified # returns 1 if system is modified # returns 2 if system modification is invalid @@ -520,17 +586,11 @@ check_system_modified() return 1 fi - check_kmodules_modified - if [ $? -ne 0 ]; then - return 1 - fi - return 0 } check_rebuild() { - local extra_modules local capture_capable_initrd="1" local _force_rebuild force_rebuild="0" local _force_no_rebuild force_no_rebuild="0" @@ -570,10 +630,6 @@ check_rebuild() return 0 fi - #will rebuild every time if extra_modules are specified - extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE` - [ -n "$extra_modules" ] && force_rebuild="1" - #check to see if dependent files has been modified #since last build of the image file if [ -f $TARGET_INITRD ]; then @@ -594,8 +650,6 @@ check_rebuild() system_modified="1" fi - handle_mode_switch - if [ $image_time -eq 0 ]; then echo -n "No kdump initial ramdisk found."; echo elif [ "$capture_capable_initrd" == "0" ]; then @@ -608,11 +662,6 @@ check_rebuild() return 0 fi - if [[ ! -w "$KDUMP_BOOTDIR" ]];then - echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD" - return 1 - fi - echo "Rebuilding $TARGET_INITRD" rebuild_initrd return $? @@ -652,7 +701,6 @@ check_ssh_config() case "$config_opt" in sshkey) # remove inline comments after the end of a directive. - config_val=$(strip_comments $config_val) if [ -f "$config_val" ]; then # canonicalize the path SSH_KEY_LOCATION=$(/usr/bin/readlink -m $config_val) @@ -661,17 +709,15 @@ check_ssh_config() fi ;; path) - config_val=$(strip_comments $config_val) SAVE_PATH=$config_val ;; ssh) - config_val=$(strip_comments $config_val) DUMP_TARGET=$config_val ;; *) ;; esac - done < $KDUMP_CONFIG_FILE + done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)" #make sure they've configured kdump.conf for ssh dumps local SSH_TARGET=`echo -n $DUMP_TARGET | sed -n '/.*@/p'` @@ -737,20 +783,6 @@ show_reserved_mem() echo "Reserved "$mem_mb"MB memory for crash kernel" } -handle_mode_switch() -{ - if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then - # backup initrd for reference before replacing it - # with fadump aware initrd - backup_default_initrd - else - # check if a backup of default initrd exists. If yes, - # it signifies a switch from fadump mode. So, restore - # the backed up default initrd. - restore_default_initrd - fi -} - check_current_fadump_status() { # Check if firmware-assisted dump has been registered. @@ -923,20 +955,51 @@ start_dump() return $? } -check_default_config() +check_failure_action_config() { local default_option + local failure_action + local option="failure_action" default_option=$(awk '$1 ~ /^default$/ {print $2;}' $KDUMP_CONFIG_FILE) - if [ -z "$default_option" ]; then + failure_action=$(awk '$1 ~ /^failure_action$/ {print $2;}' $KDUMP_CONFIG_FILE) + + if [ -z "$failure_action" -a -z "$default_option" ]; then + return 0 + elif [ -n "$failure_action" -a -n "$default_option" ]; then + echo "Cannot specify 'failure_action' and 'default' option together" + return 1 + fi + + if [ -n "$default_option" ]; then + option="default" + failure_action="$default_option" + fi + + case "$failure_action" in + reboot|halt|poweroff|shell|dump_to_rootfs) + return 0 + ;; + *) + echo $"Usage kdump.conf: $option {reboot|halt|poweroff|shell|dump_to_rootfs}" + return 1 + esac +} + +check_final_action_config() +{ + local final_action + + final_action=$(awk '$1 ~ /^final_action$/ {print $2;}' $KDUMP_CONFIG_FILE) + if [ -z "$final_action" ]; then return 0 else - case "$default_option" in - reboot|halt|poweroff|shell|dump_to_rootfs) + case "$final_action" in + reboot|halt|poweroff) return 0 ;; *) - echo $"Usage kdump.conf: default {reboot|halt|poweroff|shell|dump_to_rootfs}" + echo $"Usage kdump.conf: final_action {reboot|halt|poweroff}" return 1 esac fi @@ -1003,7 +1066,8 @@ reload() fi if [ $DEFAULT_DUMP_MODE == "fadump" ]; then - stop_fadump + reload_fadump + return $? else stop_kdump fi @@ -1059,6 +1123,26 @@ stop_kdump() return 0 } +reload_fadump() +{ + echo 1 > $FADUMP_REGISTER_SYS_NODE + if [ $? == 0 ]; then + echo "fadump: re-registered successfully" + return 0 + else + # FADump could fail on older kernel where re-register + # support is not enabled. Try stop/start from userspace + # to handle such scenario. + stop_fadump + if [ $? == 0 ]; then + start_fadump + return $? + fi + fi + + return 1 +} + stop() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -1076,6 +1160,28 @@ stop() return 0 } +rebuild() { + check_config + if [ $? -ne 0 ]; then + return 1 + fi + + if check_ssh_config; then + if ! check_ssh_target; then + return 1 + fi + fi + + setup_initrd + if [ $? -ne 0 ]; then + return 1 + fi + + echo "Rebuilding $TARGET_INITRD" + rebuild_initrd + return $? +} + if [ ! -f "$KDUMP_CONFIG_FILE" ]; then echo "Error: No kdump config file found!" >&2 exit 1 @@ -1120,6 +1226,9 @@ main () stop start ;; + rebuild) + rebuild + ;; condrestart) ;; propagate) @@ -1129,7 +1238,7 @@ main () show_reserved_mem ;; *) - echo $"Usage: $0 {start|stop|status|restart|reload|propagate|showmem}" + echo $"Usage: $0 {start|stop|status|restart|reload|rebuild|propagate|showmem}" exit 1 esac } diff --git a/SOURCES/kdumpctl.8 b/SOURCES/kdumpctl.8 index 023562b..ae97af7 100644 --- a/SOURCES/kdumpctl.8 +++ b/SOURCES/kdumpctl.8 @@ -32,6 +32,12 @@ It returns non-zero value if kdump is not operational. Is equal to .I start; stop .TP +.I reload +reload crash kernel image and initramfs without triggering a rebuild. +.TP +.I rebuild +rebuild the crash kernel initramfs. +.TP .I propagate Helps to setup key authentication for ssh storage since it's impossible to use password authentication during kdump. diff --git a/SOURCES/kexec-kdump-howto.txt b/SOURCES/kexec-kdump-howto.txt index f46563f..0da938e 100644 --- a/SOURCES/kexec-kdump-howto.txt +++ b/SOURCES/kexec-kdump-howto.txt @@ -91,6 +91,12 @@ This line tells kexec to reserve 64M of ram if the system contains between 512M and 2G of physical memory. If the system contains 2G or more of physical memory, 128M should be reserved. +Besides, since kdump needs to access /proc/kallsyms during a kernel +loading if KASLR is enabled, check /proc/sys/kernel/kptr_restrict to +make sure that the content of /proc/kallsyms is exposed correctly. +We recommend to set the value of kptr_restrict to '1'. Otherwise +capture kernel loading could fail. + After making said changes, reboot your system, so that the X MB of memory is left untouched by the normal system, reserved for the capture kernel. Take note that the output of 'free -m' will show X MB less memory than without this @@ -130,6 +136,22 @@ perform postmortem analysis: and so on... +Notes: + +When kdump starts, the kdump kernel is loaded together with the kdump +initramfs. To save memory usage and disk space, the kdump initramfs is +generated strictly against the system it will run on, and contains the +minimum set of kernel modules and utilities to boot the machine to a stage +where the dump target could be mounted. + +With kdump service enabled, kdumpctl will try to detect possible system +change and rebuild the kdump initramfs if needed. But it can not guarantee +to cover every possible case. So after a hardware change, disk migration, +storage setup update or any similar system level changes, it's highly +recommended to rebuild the initramfs manually with following command: + + # kdumpctl rebuild + Saving vmcore-dmesg.txt ---------------------- Kernel log bufferes are one of the most important information available @@ -150,7 +172,7 @@ on your system, with the scripts enabled as described in the section above. Kdump 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/solutions/2023 In addition, on PowerPC boxes, Kdump can also be triggered via Hardware Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys. @@ -162,7 +184,7 @@ respond to keyboard interrupts. As a result 'Alt-SysRq' keys will not help trigger a dump. In such scenarios Nmi Watchdog feature can prove to be useful. The following link has more details on configuring Nmi watchdog option. -http://kbase.redhat.com/faq/FAQ_85_9129.shtm +https://access.redhat.com/solutions/125103 Once this feature has been enabled in the kernel, any lockups will result in an OOPs message to be generated, followed by Kdump being triggered. @@ -463,21 +485,21 @@ storage device, such as an iscsi target disk or clustered file system, you may need to manually specify additional kernel modules to load into your kdump initrd. -Default action +Failure action ============== -Default action specifies what to do when dump to configured dump target -fails. By default, default action is "reboot" and that is system reboots +Failure action specifies what to do when dump to configured dump target +fails. By default, failure action is "reboot" and that is system reboots if attempt to save dump to dump target fails. -There are other default actions available though. +There are other failure actions available though. - dump_to_rootfs This option tries to mount root and save dump on root filesystem in a path specified by "path". This option will generally make sense when dump target is not root filesystem. For example, if dump is being saved over network using "ssh" then one can specify - default to "dump_to_rootfs" to try saving dump to root filesystem - if dump over network fails. + failure action to "dump_to_rootfs" to try saving dump to root + filesystem if dump over network fails. - shell Drop into a shell session inside initramfs. @@ -648,6 +670,51 @@ not been written in watchdog-core framework then this option will not have any effect and module will not be added. Please note that only systemd watchdog daemon is supported as watchdog kick application. +Notes for disk images: + +Kdump initramfs is a critical component for capturing the crash dump. +But it's strictly generated for the machine it will run on, and have +no generality. If you install a new machine with a previous disk image +(eg. VMs created with disk image or snapshot), kdump could be broken +easily due to hardware changes or disk ID changes. So it's strongly +recommended to not include the kdump initramfs in the disk image in the +first place, this helps to save space, and kdumpctl will build the +initramfs automatically if it's missing. If you have already installed +a machine with a disk image which have kdump initramfs embedded, you +should rebuild the initramfs using "kdumpctl rebuild" command manually, +or else kdump may not work as expeceted. + +Notes on encrypted dump target: + +Currently, kdump is not working well with encrypted dump target. +First, user have to give the password manually in capture kernel, +so a working interactive terminal is required in the capture kernel. +And another major issue is that an OOM problem will occur with certain +encryption setup. For example, the default setup for LUKS2 will use a +memory hard key derivation function to mitigate brute force attach, +it's impossible to reduce the memory usage for mounting the encrypted +target. In such case, you have to either reserved enough memory for +crash kernel according, or update your encryption setup. +It's recommanded to use a non-encrypted target (eg. remote target) +instead. + +Notes on device dump: + +Device dump allows drivers to append dump data to vmcore, so you can +collect driver specified debug info. The drivers could append the +data without any limit, and the data is stored in memory, this may +bring a significant memory stress. So device dump is disabled by default +by passing "novmcoredd" command line option to the kdump capture kernel. +If you want to collect debug data with device dump, you need to modify +"KDUMP_COMMANDLINE_APPEND=" value in /etc/sysconfig/kdump and remove the +"novmcoredd" option. You also need to increase the "crashkernel=" value +accordingly in case of OOM issue. +Besides, kdump initramfs won't automatically include the device drivers +which support device dump, only device drivers that are required for +the dump target setup will be included. To ensure the device dump data +will be included in the vmcore, you need to force include related +device drivers by using "extra_modules" option in /etc/kdump.conf + Parallel Dumping Operation ========================== Kexec allows kdump using multiple cpus. So parallel feature can accelerate diff --git a/SOURCES/kexec-tools-2.0.17-kexec-arm64-Add-support-to-supply-kaslr-seed-to-secondary-.patch b/SOURCES/kexec-tools-2.0.17-kexec-arm64-Add-support-to-supply-kaslr-seed-to-secondary-.patch deleted file mode 100644 index 0e3139a..0000000 --- a/SOURCES/kexec-tools-2.0.17-kexec-arm64-Add-support-to-supply-kaslr-seed-to-secondary-.patch +++ /dev/null @@ -1,272 +0,0 @@ -From c3f043241a866a7af9117396634dfcb20f0fd9cb Mon Sep 17 00:00:00 2001 -From: Bhupesh Sharma -Date: Thu, 26 Apr 2018 14:27:32 +0530 -Subject: [PATCH] arm64: Add support to supply 'kaslr-seed' to secondary kernel - -This patch adds the support to supply 'kaslr-seed' to secondary kernel, -when we do a 'kexec warm reboot to another kernel' (although the -behaviour remains the same for the 'kdump' case as well) on arm64 -platforms using the 'kexec_load' invocation method. - -Lets consider the case where the primary kernel working on the arm64 -platform supports kaslr (i.e 'CONFIG_RANDOMIZE_BASE' was set to y and -we have a compliant EFI firmware which supports EFI_RNG_PROTOCOL and -hence can pass a non-zero (valid) seed to the primary kernel). - -Now the primary kernel reads the 'kaslr-seed' and wipes it to 0 and -uses the seed value to randomize for e.g. the module base address -offset. - -In the case of 'kexec_load' (or even kdump for brevity), -we rely on the user-space kexec-tools to pass an appropriate dtb to the -secondary kernel and since 'kaslr-seed' is wiped to 0 by the primary -kernel, the secondary will essentially work with *nokaslr* as -'kaslr-seed' is set to 0 when it is passed to the secondary kernel. - -This can be true even in case the secondary kernel had -'CONFIG_RANDOMIZE_BASE' and 'CONFIG_RANDOMIZE_MODULE_REGION_FULL' set to -y. - -This patch addresses this issue by first checking if the device tree -provided by the firmware to the kernel supports the 'kaslr-seed' -property and verifies that it is really wiped to 0. If this condition is -met, it fixes up the 'kaslr-seed' property by using the getrandom() -syscall to get a suitable random number. - -I verified this patch on my Qualcomm arm64 board and here are some test -results: - -1. Ensure that the primary kernel is boot'ed with 'kaslr-seed' - dts property and it is really wiped to 0: - - [root@qualcomm-amberwing]# dtc -I dtb -O dts /sys/firmware/fdt | grep -A 10 -i chosen - chosen { - kaslr-seed = <0x0 0x0>; - ... - } - -2. Now issue 'kexec_load' to load the secondary kernel (let's assume - that we are using the same kernel as the secondary kernel): - # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname - -r`.img --reuse-cmdline -d - -3. Issue 'kexec -e' to warm boot to the secondary: - # kexec -e - -4. Now after the secondary boots, confirm that the load address of the - modules is randomized in every successive boot: - - [root@qualcomm-amberwing]# cat /proc/modules - sunrpc 524288 1 - Live 0xffff0307db190000 - vfat 262144 1 - Live 0xffff0307db110000 - fat 262144 1 vfat, Live 0xffff0307db090000 - crc32_ce 262144 0 - Live 0xffff0307d8c70000 - ... - -Signed-off-by: Bhupesh Sharma -Signed-off-by: Simon Horman ---- - kexec/arch/arm64/kexec-arm64.c | 138 +++++++++++++++++++++++++++++------------ - 1 file changed, 100 insertions(+), 38 deletions(-) - -diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c -index 62f37585b788..a206c172b1aa 100644 ---- a/kexec/arch/arm64/kexec-arm64.c -+++ b/kexec/arch/arm64/kexec-arm64.c -@@ -15,6 +15,11 @@ - #include - #include - -+#include -+#include -+#include -+#include -+ - #include "kexec.h" - #include "kexec-arm64.h" - #include "crashdump.h" -@@ -392,11 +397,13 @@ static int fdt_setprop_range(void *fdt, int nodeoffset, - static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) - { - uint32_t address_cells, size_cells; -- int range_len; -- int nodeoffset; -+ uint64_t fdt_val64; -+ uint64_t *prop; - char *new_buf = NULL; -+ int len, range_len; -+ int nodeoffset; - int new_size; -- int result; -+ int result, kaslr_seed; - - result = fdt_check_header(dtb->buf); - -@@ -407,47 +414,103 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) - - result = set_bootargs(dtb, command_line); - -- if (on_crash) { -- /* determine #address-cells and #size-cells */ -- result = get_cells_size(dtb->buf, &address_cells, &size_cells); -- if (result) { -- fprintf(stderr, -- "kexec: cannot determine cells-size.\n"); -- result = -EINVAL; -- goto on_error; -- } -+ /* determine #address-cells and #size-cells */ -+ result = get_cells_size(dtb->buf, &address_cells, &size_cells); -+ if (result) { -+ fprintf(stderr, "kexec: cannot determine cells-size.\n"); -+ result = -EINVAL; -+ goto on_error; -+ } - -- if (!cells_size_fitted(address_cells, size_cells, -- &elfcorehdr_mem)) { -- fprintf(stderr, -- "kexec: elfcorehdr doesn't fit cells-size.\n"); -+ if (!cells_size_fitted(address_cells, size_cells, -+ &elfcorehdr_mem)) { -+ fprintf(stderr, "kexec: elfcorehdr doesn't fit cells-size.\n"); -+ result = -EINVAL; -+ goto on_error; -+ } -+ -+ if (!cells_size_fitted(address_cells, size_cells, -+ &crash_reserved_mem)) { -+ fprintf(stderr, "kexec: usable memory range doesn't fit cells-size.\n"); -+ result = -EINVAL; -+ goto on_error; -+ } -+ -+ /* duplicate dt blob */ -+ range_len = sizeof(uint32_t) * (address_cells + size_cells); -+ new_size = fdt_totalsize(dtb->buf) -+ + fdt_prop_len(PROP_ELFCOREHDR, range_len) -+ + fdt_prop_len(PROP_USABLE_MEM_RANGE, range_len); -+ -+ new_buf = xmalloc(new_size); -+ result = fdt_open_into(dtb->buf, new_buf, new_size); -+ if (result) { -+ dbgprintf("%s: fdt_open_into failed: %s\n", __func__, -+ fdt_strerror(result)); -+ result = -ENOSPC; -+ goto on_error; -+ } -+ -+ /* fixup 'kaslr-seed' with a random value, if supported */ -+ nodeoffset = fdt_path_offset(new_buf, "/chosen"); -+ prop = fdt_getprop_w(new_buf, nodeoffset, -+ "kaslr-seed", &len); -+ if (!prop || len != sizeof(uint64_t)) { -+ dbgprintf("%s: no kaslr-seed found\n", -+ __func__); -+ /* for kexec warm reboot case, we don't need to fixup -+ * other dtb properties -+ */ -+ if (!on_crash) { -+ dump_reservemap(dtb); -+ if (new_buf) -+ free(new_buf); -+ -+ return result; -+ } -+ } else { -+ kaslr_seed = fdt64_to_cpu(*prop); -+ -+ /* kaslr_seed must be wiped clean by primary -+ * kernel during boot -+ */ -+ if (kaslr_seed != 0) { -+ dbgprintf("%s: kaslr-seed is not wiped to 0.\n", -+ __func__); - result = -EINVAL; - goto on_error; - } - -- if (!cells_size_fitted(address_cells, size_cells, -- &crash_reserved_mem)) { -- fprintf(stderr, -- "kexec: usable memory range doesn't fit cells-size.\n"); -+ /* -+ * Invoke the getrandom system call with -+ * GRND_NONBLOCK, to make sure we -+ * have a valid random seed to pass to the -+ * secondary kernel. -+ */ -+ result = syscall(SYS_getrandom, &fdt_val64, -+ sizeof(fdt_val64), -+ GRND_NONBLOCK); -+ -+ if(result == -1) { -+ dbgprintf("%s: Reading random bytes failed.\n", -+ __func__); - result = -EINVAL; - goto on_error; - } - -- /* duplicate dt blob */ -- range_len = sizeof(uint32_t) * (address_cells + size_cells); -- new_size = fdt_totalsize(dtb->buf) -- + fdt_prop_len(PROP_ELFCOREHDR, range_len) -- + fdt_prop_len(PROP_USABLE_MEM_RANGE, range_len); -- -- new_buf = xmalloc(new_size); -- result = fdt_open_into(dtb->buf, new_buf, new_size); -+ nodeoffset = fdt_path_offset(new_buf, "/chosen"); -+ result = fdt_setprop_inplace(new_buf, -+ nodeoffset, "kaslr-seed", -+ &fdt_val64, sizeof(fdt_val64)); - if (result) { -- dbgprintf("%s: fdt_open_into failed: %s\n", __func__, -- fdt_strerror(result)); -- result = -ENOSPC; -+ dbgprintf("%s: fdt_setprop failed: %s\n", -+ __func__, fdt_strerror(result)); -+ result = -EINVAL; - goto on_error; - } -+ } - -+ if (on_crash) { - /* add linux,elfcorehdr */ - nodeoffset = fdt_path_offset(new_buf, "/chosen"); - result = fdt_setprop_range(new_buf, nodeoffset, -@@ -455,7 +518,7 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) - address_cells, size_cells); - if (result) { - dbgprintf("%s: fdt_setprop failed: %s\n", __func__, -- fdt_strerror(result)); -+ fdt_strerror(result)); - result = -EINVAL; - goto on_error; - } -@@ -467,18 +530,17 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) - address_cells, size_cells); - if (result) { - dbgprintf("%s: fdt_setprop failed: %s\n", __func__, -- fdt_strerror(result)); -+ fdt_strerror(result)); - result = -EINVAL; - goto on_error; - } -- -- fdt_pack(new_buf); -- dtb->buf = new_buf; -- dtb->size = fdt_totalsize(new_buf); - } - -- dump_reservemap(dtb); -+ fdt_pack(new_buf); -+ dtb->buf = new_buf; -+ dtb->size = fdt_totalsize(new_buf); - -+ dump_reservemap(dtb); - - return result; - --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-kexec-arm64-If-getrandom-syscall-fails-don-t-error-out-jus.patch b/SOURCES/kexec-tools-2.0.17-kexec-arm64-If-getrandom-syscall-fails-don-t-error-out-jus.patch deleted file mode 100644 index 17b010b..0000000 --- a/SOURCES/kexec-tools-2.0.17-kexec-arm64-If-getrandom-syscall-fails-don-t-error-out-jus.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 04c43b4e421f5f90407883f6a06613b9d0660527 Mon Sep 17 00:00:00 2001 -From: Bhupesh Sharma -Date: Tue, 23 Oct 2018 01:50:20 +0530 -Subject: [PATCH] arm64: If 'getrandom' syscall fails, don't error out - just - warn and proceed. - -For calculating the random 'kaslr-seed' value to be passed to the -secondary kernel (kexec or kdump), we invoke the 'getrandom' syscall -inside 'setup_2nd_dtb()' function. - -Normally on most arm64 systems this syscall doesn't fail when the -initrd scriptware (which arms kdump service) invokes the same. -However, recently I noticed that on the 'hp-moonshot' arm64 boards, -we have an issue with the newer kernels which causes the same -to fail. As a result, the kdump service fails and we are not able -to use the kdump infrastructure just after boot. As expected, once the -random pool is sufficiently populated and we launch the kdump service -arming scripts again (manually), then the kdump service is properly -enabled. - -Lets handle the same, by not error'ing out if 'getrandom' syscall fails. -Rather lets warn the user and proceed further by setting the -'kaslr-seed' value as 0 for the secondary kernel - which implies that it -boots in a 'nokaslr' mode. - -Tested on my 'hp-moonshot' and 'qualcomm-amberwing' arm64 boards. - -Signed-off-by: Bhupesh Sharma -Signed-off-by: Simon Horman ---- - kexec/arch/arm64/kexec-arm64.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c -index 7a124795f3d0..b143e861f7d9 100644 ---- a/kexec/arch/arm64/kexec-arm64.c -+++ b/kexec/arch/arm64/kexec-arm64.c -@@ -492,10 +492,21 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) - GRND_NONBLOCK); - - if(result == -1) { -- dbgprintf("%s: Reading random bytes failed.\n", -+ fprintf(stderr, "%s: Reading random bytes failed.\n", -+ __func__); -+ -+ /* Currently on some arm64 platforms this -+ * 'getrandom' system call fails while booting -+ * the platform. -+ * -+ * In case, this happens at best we can set -+ * the 'kaslr_seed' as 0, indicating that the -+ * 2nd kernel will be booted with a 'nokaslr' -+ * like behaviour. -+ */ -+ fdt_val64 = 0UL; -+ dbgprintf("%s: Disabling KASLR in secondary kernel.\n", - __func__); -- result = -EINVAL; -- goto on_error; - } - - nodeoffset = fdt_path_offset(new_buf, "/chosen"); --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-kexec-s390-Add-support-for-kexec_file_load.patch b/SOURCES/kexec-tools-2.0.17-kexec-s390-Add-support-for-kexec_file_load.patch deleted file mode 100644 index 233266f..0000000 --- a/SOURCES/kexec-tools-2.0.17-kexec-s390-Add-support-for-kexec_file_load.patch +++ /dev/null @@ -1,106 +0,0 @@ -From d4a948c268272cf37c71be820fb02bf40e56292b Mon Sep 17 00:00:00 2001 -From: Philipp Rudo -Date: Wed, 16 May 2018 14:27:18 +0200 -Subject: [PATCH] kexec/s390: Add support for kexec_file_load - -Since kernel 4.17-rc2 s390 supports the kexec_file_load system call. Add -the new system call to kexec-tools and provide the -s (--kexec-file-syscall) -option for s390 to support this new feature. - -Signed-off-by: Philipp Rudo -Acked-by: Dave Young -Signed-off-by: Simon Horman -Signed-off-by: Pingfan Liu ---- - kexec/arch/s390/kexec-image.c | 46 +++++++++++++++++++++++++++++++++++++++++++ - kexec/kexec-syscall.h | 3 +++ - 2 files changed, 49 insertions(+) - -diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c -index 0c8937b..8b39566 100644 ---- a/kexec/arch/s390/kexec-image.c -+++ b/kexec/arch/s390/kexec-image.c -@@ -22,6 +22,7 @@ - #include "../../kexec/crashdump.h" - #include "kexec-s390.h" - #include -+#include - - static uint64_t crash_base, crash_end; - static char command_line[COMMAND_LINESIZE]; -@@ -45,6 +46,48 @@ int command_line_add(const char *str) - return 0; - } - -+int image_s390_load_file(int argc, char **argv, struct kexec_info *info) -+{ -+ const char *ramdisk = NULL; -+ int opt; -+ -+ static const struct option options[] = -+ { -+ KEXEC_OPTIONS -+ {"command-line", 1, 0, OPT_APPEND}, -+ {"append", 1, 0, OPT_APPEND}, -+ {"initrd", 1, 0, OPT_RAMDISK}, -+ {0, 0, 0, 0}, -+ }; -+ static const char short_options[] = KEXEC_OPT_STR ""; -+ -+ while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { -+ switch(opt) { -+ case OPT_APPEND: -+ if (command_line_add(optarg)) -+ return -1; -+ break; -+ case OPT_RAMDISK: -+ ramdisk = optarg; -+ break; -+ } -+ } -+ -+ if (ramdisk) { -+ info->initrd_fd = open(ramdisk, O_RDONLY); -+ if (info->initrd_fd == -1) { -+ fprintf(stderr, "Could not open initrd file %s:%s\n", -+ ramdisk, strerror(errno)); -+ return -1; -+ } -+ } -+ -+ info->command_line = command_line; -+ info->command_line_len = strlen (command_line) + 1; -+ -+ return 0; -+} -+ - int - image_s390_load(int argc, char **argv, const char *kernel_buf, - off_t kernel_size, struct kexec_info *info) -@@ -56,6 +99,9 @@ image_s390_load(int argc, char **argv, const char *kernel_buf, - unsigned int ramdisk_origin; - int opt; - -+ if (info->file_mode) -+ return image_s390_load_file(argc, argv, info); -+ - static const struct option options[] = - { - KEXEC_OPTIONS -diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h -index 33638c2..b96e02a 100644 ---- a/kexec/kexec-syscall.h -+++ b/kexec/kexec-syscall.h -@@ -64,6 +64,9 @@ - #ifdef __powerpc64__ - #define __NR_kexec_file_load 382 - #endif -+#ifdef __s390x__ -+#define __NR_kexec_file_load 381 -+#endif - - #ifndef __NR_kexec_file_load - /* system call not available for the arch */ --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-Check-if-clock_gettime-requires-lrt.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-Check-if-clock_gettime-requires-lrt.patch deleted file mode 100644 index 86125c1..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-Check-if-clock_gettime-requires-lrt.patch +++ /dev/null @@ -1,39 +0,0 @@ -From aec51ef7aee483cc5bf16844bdbacb1c70619f15 Mon Sep 17 00:00:00 2001 -From: Petr Tesarik -Date: Wed, 20 Jun 2018 11:50:19 +0200 -Subject: [PATCH] [PATCH 2/2] Check if clock_gettime() requires -lrt - -For glibc versions before 2.17, clock_gettime() was contained in a -separate library and required linking with -lrt. - -Signed-off-by: Petr Tesarik ---- - Makefile | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/makedumpfile-1.6.4/Makefile b/makedumpfile-1.6.4/Makefile -index 612b9d0..142a387 100644 ---- a/makedumpfile-1.6.4/Makefile -+++ b/makedumpfile-1.6.4/Makefile -@@ -68,6 +68,18 @@ endif - - LIBS := -lpthread $(LIBS) - -+try-run = $(shell set -e; \ -+ TMP=".$$$$.tmp"; \ -+ if ($(1)) >/dev/null 2>&1; \ -+ then echo "$(2)"; \ -+ else echo "$(3)"; \ -+ fi; \ -+ rm -f "$$TMP") -+ -+LINK_TEST_PROG="int clock_gettime(); int main(){ return clock_gettime(); }" -+LIBS := $(LIBS) $(call try-run,\ -+ echo $(LINK_TEST_PROG) | $(CC) $(CFLAGS) -o "$$TMP" -x c -,,-lrt) -+ - all: makedumpfile - - $(OBJ_PART): $(SRC_PART) --- -2.17.1 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-Fix-failure-of-detection-of-SPARSEMEM-EXTREME-.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-Fix-failure-of-detection-of-SPARSEMEM-EXTREME-.patch deleted file mode 100644 index 6d50bc5..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-Fix-failure-of-detection-of-SPARSEMEM-EXTREME-.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 208124d09ccd498d0da96d34274fe7b16ab03366 Mon Sep 17 00:00:00 2001 -From: "Hatayama, Daisuke" -Date: Wed, 24 Oct 2018 07:51:41 +0000 -Subject: [PATCH] [PATCH] Fix failure of detection of SPARSEMEM EXTREME in case - of -x VMLINUX - -This issue was introduced by commit -f3c87e0ab1f62b118e738d046c3d676325770418. - -Currently, is_sparsemem_extreme() compares ARRAY_LENGTH(mem_section) -with NOT_FOUND_SYMBOL but correct initial value for array table is -NOT_FOUND_STRUCTURE. - -As a result, makedumpfile fails to detect SPARSEMEM EXTREME and so -fails to convert vmcore captured by sadump as follows: - - # LANG=C makedumpfile --message-level 31 -f -l -d 31 -x ./vmlinux /dev/sdc vmcore-ld31 - sadump: read dump device as single partition - sadump: single partition configuration - page_size : 4096 - sadump: timezone information is missing - sadump: idtr=fffffe0000000000 - sadump: cr3=ba4e0a000 - sadump: idtr(phys)=ba55cc000 - sadump: devide_error(vmlinux)=ffffffff81a00c50 - sadump: devide_error(vmcore)=ffffffff83c00c50 - sadump: cmdline vaddr: ffffffff84bcf008 - sadump: cmdline paddr: ba55cf008 - sadump: cmdline buf vaddr: ffff8fa39ffceec0 - sadump: cmdline buf paddr: 109ffceec0 - sadump: kaslr_offset=2200000 - sadump: phys_base=ba0a00000 - sadump: online cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [...] - sadump: nr_cpus: 60 - The kernel version is not supported. - The makedumpfile operation may be incomplete. - sadump: SRC_START: 0x00000000001000 SRC_SIZE: 0x0000000009f000 SRC_OFFSET: 0x00000025f61000 - sadump: kdump backup region unused - - num of NODEs : 2 - - Memory type : SPARSEMEM - - get_mm_sparsemem: Can't get the address of mem_section. - - makedumpfile Failed. - -This issue doesn't occur for vmcore captured by kdump because in that -case, the length of mem_section is provided via VMCOREINFO and -is_sparsemem_extreme() returns TRUE via the other path. - -This issue occurs also for other mechanisms where we need to use --x VMLINUX such as virsh dump. - -Signed-off-by: HATAYAMA Daisuke ---- - makedumpfile.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/makedumpfile-1.6.4/makedumpfile.c b/makedumpfile-1.6.4/makedumpfile.c -index 3ccdaae..91c1ab4 100644 ---- a/makedumpfile-1.6.4/makedumpfile.c -+++ b/makedumpfile-1.6.4/makedumpfile.c -@@ -2084,7 +2084,7 @@ is_sparsemem_extreme(void) - { - if ((ARRAY_LENGTH(mem_section) - == divideup(NR_MEM_SECTIONS(), _SECTIONS_PER_ROOT_EXTREME())) -- || (ARRAY_LENGTH(mem_section) == NOT_FOUND_SYMBOL)) -+ || (ARRAY_LENGTH(mem_section) == NOT_FOUND_STRUCTURE)) - return TRUE; - else - return FALSE; --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-Prepare-paddr_to_vaddr-for-arch-specific-p2v-c.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-Prepare-paddr_to_vaddr-for-arch-specific-p2v-c.patch deleted file mode 100644 index 3219f6c..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-Prepare-paddr_to_vaddr-for-arch-specific-p2v-c.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 9eb5a31bc2d7f6af88459b89c414fe144e7491f8 Mon Sep 17 00:00:00 2001 -From: Kazuhito Hagio -Date: Thu, 8 Nov 2018 14:26:43 -0500 -Subject: [PATCH] [PATCH] Prepare paddr_to_vaddr() for arch-specific p2v - conversion - -Currently, conversion from physical address to virtual address in ---mem-usage option is "paddr + PAGE_OFFSET", which was written for -x86_64, but it's not suitable especially for arm64. - -This patch introduces paddr_to_vaddr() macro to get prepared for -arch-specific physical to virtual conversion. - -Tested-by: Bhupesh Sharma -Signed-off-by: Kazuhito Hagio ---- - elf_info.c | 7 ++++--- - makedumpfile.h | 11 +++++++++++ - 2 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/makedumpfile-1.6.4/elf_info.c b/makedumpfile-1.6.4/elf_info.c -index 711601a170c7..1d33e96684b6 100644 ---- a/makedumpfile-1.6.4/elf_info.c -+++ b/makedumpfile-1.6.4/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 = paddr_to_vaddr(vmcoreinfo_addr); - - for (i = 0; i < num_pt_loads; ++i) { - struct pt_load_segment *p = &pt_loads[i]; -@@ -810,10 +810,11 @@ static int exclude_segment(struct pt_load_segment **pt_loads, - int i, j, tidx = -1; - unsigned long long vstart, vend, kvstart, kvend; - struct pt_load_segment temp_seg = {0}; -- kvstart = (ulong)start + PAGE_OFFSET; -- kvend = (ulong)end + PAGE_OFFSET; - unsigned long size; - -+ kvstart = paddr_to_vaddr(start); -+ kvend = paddr_to_vaddr(end); -+ - for (i = 0; i < (*num_pt_loads); i++) { - vstart = (*pt_loads)[i].virt_start; - vend = (*pt_loads)[i].virt_end; -diff --git a/makedumpfile-1.6.4/makedumpfile.h b/makedumpfile-1.6.4/makedumpfile.h -index 46ebe2ee5a1f..574a335e84af 100644 ---- a/makedumpfile-1.6.4/makedumpfile.h -+++ b/makedumpfile-1.6.4/makedumpfile.h -@@ -965,6 +965,8 @@ typedef unsigned long pgd_t; - static inline int stub_true() { return TRUE; } - static inline int stub_true_ul(unsigned long x) { return TRUE; } - static inline int stub_false() { return FALSE; } -+#define paddr_to_vaddr_general(X) ((X) + PAGE_OFFSET) -+ - #ifdef __aarch64__ - int get_phys_base_arm64(void); - int get_machdep_info_arm64(void); -@@ -975,6 +977,7 @@ int get_xen_info_arm64(void); - unsigned long get_kaslr_offset_arm64(unsigned long vaddr); - #define find_vmemmap() stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_arm64(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define get_phys_base() get_phys_base_arm64() - #define get_machdep_info() get_machdep_info_arm64() - #define get_versiondep_info() get_versiondep_info_arm64() -@@ -995,6 +998,7 @@ unsigned long long vaddr_to_paddr_arm(unsigned long vaddr); - #define get_versiondep_info() stub_true() - #define get_kaslr_offset(X) stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_arm(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define is_phys_addr(X) stub_true_ul(X) - #define arch_crashkernel_mem_size() stub_false() - #endif /* arm */ -@@ -1009,6 +1013,7 @@ unsigned long long vaddr_to_paddr_x86(unsigned long vaddr); - #define get_versiondep_info() get_versiondep_info_x86() - #define get_kaslr_offset(X) stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_x86(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define is_phys_addr(X) stub_true_ul(X) - #define arch_crashkernel_mem_size() stub_false() - #endif /* x86 */ -@@ -1026,6 +1031,7 @@ unsigned long long vtop4_x86_64_pagetable(unsigned long vaddr, unsigned long pag - #define get_versiondep_info() get_versiondep_info_x86_64() - #define get_kaslr_offset(X) get_kaslr_offset_x86_64(X) - #define vaddr_to_paddr(X) vtop4_x86_64(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define is_phys_addr(X) stub_true_ul(X) - #define arch_crashkernel_mem_size() stub_false() - #endif /* x86_64 */ -@@ -1041,6 +1047,7 @@ int arch_crashkernel_mem_size_ppc64(void); - #define get_versiondep_info() get_versiondep_info_ppc64() - #define get_kaslr_offset(X) stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_ppc64(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define is_phys_addr(X) stub_true_ul(X) - #define arch_crashkernel_mem_size() arch_crashkernel_mem_size_ppc64() - #endif /* powerpc64 */ -@@ -1054,6 +1061,7 @@ unsigned long long vaddr_to_paddr_ppc(unsigned long vaddr); - #define get_versiondep_info() stub_true() - #define get_kaslr_offset(X) stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_ppc(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define is_phys_addr(X) stub_true_ul(X) - #define arch_crashkernel_mem_size() stub_false() - #endif /* powerpc32 */ -@@ -1068,6 +1076,7 @@ int is_iomem_phys_addr_s390x(unsigned long addr); - #define get_versiondep_info() stub_true() - #define get_kaslr_offset(X) stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_s390x(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define is_phys_addr(X) is_iomem_phys_addr_s390x(X) - #define arch_crashkernel_mem_size() stub_false() - #endif /* s390x */ -@@ -1082,6 +1091,7 @@ unsigned long long vaddr_to_paddr_ia64(unsigned long vaddr); - #define get_versiondep_info() stub_true() - #define get_kaslr_offset(X) stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_ia64(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define VADDR_REGION(X) (((unsigned long)(X)) >> REGION_SHIFT) - #define is_phys_addr(X) stub_true_ul(X) - #define arch_crashkernel_mem_size() stub_false() -@@ -1096,6 +1106,7 @@ unsigned long long vaddr_to_paddr_sparc64(unsigned long vaddr); - #define get_phys_base() get_phys_base_sparc64() - #define get_versiondep_info() get_versiondep_info_sparc64() - #define vaddr_to_paddr(X) vaddr_to_paddr_sparc64(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) - #define is_phys_addr(X) stub_true_ul(X) - #define arch_crashkernel_mem_size() stub_false() - #endif /* sparc64 */ --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-Support-newer-kernels.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-Support-newer-kernels.patch deleted file mode 100644 index ebf2293..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-Support-newer-kernels.patch +++ /dev/null @@ -1,49 +0,0 @@ -From a90199c27b0cabebdf1302fde6767950cf52f998 Mon Sep 17 00:00:00 2001 -From: Kazuhito Hagio -Date: Thu, 23 Aug 2018 11:42:54 -0400 -Subject: [PATCH] [PATCH] Support newer kernels - -A new makedumpfile supports newer kernels: - - - 4.18 (x86 FLATMEM) - - 4.18 (x86 SPARSEMEM) - - 4.18 (x86_64 SPARSEMEM) - -Signed-off-by: Kazuhito Hagio -Signed-off-by: Pingfan Liu ---- - README | 1 + - makedumpfile.h | 4 ++-- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/makedumpfile-1.6.4/README b/makedumpfile-1.6.4/README -index 915cbf4f3c2b..3ccdaaeda0c5 100644 -index 583179e..c7ce3d6 100644 ---- a/makedumpfile-1.6.4/README -+++ b/makedumpfile-1.6.4/README -@@ -125,6 +125,7 @@ - 4.15 | OK | ** | | | | ** | | -- | OK | OK | | | - 4.16 | OK | ** | | | | ** | | -- | OK | OK | | | - 4.17 | OK | ** | | | | ** | | -- | OK | OK | | | -+ 4.18 | OK | ** | | | | ** | | -- | OK | OK | | | - - OK : Support. - -- : Not support. -diff --git a/makedumpfile-1.6.4/makedumpfile.h b/makedumpfile-1.6.4/makedumpfile.h -index 3244d31..d1fcd87 100644 ---- a/makedumpfile-1.6.4/makedumpfile.h -+++ b/makedumpfile-1.6.4/makedumpfile.h -@@ -494,8 +494,8 @@ do { \ - #define KVER_MAJ_SHIFT 24 - #define KVER_MIN_SHIFT 16 - #define KERNEL_VERSION(x,y,z) (((x) << KVER_MAJ_SHIFT) | ((y) << KVER_MIN_SHIFT) | (z)) --#define OLDEST_VERSION KERNEL_VERSION(2, 6, 15)/* linux-2.6.15 */ --#define LATEST_VERSION KERNEL_VERSION(4, 17, 0)/* linux-4.17.0 */ -+#define OLDEST_VERSION KERNEL_VERSION(2, 6, 15) /* linux-2.6.15 */ -+#define LATEST_VERSION KERNEL_VERSION(4, 18, 3) /* linux-4.18.3 */ - - /* - * vmcoreinfo in /proc/vmcore --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-Update-help-text-to-indicate-mem-usage-is-supp.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-Update-help-text-to-indicate-mem-usage-is-supp.patch deleted file mode 100644 index 08b186a..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-Update-help-text-to-indicate-mem-usage-is-supp.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 29dbb597089981a5e3c97ae4f768ff8a22094294 Mon Sep 17 00:00:00 2001 -From: Bhupesh Sharma -Date: Thu, 25 Oct 2018 11:48:27 +0530 -Subject: [PATCH] [PATCH] Update help text to indicate --mem-usage is supported - on archs other than x86_64 - -Commit 8449bda73ab14516d4bf81d29503c1ea203bb865 ("Documentation: -Update documentation regarding --mem-usage' option"), updated the -makedumpfile man page to indicate that this option is now -supported on x86_64, arm64, ppc64 and s390x. - -However, the help text for makedumpfile (which one can see -by running 'makedumpfile --help'), still reflects the old -support status, i.e. this option is only supported on x86_64. - -This patch changes the help text to be in sync with the man -page text. - -Signed-off-by: Bhupesh Sharma ---- - print_info.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/makedumpfile-1.6.4/print_info.c b/makedumpfile-1.6.4/print_info.c -index 732d5b806c24..0be12ea8803c 100644 ---- a/makedumpfile-1.6.4/print_info.c -+++ b/makedumpfile-1.6.4/print_info.c -@@ -300,7 +300,7 @@ print_usage(void) - MSG(" necessary to specify [-x VMLINUX] or [-i VMCOREINFO].\n"); - MSG("\n"); - MSG(" [--mem-usage]:\n"); -- MSG(" This option is only for x86_64.\n"); -+ MSG(" This option is currently supported on x86_64, arm64, ppc64 and s390x.\n"); - MSG(" This option is used to show the page numbers of current system in different\n"); - MSG(" use. It should be executed in 1st kernel. By the help of this, user can know\n"); - MSG(" how many pages is dumpable when different dump_level is specified. It analyzes\n"); --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-Use-monotonic-clock-to-calculate-ETA-and-s.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-Use-monotonic-clock-to-calculate-ETA-and-s.patch deleted file mode 100644 index 9897265..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-Use-monotonic-clock-to-calculate-ETA-and-s.patch +++ /dev/null @@ -1,455 +0,0 @@ -From 0f4e25c5d7c031201fa7ad384cd9562b9c9c6004 Mon Sep 17 00:00:00 2001 -From: Petr Tesarik -Date: Wed, 20 Jun 2018 11:50:18 +0200 -Subject: [PATCH] [PATCH 1/2] Use monotonic clock to calculate ETA and stats - -Execution time should be always measured by a monotonic clock, -because the system clock may be affected by discontinuous jumps, -e.g. when time is set manually by an admin. - -Signed-off-by: Petr Tesarik ---- - makedumpfile.c | 84 +++++++++++++++++++++++++------------------------- - print_info.c | 30 +++++++++--------- - print_info.h | 6 ++-- - 3 files changed, 61 insertions(+), 59 deletions(-) - -diff --git a/makedumpfile-1.6.4/makedumpfile.c b/makedumpfile-1.6.4/makedumpfile.c -index 1ed3d61..abe7a2b 100644 ---- a/makedumpfile-1.6.4/makedumpfile.c -+++ b/makedumpfile-1.6.4/makedumpfile.c -@@ -5364,7 +5364,7 @@ _exclude_free_page(struct cycle *cycle) - { - int i, nr_zones, num_nodes, node; - unsigned long node_zones, zone, spanned_pages, pgdat; -- struct timeval tv_start; -+ struct timespec ts_start; - - if ((node = next_online_node(0)) < 0) { - ERRMSG("Can't get next online node.\n"); -@@ -5374,7 +5374,7 @@ _exclude_free_page(struct cycle *cycle) - ERRMSG("Can't get pgdat list.\n"); - return FALSE; - } -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - for (num_nodes = 1; num_nodes <= vt.numnodes; num_nodes++) { - -@@ -5420,7 +5420,7 @@ _exclude_free_page(struct cycle *cycle) - * print [100 %] - */ - print_progress(PROGRESS_FREE_PAGES, vt.numnodes, vt.numnodes, NULL); -- print_execution_time(PROGRESS_FREE_PAGES, &tv_start); -+ print_execution_time(PROGRESS_FREE_PAGES, &ts_start); - - return TRUE; - } -@@ -5567,7 +5567,7 @@ create_1st_bitmap_file(void) - char buf[info->page_size]; - mdf_pfn_t pfn, pfn_start, pfn_end, pfn_bitmap1; - unsigned long long phys_start, phys_end; -- struct timeval tv_start; -+ struct timespec ts_start; - off_t offset_page; - - if (info->flag_refiltering) -@@ -5597,7 +5597,7 @@ create_1st_bitmap_file(void) - offset_page += info->page_size; - } - -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - /* - * If page is on memory hole, set bit on the 1st-bitmap. -@@ -5629,7 +5629,7 @@ create_1st_bitmap_file(void) - */ - if (!info->flag_mem_usage) { - print_progress(PROGRESS_HOLES, info->max_mapnr, info->max_mapnr, NULL); -- print_execution_time(PROGRESS_HOLES, &tv_start); -+ print_execution_time(PROGRESS_HOLES, &ts_start); - } - - if (!sync_1st_bitmap()) -@@ -5731,7 +5731,7 @@ create_bitmap_from_memhole(struct cycle *cycle, struct dump_bitmap *bitmap, int - mdf_pfn_t pfn_start_roundup, pfn_end_round; - unsigned long pfn_start_byte, pfn_end_byte; - unsigned int num_pt_loads = get_num_pt_loads(); -- struct timeval tv_start; -+ struct timespec ts_start; - - /* - * At first, clear all the bits on the bitmap. -@@ -5741,7 +5741,7 @@ create_bitmap_from_memhole(struct cycle *cycle, struct dump_bitmap *bitmap, int - /* - * If page is on memory hole, set bit on the bitmap. - */ -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - for (i = 0; get_pt_load(i, &phys_start, &phys_end, NULL, NULL); i++) { - pfn_start = MAX(paddr_to_pfn(phys_start), cycle->start_pfn); - pfn_end = MIN(paddr_to_pfn(phys_end), cycle->end_pfn); -@@ -5786,7 +5786,7 @@ create_bitmap_from_memhole(struct cycle *cycle, struct dump_bitmap *bitmap, int - * print 100 % - */ - print_progress(PROGRESS_HOLES, info->max_mapnr, info->max_mapnr, NULL); -- print_execution_time(PROGRESS_HOLES, &tv_start); -+ print_execution_time(PROGRESS_HOLES, &ts_start); - - return TRUE; - } -@@ -6045,14 +6045,14 @@ exclude_unnecessary_pages(struct cycle *cycle) - { - unsigned int mm; - struct mem_map_data *mmd; -- struct timeval tv_start; -+ struct timespec ts_start; - - if (is_xen_memory() && !info->dom0_mapnr) { - ERRMSG("Can't get max domain-0 PFN for excluding pages.\n"); - return FALSE; - } - -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - for (mm = 0; mm < info->num_mem_map; mm++) { - -@@ -6076,7 +6076,7 @@ exclude_unnecessary_pages(struct cycle *cycle) - */ - if (!info->flag_mem_usage) { - print_progress(PROGRESS_UNN_PAGES, info->num_mem_map, info->num_mem_map, NULL); -- print_execution_time(PROGRESS_UNN_PAGES, &tv_start); -+ print_execution_time(PROGRESS_UNN_PAGES, &ts_start); - } - - return TRUE; -@@ -7474,7 +7474,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - unsigned long frac_head, frac_tail; - off_t off_seg_load, off_memory; - Elf64_Phdr load; -- struct timeval tv_start; -+ struct timespec ts_start; - struct cycle cycle = {0}; - - if (!info->flag_elf_dumpfile) -@@ -7499,7 +7499,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - if (!(phnum = get_phnum_memory())) - return FALSE; - -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - for (i = 0; i < phnum; i++) { - if (!get_phdr_memory(i, &load)) -@@ -7547,7 +7547,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - } - - if ((num_dumped % per) == 0) -- print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &ts_start); - - num_dumped++; - -@@ -7666,8 +7666,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - /* - * print [100 %] - */ -- print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &tv_start); -- print_execution_time(PROGRESS_COPY, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &ts_start); -+ print_execution_time(PROGRESS_COPY, &ts_start); - PROGRESS_MSG("\n"); - - return TRUE; -@@ -8008,8 +8008,8 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header, - mdf_pfn_t per; - mdf_pfn_t start_pfn, end_pfn; - struct page_desc pd; -- struct timeval tv_start; -- struct timeval last, new; -+ struct timespec ts_start; -+ struct timespec last, new; - pthread_t **threads = NULL; - struct thread_args *kdump_thread_args = NULL; - void *thread_result; -@@ -8047,7 +8047,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header, - per = info->num_dumpable / 10000; - per = per ? per : 1; - -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - start_pfn = cycle->start_pfn; - end_pfn = cycle->end_pfn; -@@ -8095,7 +8095,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header, - * The next pfn is smallest pfn in all page_flag_buf. - */ - sem_wait(&info->page_flag_buf_sem); -- gettimeofday(&last, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &last); - while (1) { - current_pfn = end_pfn; - -@@ -8138,7 +8138,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header, - * So we should recheck. - */ - if (info->page_flag_buf[consuming]->ready != FLAG_READY) { -- gettimeofday(&new, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &new); - if (new.tv_sec - last.tv_sec > WAIT_TIME) { - ERRMSG("Can't get data of pfn.\n"); - goto out; -@@ -8151,7 +8151,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header, - } - - if ((num_dumped % per) == 0) -- print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start); - - num_dumped++; - -@@ -8187,8 +8187,8 @@ finish: - /* - * print [100 %] - */ -- print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start); -- print_execution_time(PROGRESS_COPY, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start); -+ print_execution_time(PROGRESS_COPY, &ts_start); - PROGRESS_MSG("\n"); - - out: -@@ -8238,7 +8238,7 @@ write_kdump_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_pag - struct page_desc pd; - unsigned char buf[info->page_size], *buf_out = NULL; - unsigned long len_buf_out; -- struct timeval tv_start; -+ struct timespec ts_start; - const off_t failed = (off_t)-1; - unsigned long len_buf_out_zlib, len_buf_out_lzo, len_buf_out_snappy; - -@@ -8299,12 +8299,12 @@ write_kdump_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_pag - end_pfn = info->split_end_pfn; - } - -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - for (pfn = start_pfn; pfn < end_pfn; pfn++) { - - if ((num_dumped % per) == 0) -- print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start); - - /* - * Check the excluded page. -@@ -8384,8 +8384,8 @@ out: - free(wrkmem); - #endif - -- print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start); -- print_execution_time(PROGRESS_COPY, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start); -+ print_execution_time(PROGRESS_COPY, &ts_start); - - return ret; - } -@@ -8747,7 +8747,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d - off_t offset_data=0; - struct disk_dump_header *dh = info->dump_header; - unsigned char buf[info->page_size]; -- struct timeval tv_start; -+ struct timespec ts_start; - - cd_header->offset - = (DISKDUMP_HEADER_BLOCKS + dh->sub_hdr_size + dh->bitmap_blocks) -@@ -8829,7 +8829,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d - } - free_bitmap2_buffer(); - -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - /* - * Write the remainder. -@@ -8842,8 +8842,8 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d - /* - * print [100 %] - */ -- print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start); -- print_execution_time(PROGRESS_COPY, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start); -+ print_execution_time(PROGRESS_COPY, &ts_start); - PROGRESS_MSG("\n"); - - return TRUE; -@@ -9563,10 +9563,10 @@ exclude_xen4_user_domain(void) - int - exclude_xen_user_domain(void) - { -- struct timeval tv_start; -+ struct timespec ts_start; - int ret; - -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - - if (info->xen_crash_info.com && - info->xen_crash_info.com->xen_major_version >= 4) -@@ -9578,7 +9578,7 @@ exclude_xen_user_domain(void) - * print [100 %] - */ - print_progress(PROGRESS_XEN_DOMAIN, 1, 1, NULL); -- print_execution_time(PROGRESS_XEN_DOMAIN, &tv_start); -+ print_execution_time(PROGRESS_XEN_DOMAIN, &ts_start); - - return ret; - } -@@ -10502,7 +10502,7 @@ reassemble_kdump_pages(void) - struct disk_dump_header dh; - struct page_desc pd, pd_zero; - struct cache_data cd_pd, cd_data; -- struct timeval tv_start; -+ struct timespec ts_start; - char *data = NULL; - unsigned long data_buf_size = info->page_size; - -@@ -10538,7 +10538,7 @@ reassemble_kdump_pages(void) - /* - * Write page header of zero-filled page. - */ -- gettimeofday(&tv_start, NULL); -+ clock_gettime(CLOCK_MONOTONIC, &ts_start); - if (info->dump_level & DL_EXCLUDE_ZERO) { - /* - * makedumpfile outputs the data of zero-filled page at first -@@ -10573,7 +10573,7 @@ reassemble_kdump_pages(void) - - num_dumped++; - -- print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &ts_start); - - if (lseek(fd, offset_ph_org, SEEK_SET) < 0) { - ERRMSG("Can't seek a file(%s). %s\n", -@@ -10670,8 +10670,8 @@ reassemble_kdump_pages(void) - size_eraseinfo)) - goto out; - } -- print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &tv_start); -- print_execution_time(PROGRESS_COPY, &tv_start); -+ print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &ts_start); -+ print_execution_time(PROGRESS_COPY, &ts_start); - - ret = TRUE; - out: -diff --git a/makedumpfile-1.6.4/print_info.c b/makedumpfile-1.6.4/print_info.c -index 6bfcd11..732d5b8 100644 ---- a/makedumpfile-1.6.4/print_info.c -+++ b/makedumpfile-1.6.4/print_info.c -@@ -19,6 +19,8 @@ - - #define PROGRESS_MAXLEN "50" - -+#define NSEC_PER_SEC 1000000000L -+ - int message_level; - int flag_strerr_message; - int flag_ignore_r_char; /* 0: '\r' is effective. 1: not effective. */ -@@ -338,16 +340,16 @@ print_usage(void) - MSG("\n"); - } - --static void calc_delta(struct timeval *tv_start, struct timeval *delta) -+static void calc_delta(struct timespec *ts_start, struct timespec *delta) - { -- struct timeval tv_end; -+ struct timespec ts_end; - -- gettimeofday(&tv_end, NULL); -- delta->tv_sec = tv_end.tv_sec - tv_start->tv_sec; -- delta->tv_usec = tv_end.tv_usec - tv_start->tv_usec; -- if (delta->tv_usec < 0) { -+ clock_gettime(CLOCK_MONOTONIC, &ts_end); -+ delta->tv_sec = ts_end.tv_sec - ts_start->tv_sec; -+ delta->tv_nsec = ts_end.tv_nsec - ts_start->tv_nsec; -+ if (delta->tv_nsec < 0) { - delta->tv_sec--; -- delta->tv_usec += 1000000; -+ delta->tv_nsec += NSEC_PER_SEC; - } - } - -@@ -371,14 +373,14 @@ static int eta_to_human_short (unsigned long secs, char* msg) - - - void --print_progress(const char *msg, unsigned long current, unsigned long end, struct timeval *start) -+print_progress(const char *msg, unsigned long current, unsigned long end, struct timespec *start) - { - unsigned progress; /* in promilles (tenths of a percent) */ - time_t tm; - static time_t last_time = 0; - static unsigned int lapse = 0; - static const char *spinner = "/|\\-"; -- struct timeval delta; -+ struct timespec delta; - unsigned long eta; - char eta_msg[16] = " "; - -@@ -393,7 +395,7 @@ print_progress(const char *msg, unsigned long current, unsigned long end, struct - - if (start != NULL && progress != 0) { - calc_delta(start, &delta); -- eta = 1000 * delta.tv_sec + delta.tv_usec / 1000; -+ eta = 1000 * delta.tv_sec + delta.tv_nsec / (NSEC_PER_SEC / 1000); - eta = eta / progress - delta.tv_sec; - eta_to_human_short(eta, eta_msg); - } -@@ -411,12 +413,12 @@ print_progress(const char *msg, unsigned long current, unsigned long end, struct - } - - void --print_execution_time(char *step_name, struct timeval *tv_start) -+print_execution_time(char *step_name, struct timespec *ts_start) - { -- struct timeval delta; -+ struct timespec delta; - -- calc_delta(tv_start, &delta); -+ calc_delta(ts_start, &delta); - REPORT_MSG("STEP [%s] : %ld.%06ld seconds\n", -- step_name, delta.tv_sec, delta.tv_usec); -+ step_name, delta.tv_sec, delta.tv_nsec / 1000); - } - -diff --git a/makedumpfile-1.6.4/print_info.h b/makedumpfile-1.6.4/print_info.h -index 1ce3593..49b70f4 100644 ---- a/makedumpfile-1.6.4/print_info.h -+++ b/makedumpfile-1.6.4/print_info.h -@@ -17,7 +17,7 @@ - #define _PRINT_INFO_H - - #include --#include -+#include - - extern int message_level; - extern int flag_strerr_message; -@@ -25,9 +25,9 @@ extern int flag_ignore_r_char; - - void show_version(void); - void print_usage(void); --void print_progress(const char *msg, unsigned long current, unsigned long end, struct timeval *start); -+void print_progress(const char *msg, unsigned long current, unsigned long end, struct timespec *start); - --void print_execution_time(char *step_name, struct timeval *tv_start); -+void print_execution_time(char *step_name, struct timespec *ts_start); - - /* - * Message texts --- -2.17.1 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-__START_KERNEL_map-macro.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-__START_KERNEL_map-macro.patch deleted file mode 100644 index 77c794d..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-__START_KERNEL_map-macro.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0da73f7e983aca00c211e8b8c8cc2c7b1269693f Mon Sep 17 00:00:00 2001 -From: Bhupesh Sharma -Date: Wed, 5 Sep 2018 15:20:27 +0530 -Subject: [PATCH] arm64/makedumpfile.h: Add __START_KERNEL_map macro - -This patch adds macro '__START_KERNEL_map' for arm64 architecture. - -Signed-off-by: Bhupesh Sharma ---- - makedumpfile.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/makedumpfile-1.6.4/makedumpfile.h b/makedumpfile-1.6.4/makedumpfile.h -index 5ff94b8e4ac6..88cf5578d8d9 100644 ---- a/makedumpfile-1.6.4/makedumpfile.h -+++ b/makedumpfile-1.6.4/makedumpfile.h -@@ -542,6 +542,7 @@ do { \ - #ifdef __aarch64__ - unsigned long get_kvbase_arm64(void); - #define KVBASE get_kvbase_arm64() -+#define __START_KERNEL_map (0xffffffff80000000UL) - #endif /* aarch64 */ - - #ifdef __arm__ --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-runtime-kaslr-offset-if-it-exists.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-runtime-kaslr-offset-if-it-exists.patch deleted file mode 100644 index f6e2ab4..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-runtime-kaslr-offset-if-it-exists.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 616c98d1abac6f348f13cfe55e2df5e1d5d26781 Mon Sep 17 00:00:00 2001 -From: Bhupesh Sharma -Date: Thu, 19 Jul 2018 11:13:41 +0530 -Subject: [PATCH] [PATCH] arm64: Add runtime kaslr offset if it exists - -If we have to erase a symbol from vmcore whose address is not present in -vmcoreinfo, then we need to pass vmlinux as well to get the symbol -address. -When kaslr is enabled, virtual address of all the kernel symbols are -randomized with an offset. vmlinux always has a static address, but all -the arch specific calculation are based on run time kernel address. So -we need to find a way to translate symbol address from vmlinux to kernel -run time address. - -Without this patch: - # cat > scrub.conf << EOF - [vmlinux] - erase jiffies - erase init_task.utime - for tsk in init_task.tasks.next within task_struct:tasks - erase tsk.utime - endfor - EOF - - # makedumpfile --split -d 31 -x vmlinux --config scrub.conf vmcore dumpfile_{1,2,3} - readpage_elf: Attempt to read non-existent page at 0xffffa8a5bf180000. - readmem: type_addr: 1, addr:ffffa8a5bf180000, size:8 - vaddr_to_paddr_arm64: Can't read pgd - readmem: Can't convert a virtual address(ffff0000092a542c) to physical - address. - readmem: type_addr: 0, addr:ffff0000092a542c, size:390 - check_release: Can't get the address of system_utsname - -After this patch check_release() is ok, and also we are able to erase -symbol from vmcore (I checked this with kernel 4.18.0-rc4+): - - # makedumpfile --split -d 31 -x vmlinux --config scrub.conf vmcore dumpfile_{1,2,3} - The kernel version is not supported. - The makedumpfile operation may be incomplete. - Checking for memory holes : [100.0 %] \ - Checking for memory holes : [100.0 %] | - Checking foExcluding unnecessary pages : [100.0 %] - \ - Excluding unnecessary pages : [100.0 %] \ - - The dumpfiles are saved to dumpfile_1, dumpfile_2, and dumpfile_3. - - makedumpfile Completed. - -This feature also requires a fix in the kernel as well which has been submitted -upstream (see[0]). - -[0] https://patchwork.kernel.org/patch/10533333/ - -Signed-off-by: Bhupesh Sharma ---- - arch/arm64.c | 41 +++++++++++++++++++++++++++++++++++++++++ - makedumpfile.h | 3 ++- - 2 files changed, 43 insertions(+), 1 deletion(-) - -diff --git a/makedumpfile-1.6.4/arch/arm64.c b/makedumpfile-1.6.4/arch/arm64.c -index 836ce17b339c..362609668ea2 100644 ---- a/makedumpfile-1.6.4/arch/arm64.c -+++ b/makedumpfile-1.6.4/arch/arm64.c -@@ -181,6 +181,47 @@ get_phys_base_arm64(void) - return TRUE; - } - -+unsigned long -+get_kaslr_offset_arm64(unsigned long vaddr) -+{ -+ unsigned int i; -+ char buf[BUFSIZE_FGETS], *endp; -+ -+ if (!info->kaslr_offset && info->file_vmcoreinfo) { -+ if (fseek(info->file_vmcoreinfo, 0, SEEK_SET) < 0) { -+ ERRMSG("Can't seek the vmcoreinfo file(%s). %s\n", -+ info->name_vmcoreinfo, strerror(errno)); -+ return FALSE; -+ } -+ -+ while (fgets(buf, BUFSIZE_FGETS, info->file_vmcoreinfo)) { -+ i = strlen(buf); -+ if (!i) -+ break; -+ if (buf[i - 1] == '\n') -+ buf[i - 1] = '\0'; -+ if (strncmp(buf, STR_KERNELOFFSET, -+ strlen(STR_KERNELOFFSET)) == 0) { -+ info->kaslr_offset = -+ strtoul(buf+strlen(STR_KERNELOFFSET),&endp,16); -+ DEBUG_MSG("info->kaslr_offset: %lx\n", info->kaslr_offset); -+ } -+ } -+ } -+ -+ if (vaddr >= __START_KERNEL_map && -+ vaddr < __START_KERNEL_map + info->kaslr_offset) { -+ DEBUG_MSG("info->kaslr_offset: %lx\n", info->kaslr_offset); -+ return info->kaslr_offset; -+ } else { -+ /* -+ * TODO: we need to check if it is vmalloc/vmmemmap/module -+ * address, we will have different offset -+ */ -+ return 0; -+ } -+} -+ - ulong - get_stext_symbol(void) - { -diff --git a/makedumpfile-1.6.4/makedumpfile.h b/makedumpfile-1.6.4/makedumpfile.h -index ba85f03e856d..3244d31ae43a 100644 ---- a/makedumpfile-1.6.4/makedumpfile.h -+++ b/makedumpfile-1.6.4/makedumpfile.h -@@ -971,12 +971,13 @@ unsigned long long vaddr_to_paddr_arm64(unsigned long vaddr); - int get_versiondep_info_arm64(void); - int get_xen_basic_info_arm64(void); - int get_xen_info_arm64(void); -+unsigned long get_kaslr_offset_arm64(unsigned long vaddr); - #define find_vmemmap() stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_arm64(X) - #define get_phys_base() get_phys_base_arm64() - #define get_machdep_info() get_machdep_info_arm64() - #define get_versiondep_info() get_versiondep_info_arm64() --#define get_kaslr_offset(X) stub_false() -+#define get_kaslr_offset(X) get_kaslr_offset_arm64(X) - #define get_xen_basic_info_arch(X) get_xen_basic_info_arm64(X) - #define get_xen_info_arch(X) get_xen_info_arm64(X) - #define is_phys_addr(X) stub_true_ul(X) --- -2.7.4 diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch deleted file mode 100644 index edce7e3..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch +++ /dev/null @@ -1,227 +0,0 @@ -From c301996fc5c671ff9313189f87bd3dd2c38ccb52 Mon Sep 17 00:00:00 2001 -From: Bhupesh Sharma -Date: Thu, 21 Feb 2019 13:48:49 +0530 -Subject: [PATCH] makedumpfile/arm64: Add support for ARMv8.2-LVA (52-bit - user-space VA support) - -With ARMv8.2-LVA architecture extension availability, arm64 hardware -which supports this extension can support upto 52-bit virtual -addresses. It is specially useful for having a 52-bit user-space -virtual -address space while the kernel can still retain 48-bit virtual -addresses. - -Since at the moment we enable the support of this extension in the -kernel via a CONFIG flag (CONFIG_ARM64_USER_VA_BITS_52), so there are -no clear mechanisms in user-space to determine this CONFIG -flag value and use it to determine the user-space VA address range -values. - -'makedumpfile' can instead use 'MAX_USER_VA_BITS' value to -determine the maximum virtual physical address supported by -user-space. -If 'MAX_USER_VA_BITS' value is greater than 'VA_BITS' than we are -running a use-case where user-space is 52-bit and underlying kernel is -still 48-bit. The increased 'PTRS_PER_PGD' value for such cases can -then -be calculated as is done by the underlying kernel (see kernel file -'arch/arm64/include/asm/pgtable-hwdef.h' for details): - - #define PTRS_PER_PGD (1 << (MAX_USER_VA_BITS - PGDIR_SHIFT)) - -I have sent a kernel patch upstream to add 'MAX_USER_VA_BITS' to -vmcoreinfo for arm64 (see [0]). - -This patch is in accordance with ARMv8 Architecture Reference Manual -version D.a - -[0]. http://lists.infradead.org/pipermail/kexec/2019-February/022411.html - -Signed-off-by: Bhupesh Sharma ---- - arch/arm64.c | 106 +++++++++++++++++++++++++++++++++++++++++---------------- - makedumpfile.c | 2 ++ - makedumpfile.h | 1 + - 3 files changed, 80 insertions(+), 29 deletions(-) - -diff --git a/makedumpfile-1.6.4/arch/arm64.c b/makedumpfile-1.6.4/arch/arm64.c -index 053519359cbc..e3bead4bb103 100644 ---- a/makedumpfile-1.6.4/arch/arm64.c -+++ b/makedumpfile-1.6.4/arch/arm64.c -@@ -41,6 +41,7 @@ typedef struct { - - static int pgtable_level; - static int va_bits; -+static int max_user_va_bits; - static unsigned long kimage_voffset; - - #define SZ_4K (4 * 1024) -@@ -61,7 +62,7 @@ static unsigned long kimage_voffset; - - #define PAGE_MASK (~(PAGESIZE() - 1)) - #define PGDIR_SHIFT ((PAGESHIFT() - 3) * pgtable_level + 3) --#define PTRS_PER_PGD (1 << (va_bits - PGDIR_SHIFT)) -+#define PTRS_PER_PGD (1 << ((max_user_va_bits) - PGDIR_SHIFT)) - #define PUD_SHIFT get_pud_shift_arm64() - #define PUD_SIZE (1UL << PUD_SHIFT) - #define PUD_MASK (~(PUD_SIZE - 1)) -@@ -284,14 +285,84 @@ get_stext_symbol(void) - return(found ? kallsym : FALSE); - } - -+static int -+get_va_bits_from_stext_arm64(void) -+{ -+ ulong _stext; -+ -+ _stext = get_stext_symbol(); -+ if (!_stext) { -+ ERRMSG("Can't get the symbol of _stext.\n"); -+ return FALSE; -+ } -+ -+ /* Derive va_bits as per arch/arm64/Kconfig */ -+ if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) { -+ va_bits = 36; -+ } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) { -+ va_bits = 39; -+ } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) { -+ va_bits = 42; -+ } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) { -+ va_bits = 47; -+ } else if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) { -+ va_bits = 48; -+ } else { -+ ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n"); -+ return FALSE; -+ } -+ -+ DEBUG_MSG("va_bits : %d(_stext)\n", va_bits); -+ -+ return TRUE; -+} -+ -+static void -+get_page_offset_arm64(void) -+{ -+ info->page_offset = (0xffffffffffffffffUL) << (va_bits - 1); -+ -+ DEBUG_MSG("page_offset : %lx\n", info->page_offset); -+} -+ - int - get_machdep_info_arm64(void) - { - /* Check if va_bits is still not initialized. If still 0, call - * get_versiondep_info() to initialize the same. - */ -+ if (NUMBER(VA_BITS) != NOT_FOUND_NUMBER) { -+ va_bits = NUMBER(VA_BITS); -+ DEBUG_MSG("va_bits : %d (vmcoreinfo)\n", -+ va_bits); -+ } -+ -+ /* Check if va_bits is still not initialized. If still 0, call -+ * get_versiondep_info() to initialize the same from _stext -+ * symbol. -+ */ -+ - if (!va_bits) -- get_versiondep_info_arm64(); -+ if (get_va_bits_from_stext_arm64() == ERROR) -+ return FALSE; -+ -+ get_page_offset_arm64(); -+ -+ if (NUMBER(MAX_USER_VA_BITS) != NOT_FOUND_NUMBER) { -+ max_user_va_bits = NUMBER(MAX_USER_VA_BITS); -+ DEBUG_MSG("max_user_va_bits : %d (vmcoreinfo)\n", -+ max_user_va_bits); -+ } -+ -+ /* Check if max_user_va_bits is still not initialized. -+ * If still 0, its not available in vmcoreinfo and its -+ * safe to initialize it with va_bits. -+ */ -+ if (!max_user_va_bits) { -+ max_user_va_bits = va_bits; -+ DEBUG_MSG("max_user_va_bits : %d (default = va_bits)\n", -+ max_user_va_bits); -+ } - - if (!calculate_plat_config()) { - ERRMSG("Can't determine platform config values\n"); -@@ -330,34 +401,11 @@ get_xen_info_arm64(void) - int - get_versiondep_info_arm64(void) - { -- ulong _stext; -- -- _stext = get_stext_symbol(); -- if (!_stext) { -- ERRMSG("Can't get the symbol of _stext.\n"); -- return FALSE; -- } -- -- /* Derive va_bits as per arch/arm64/Kconfig */ -- if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) { -- va_bits = 36; -- } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) { -- va_bits = 39; -- } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) { -- va_bits = 42; -- } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) { -- va_bits = 47; -- } else if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) { -- va_bits = 48; -- } else { -- ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n"); -- return FALSE; -- } -- -- info->page_offset = (0xffffffffffffffffUL) << (va_bits - 1); -+ if (!va_bits) -+ if (get_va_bits_from_stext_arm64() == ERROR) -+ return FALSE; - -- DEBUG_MSG("va_bits : %d\n", va_bits); -- DEBUG_MSG("page_offset : %lx\n", info->page_offset); -+ get_page_offset_arm64(); - - return TRUE; - } -diff --git a/makedumpfile-1.6.4/makedumpfile.c b/makedumpfile-1.6.4/makedumpfile.c -index b7c1c01251bf..ccf7eb4408ba 100644 ---- a/makedumpfile-1.6.4/makedumpfile.c -+++ b/makedumpfile-1.6.4/makedumpfile.c -@@ -2291,6 +2291,7 @@ write_vmcoreinfo_data(void) - - WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR); - #ifdef __aarch64__ -+ WRITE_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS); - WRITE_NUMBER("VA_BITS", VA_BITS); - WRITE_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET); - WRITE_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset); -@@ -2694,6 +2695,7 @@ read_vmcoreinfo(void) - READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE); - READ_NUMBER("phys_base", phys_base); - #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.4/makedumpfile.h b/makedumpfile-1.6.4/makedumpfile.h -index d49f1f1fc1a9..3fa810e0bb40 100644 ---- a/makedumpfile-1.6.4/makedumpfile.h -+++ b/makedumpfile-1.6.4/makedumpfile.h -@@ -1933,6 +1933,7 @@ struct number_table { - long HUGETLB_PAGE_DTOR; - long phys_base; - #ifdef __aarch64__ -+ long MAX_USER_VA_BITS; - long VA_BITS; - unsigned long PHYS_OFFSET; - unsigned long kimage_voffset; --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-restore-info-page_offset-and-implement-paddr_t.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-restore-info-page_offset-and-implement-paddr_t.patch deleted file mode 100644 index 9a7364c..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-arm64-restore-info-page_offset-and-implement-paddr_t.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 5bab3f22077843d68deba6a0b4775de98a6edff7 Mon Sep 17 00:00:00 2001 -From: Bhupesh Sharma -Date: Wed, 26 Dec 2018 16:16:30 +0530 -Subject: [PATCH] arm64: Rework info->page_offset - - [PATCH] arm64: restore info->page_offset and implement paddr_to_vaddr_arm64() - - commit 94c97db3 (arm64: Get 'info->page_offset' from PT_LOAD segments - to support KASLR boot cases) added a method to determine info->page_offset - (PAGE_OFFSET) from PT_LOAD segments for arm64 platforms to support - --mem-usage option, but its hardcoded condition did not work correctly - on several systems. - - This patch restores the method to determine PAGE_OFFSET value, which - is same as kernel's definition, and determine info->phys_offset from - PT_LOAD by using PAGE_OFFSET. With these two values, implement - paddr_to_vaddr_arm64() to support --mem-usage option. - - Tested-by: Bhupesh Sharma - Signed-off-by: Kazuhito Hagio - -Signed-off-by: Bhupesh Sharma ---- - arch/arm64.c | 34 +++++++++++++++++++++++++++++----- - makedumpfile.c | 4 ++++ - makedumpfile.h | 4 +++- - 3 files changed, 36 insertions(+), 6 deletions(-) - -diff --git a/makedumpfile-1.6.4/arch/arm64.c b/makedumpfile-1.6.4/arch/arm64.c -index 302c18d1d8b6..053519359cbc 100644 ---- a/makedumpfile-1.6.4/arch/arm64.c -+++ b/makedumpfile-1.6.4/arch/arm64.c -@@ -174,11 +174,35 @@ get_kvbase_arm64(void) - int - get_phys_base_arm64(void) - { -- info->phys_base = NUMBER(PHYS_OFFSET); -+ int i; -+ unsigned long long phys_start; -+ unsigned long long virt_start; -+ -+ if (NUMBER(PHYS_OFFSET) != NOT_FOUND_NUMBER) { -+ info->phys_base = NUMBER(PHYS_OFFSET); -+ DEBUG_MSG("phys_base : %lx (vmcoreinfo)\n", -+ info->phys_base); -+ return TRUE; -+ } - -- DEBUG_MSG("phys_base : %lx\n", info->phys_base); -+ if (get_num_pt_loads() && PAGE_OFFSET) { -+ for (i = 0; -+ get_pt_load(i, &phys_start, NULL, &virt_start, NULL); -+ i++) { -+ if (virt_start != NOT_KV_ADDR -+ && virt_start >= PAGE_OFFSET -+ && phys_start != NOT_PADDR) { -+ info->phys_base = phys_start - -+ (virt_start & ~PAGE_OFFSET); -+ DEBUG_MSG("phys_base : %lx (pt_load)\n", -+ info->phys_base); -+ return TRUE; -+ } -+ } -+ } - -- return TRUE; -+ ERRMSG("Cannot determine phys_base\n"); -+ return FALSE; - } - - unsigned long -@@ -332,8 +356,8 @@ get_versiondep_info_arm64(void) - - info->page_offset = (0xffffffffffffffffUL) << (va_bits - 1); - -- DEBUG_MSG("page_offset=%lx, va_bits=%d\n", info->page_offset, -- va_bits); -+ DEBUG_MSG("va_bits : %d\n", va_bits); -+ DEBUG_MSG("page_offset : %lx\n", info->page_offset); - - return TRUE; - } -diff --git a/makedumpfile-1.6.4/makedumpfile.c b/makedumpfile-1.6.4/makedumpfile.c -index 5fa945d30c72..c9a6efd35a24 100644 ---- a/makedumpfile-1.6.4/makedumpfile.c -+++ b/makedumpfile-1.6.4/makedumpfile.c -@@ -11214,6 +11214,10 @@ int show_mem_usage(void) - if (!get_page_offset()) - return FALSE; - -+ /* paddr_to_vaddr() on arm64 needs phys_base. */ -+ if (!get_phys_base()) -+ return FALSE; -+ - if (!get_sys_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len)) - return FALSE; - -diff --git a/makedumpfile-1.6.4/makedumpfile.h b/makedumpfile-1.6.4/makedumpfile.h -index 593ed71dafe3..b30f62b6bdf2 100644 ---- a/makedumpfile-1.6.4/makedumpfile.h -+++ b/makedumpfile-1.6.4/makedumpfile.h -@@ -972,9 +972,11 @@ int get_versiondep_info_arm64(void); - int get_xen_basic_info_arm64(void); - int get_xen_info_arm64(void); - unsigned long get_kaslr_offset_arm64(unsigned long vaddr); -+#define paddr_to_vaddr_arm64(X) (((X) - info->phys_base) | PAGE_OFFSET) -+ - #define find_vmemmap() stub_false() - #define vaddr_to_paddr(X) vaddr_to_paddr_arm64(X) --#define paddr_to_vaddr(X) paddr_to_vaddr_general(X) -+#define paddr_to_vaddr(X) paddr_to_vaddr_arm64(X) - #define get_phys_base() get_phys_base_arm64() - #define get_machdep_info() get_machdep_info_arm64() - #define get_versiondep_info() get_versiondep_info_arm64() --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-ppc64-increase-MAX_PHYSMEM_BITS-to-128TB.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-ppc64-increase-MAX_PHYSMEM_BITS-to-128TB.patch deleted file mode 100644 index 02639ef..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-ppc64-increase-MAX_PHYSMEM_BITS-to-128TB.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 1ce09879ba20fe6f0119fb8b38528cd3b5125a1b Mon Sep 17 00:00:00 2001 -From: Hari Bathini -Date: Wed, 26 Sep 2018 22:26:26 +0530 -Subject: [PATCH] [PATCH] ppc64: increase MAX_PHYSMEM_BITS to 128TB - -* Required for kernel 4.19 - -With kernel commit 7d4340bb92a9 ("powerpc/mm: Increase MAX_PHYSMEM_BITS -to 128TB with SPARSEMEM_VMEMMAP config"), MAX_PHYSMEM_BITS is bumped up -to 47. Make the appropriate update here. - -Signed-off-by: Hari Bathini -Signed-off-by: Pingfan Liu ---- - arch/ppc64.c | 5 +++++ - makedumpfile.h | 1 + - 2 files changed, 6 insertions(+) - -diff --git a/makedumpfile-1.6.4/arch/ppc64.c b/makedumpfile-1.6.4/arch/ppc64.c -index 8b6f7d5..947a125 100644 ---- a/makedumpfile-1.6.4/arch/ppc64.c -+++ b/makedumpfile-1.6.4/arch/ppc64.c -@@ -481,6 +481,11 @@ set_ppc64_max_physmem_bits(void) - || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT()))) - return TRUE; - -+ info->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19; -+ if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME())) -+ || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT()))) -+ return TRUE; -+ - return FALSE; - } - -diff --git a/makedumpfile-1.6.4/makedumpfile.h b/makedumpfile-1.6.4/makedumpfile.h -index d1fcd87..46ebe2e 100644 ---- a/makedumpfile-1.6.4/makedumpfile.h -+++ b/makedumpfile-1.6.4/makedumpfile.h -@@ -673,6 +673,7 @@ unsigned long get_kvbase_arm64(void); - #define _SECTION_SIZE_BITS (24) - #define _MAX_PHYSMEM_BITS_ORIG (44) - #define _MAX_PHYSMEM_BITS_3_7 (46) -+#define _MAX_PHYSMEM_BITS_4_19 (47) - #define REGION_SHIFT (60UL) - #define VMEMMAP_REGION_ID (0xfUL) - --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-sadump-fix-failure-of-reading-640-KB-ba.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-sadump-fix-failure-of-reading-640-KB-ba.patch deleted file mode 100644 index 1b69005..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-sadump-fix-failure-of-reading-640-KB-ba.patch +++ /dev/null @@ -1,116 +0,0 @@ -From d015e6df8bd320fbabcd98cc157acf655fc0851b Mon Sep 17 00:00:00 2001 -From: "Hatayama, Daisuke" -Date: Tue, 30 Oct 2018 02:47:22 +0000 -Subject: [PATCH] makedumpfile: sadump: fix failure of reading 640 KB backup - region if at over 4GB location - -Currently, in function sadump_kdump_backup_region_init(), variable mem -holding physical memory to read as a candidate of the ELF core header -is of type unsigned int with just 4 byte length: - - for (i = 0; i < ARRAY_LENGTH(kimage.segment); ++i) { - char e_ident[EI_NIDENT]; - unsigned mem; - - mem=ULONG(buf+i*SIZE(kexec_segment)+OFFSET(kexec_segment.mem)); - if (!mem) - continue; - - if (!readmem(PADDR, mem, e_ident, SELFMAG)) { - DEBUG_MSG("sadump: failed to read elfcorehdr buffer\n"); - return; - } - -Thus, if backup region for the first 640KB physical memory is located -at over 4GB location thanks to crashkernel=size,high like: - - # grep crashkernel /proc/cmdline - BOOT_IMAGE=(hd0,gpt2)/vmlinuz-4.18 root=/dev/mapper/rhel-root ro crashkernel=512M,high - - # grep Crash /proc/iomem - 06000000-15ffffff : Crash kernel - 107f000000-109effffff : Crash kernel - - crash> rd -p 0x109ef5d000 - 109ef5d000: 00010102464c457f .ELF.... - -the upper 32-bit of the physical address in mem variable is dropped -and readmem() fails while outputting the following debug message: - - # LANG=C ./makedumpfile --message-level 8 -f -l -d 31 -x ./vmlinux /dev/sdc vmcore-ld31 - sadump: read dump device as single partition - sadump: single partition configuration - page_size : 4096 - sadump: timezone information is missing - sadump: idtr=fffffe0000000000 - sadump: cr3=86b42e000 - sadump: idtr(phys)=4c35cc000 - sadump: devide_error(vmlinux)=ffffffff81a00c50 - sadump: devide_error(vmcore)=ffffffffa0c00c50 - sadump: cmdline vaddr: ffffffffa1bcf008 - sadump: cmdline paddr: 4c35cf008 - sadump: cmdline buf vaddr: ffff8ae89ffceec0 - sadump: cmdline buf paddr: 109ffceec0 - sadump: kaslr_offset=1f200000 - sadump: phys_base=4a1a00000 - sadump: online cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [...] - sadump: nr_cpus: 60 - - sadump: failed to read elfcorehdr buffer <--- This is the debug message indicating - reading ELF core header fails - -Then, the generated vmcore has invalid data in its first 640KB part. - -The variable mem needs to have type of 64-bit length. - -With this patch, kdump backup region is successfully found as follows: - - # LANG=C ./makedumpfile --message-level 31 -f -l -d 31 -x ./vmlinux /dev/sdc vmcore-ld31 - sadump: read dump device as single partition - sadump: single partition configuration - page_size : 4096 - sadump: timezone information is missing - sadump: idtr=fffffe0000000000 - sadump: cr3=86b42e000 - sadump: idtr(phys)=4c35cc000 - sadump: devide_error(vmlinux)=ffffffff81a00c50 - sadump: devide_error(vmcore)=ffffffffa0c00c50 - sadump: cmdline vaddr: ffffffffa1bcf008 - sadump: cmdline paddr: 4c35cf008 - sadump: cmdline buf vaddr: ffff8ae89ffceec0 - sadump: cmdline buf paddr: 109ffceec0 - sadump: kaslr_offset=1f200000 - sadump: phys_base=4a1a00000 - sadump: online cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [...] - sadump: nr_cpus: 60 - The kernel version is not supported. - The makedumpfile operation may be incomplete. - sadump: SRC_START: 0x00000000001000 SRC_SIZE: 0x0000000009f000 SRC_OFFSET: 0x0000109ef61000 - sadump: kdump backup region used - ...... - -By the way, before crashkernel=size,high was introduced, there was -limitation that ELF core header resides at under 4GB location, so -defining it as unsigned int was not entirely wrong at that time. - -Signed-off-by: HATAYAMA Daisuke ---- - sadump_info.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/makedumpfile-1.6.4/sadump_info.c b/makedumpfile-1.6.4/sadump_info.c -index 34b568c..46867ce 100644 ---- a/makedumpfile-1.6.4/sadump_info.c -+++ b/makedumpfile-1.6.4/sadump_info.c -@@ -2395,7 +2395,7 @@ sadump_kdump_backup_region_init(void) - elfcorehdr_p = 0; - for (i = 0; i < ARRAY_LENGTH(kimage.segment); ++i) { - char e_ident[EI_NIDENT]; -- unsigned mem; -+ unsigned long mem; - - mem=ULONG(buf+i*SIZE(kexec_segment)+OFFSET(kexec_segment.mem)); - if (!mem) --- -2.17.1 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-when-refiltering-initialize-refiltered-bitm.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-when-refiltering-initialize-refiltered-bitm.patch deleted file mode 100644 index 2fc68ab..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-when-refiltering-initialize-refiltered-bitm.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 3adf612137e8e488fe721ba154c089efbfead30a Mon Sep 17 00:00:00 2001 -From: Pingfan Liu -Date: Wed, 8 Aug 2018 13:21:44 +0800 -Subject: [PATCH] [PATCH v3] when refiltering, initialize refiltered bitmap2 - from the kdump file's bitmap2 - -When refiltering on kdump format file, there is no info about pt_load[] for -exclude_nodata_pages(), and also we can not expect more data than the kdump -file can provide, hence this patch suggests to initialize the refiltered -bitmap2 from the kdump file's bitmap2. As for the statistic of pfn_memhole, -it should be calculated and discount the bits in kdump file's bitmap1. - -Note about the bug reported by the following ops: - makedumpfile -l --message-level 1 -d 31 /proc/vmcore /path/to/vmcore - makedumpfile --split -d 31 ./vmcore dumpfile_{1,2,3} 2>&1 -And get the following error: - Excluding unnecessary pages : [100.0 %] \ - readpage_kdump_compressed: pfn(9b) is excluded from /var/crash/127.0.0.1-2018-07-02-22:10:38/vmcore. - readmem: type_addr: 1, addr:9b000, size:4096 - read_pfn: Can't get the page data. - writeout_multiple_dumpfiles: Child process(2277) finished incompletely.(256) - Copying data : [ 24.6 %] - eta: 2s - makedumpfile Failed. - -Cc: Kazuhito Hagio -Signed-off-by: Pingfan Liu ---- - makedumpfile.c | 40 +++++++++++++++++++++++++++++++++++----- - 1 file changed, 35 insertions(+), 5 deletions(-) - -diff --git a/makedumpfile-1.6.4/makedumpfile.c b/makedumpfile-1.6.4/makedumpfile.c -index 915cbf4f3c2b..3ccdaaeda0c5 100644 ---- a/makedumpfile-1.6.4/makedumpfile.c -+++ b/makedumpfile-1.6.4/makedumpfile.c -@@ -5516,6 +5516,27 @@ out: - "follow free lists instead of mem_map array.\n"); - } - -+static mdf_pfn_t count_bits(char *buf, int sz) -+{ -+ char *p = buf; -+ int i, j; -+ mdf_pfn_t cnt = 0; -+ -+ for (i = 0; i < sz; i++, p++) { -+ if (*p == 0) -+ continue; -+ else if (*p == 0xff) { -+ cnt += 8; -+ continue; -+ } -+ for (j = 0; j < 8; j++) { -+ if (*p & (1<name_memory, strerror(errno)); - return FALSE; - } -+ pfn_memhole -= count_bits(buf, sizeof(buf)); - if (write(info->bitmap1->fd, buf, sizeof(buf)) != sizeof(buf)) { - ERRMSG("Can't write the bitmap(%s). %s\n", - info->bitmap1->file_name, strerror(errno)); -@@ -6093,19 +6115,27 @@ copy_bitmap_buffer(void) - int - copy_bitmap_file(void) - { -- off_t offset; -+ off_t base, offset = 0; - unsigned char buf[info->page_size]; - const off_t failed = (off_t)-1; -+ int fd; -+ struct disk_dump_header *dh = info->dh_memory; - -- offset = 0; -+ if (info->flag_refiltering) { -+ fd = info->fd_memory; -+ base = (DISKDUMP_HEADER_BLOCKS + dh->sub_hdr_size) * dh->block_size; -+ base += info->len_bitmap / 2; -+ } else { -+ fd = info->bitmap1->fd; -+ base = info->bitmap1->offset; -+ } - while (offset < (info->len_bitmap / 2)) { -- if (lseek(info->bitmap1->fd, info->bitmap1->offset + offset, -- SEEK_SET) == failed) { -+ if (lseek(fd, base + offset, SEEK_SET) == failed) { - ERRMSG("Can't seek the bitmap(%s). %s\n", - info->name_bitmap, strerror(errno)); - return FALSE; - } -- if (read(info->bitmap1->fd, buf, sizeof(buf)) != sizeof(buf)) { -+ if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { - ERRMSG("Can't read the dump memory(%s). %s\n", - info->name_memory, strerror(errno)); - return FALSE; --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-makedumpfile-x86_64-fix-an-unnecessary-message-with-mem-usa.patch b/SOURCES/kexec-tools-2.0.17-makedumpfile-x86_64-fix-an-unnecessary-message-with-mem-usa.patch deleted file mode 100644 index aa1342a..0000000 --- a/SOURCES/kexec-tools-2.0.17-makedumpfile-x86_64-fix-an-unnecessary-message-with-mem-usa.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 53cf78343dceb13838c362558d5c05f699f7de68 Mon Sep 17 00:00:00 2001 -From: Kazuhito Hagio -Date: Fri, 16 Nov 2018 16:03:04 -0500 -Subject: [PATCH] [PATCH] x86_64: fix an unnecessary message with --mem-usage - option - -commit bc8b3bbf ("arm64: restore info->page_offset and implement -paddr_to_vaddr_arm64()") added get_phys_base() to show_mem_usage(), -but at this time there is no vmcoreinfo yet, so get_phys_base_x86_64() -executes SYMBOL_INIT() and prints the following message. - - # makedumpfile --mem-usage /proc/kcore - init_dwarf_info: Can't find absolute path to debuginfo file. - ... - -This patch adds the check if vmlinux is specified, and suppress the -message. - -Signed-off-by: Kazuhito Hagio ---- - arch/x86_64.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/makedumpfile-1.6.4/arch/x86_64.c b/makedumpfile-1.6.4/arch/x86_64.c -index 2b3c0bb356a1..a0d45b279cd9 100644 ---- a/makedumpfile-1.6.4/arch/x86_64.c -+++ b/makedumpfile-1.6.4/arch/x86_64.c -@@ -87,7 +87,7 @@ get_page_offset_x86_64(void) - unsigned long long virt_start; - unsigned long page_offset_base; - -- if (info->kaslr_offset && (info->fd_vmlinux != -1)) { -+ if (info->kaslr_offset && info->name_vmlinux) { - page_offset_base = get_symbol_addr("page_offset_base"); - page_offset_base += info->kaslr_offset; - if (!readmem(VADDR, page_offset_base, &info->page_offset, -@@ -139,7 +139,7 @@ get_phys_base_x86_64(void) - } - - /* linux-2.6.21 or older don't have phys_base, should be set to 0. */ -- if (!has_vmcoreinfo()) { -+ if (!has_vmcoreinfo() && info->name_vmlinux) { - SYMBOL_INIT(phys_base, "phys_base"); - if (SYMBOL(phys_base) == NOT_FOUND_SYMBOL) { - return TRUE; --- -2.7.4 - diff --git a/SOURCES/kexec-tools-2.0.17-vmcore-dmesg-fix-infinite-loop-if-log-buffer-wraps-a.patch b/SOURCES/kexec-tools-2.0.17-vmcore-dmesg-fix-infinite-loop-if-log-buffer-wraps-a.patch deleted file mode 100644 index 5ad48ca..0000000 --- a/SOURCES/kexec-tools-2.0.17-vmcore-dmesg-fix-infinite-loop-if-log-buffer-wraps-a.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e277fa9ec702fea7bd3135393c67327c821d5a3a Mon Sep 17 00:00:00 2001 -From: Omar Sandoval -Date: Wed, 23 May 2018 13:59:31 -0700 -Subject: [PATCH] vmcore-dmesg: fix infinite loop if log buffer wraps around - -We hit a bug where vmcore-dmesg would get stuck in a loop, and since we -were redirecting the output to a file, it wouldn't stop until it filled -up the disk. This only happened when the dmesg buffer had filled up and -wrapped around. It turns out that when we hit the end of the buffer, we -are looping back to the first record instead of the beginning of the -buffer, which will always loop forever. - -Fixes: e08d26b3b7f1 ("vmcore-dmesg: avoid allocating large memory chunk for log buf") -Signed-off-by: Omar Sandoval -Acked-by: Baoquan He -Signed-off-by: Simon Horman -Signed-off-by: Pingfan Liu ---- - 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 e340ef4..7972788 100644 ---- a/vmcore-dmesg/vmcore-dmesg.c -+++ b/vmcore-dmesg/vmcore-dmesg.c -@@ -689,7 +689,7 @@ static void dump_dmesg_structured(int fd) - */ - loglen = struct_val_u16(buf, log_offset_len); - if (!loglen) -- current_idx = log_first_idx; -+ current_idx = 0; - else - /* Move to next record */ - current_idx += loglen; --- -2.7.4 - 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 new file mode 100644 index 0000000..0eee6ea --- /dev/null +++ b/SOURCES/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/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 new file mode 100644 index 0000000..9825ef4 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch @@ -0,0 +1,149 @@ +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 new file mode 100644 index 0000000..e4052fa --- /dev/null +++ b/SOURCES/kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch @@ -0,0 +1,41 @@ +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-kexec-arm64-Add-support-for-handling-zlib-compressed.patch b/SOURCES/kexec-tools-2.0.19-kexec-arm64-Add-support-for-handling-zlib-compressed.patch new file mode 100644 index 0000000..bdbf067 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-kexec-arm64-Add-support-for-handling-zlib-compressed.patch @@ -0,0 +1,385 @@ +From f4c1caaa97a2e019ccc00ab63e390c60d1c9454c Mon Sep 17 00:00:00 2001 +From: Bhupesh Sharma +Date: Mon, 15 Jul 2019 11:32:56 +0530 +Subject: [PATCH 4/5] kexec/arm64: Add support for handling zlib compressed + (Image.gz) image + +Currently the kexec_file_load() support for arm64 doesn't allow +handling zlib compressed (i.e. Image.gz) image. + +Since most distributions use 'make zinstall' rule inside +'arch/arm64/boot/Makefile' to install the arm64 +Image.gz compressed file inside the boot destination directory (for e.g. +/boot), currently we cannot use kexec_file_load() to load vmlinuz (or +Image.gz): + + # file /boot/vmlinuz + /boot/vmlinuz: gzip compressed data, was "Image", <..snip..>, max + compression, from Unix, original size 21945120 + + Now, since via kexec_file_load() we pass the 'fd' of Image.gz + (compressed file) via the following command line ... + + # kexec -s -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname + -r`.img --reuse-cmdline + +... kernel returns -EINVAL error value, as it is not able to locate +the magic number =0x644d5241, which is expected in the 64-byte header +of the decompressed kernel image. + +We can fix this in user-space kexec-tools, which handles an +'Image.gz' being passed via kexec_file_load(), using an approach +as follows: + +a). Copy the contents of Image.gz to a temporary file. +b). Decompress (gunzip-decompress) the contents inside the + temporary file. +c). Pass the 'fd' of the temporary file to the kernel space. So + basically the kernel space still gets a decompressed kernel + image to load via kexec-tools + +I tested this patch for the following three use-cases: + +1. Uncompressed Image file: + #kexec -s -l Image --initrd=/boot/initramfs-`uname -r`.img --reuse-cmdline + +2. Signed Image file: + #kexec -s -l Image.signed --initrd=/boot/initramfs-`uname -r`.img --reuse-cmdline + +3. zlib compressed Image.gz file: + #kexec -s -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname -r`.img --reuse-cmdline + +Signed-off-by: Bhupesh Sharma +Signed-off-by: Simon Horman +--- + kexec/arch/arm64/Makefile | 3 +- + kexec/arch/arm64/kexec-arm64.c | 1 + + kexec/arch/arm64/kexec-arm64.h | 7 ++ + kexec/arch/arm64/kexec-image-arm64.c | 4 +- + kexec/arch/arm64/kexec-zImage-arm64.c | 226 ++++++++++++++++++++++++++++++++++ + kexec/kexec.c | 12 ++ + 6 files changed, 250 insertions(+), 3 deletions(-) + create mode 100644 kexec/arch/arm64/kexec-zImage-arm64.c + +diff --git a/kexec/arch/arm64/Makefile b/kexec/arch/arm64/Makefile +index 9d9111caa8ed..d27c8ee1b5e7 100644 +--- a/kexec/arch/arm64/Makefile ++++ b/kexec/arch/arm64/Makefile +@@ -15,7 +15,8 @@ arm64_KEXEC_SRCS += \ + kexec/arch/arm64/kexec-arm64.c \ + kexec/arch/arm64/kexec-elf-arm64.c \ + kexec/arch/arm64/kexec-uImage-arm64.c \ +- kexec/arch/arm64/kexec-image-arm64.c ++ kexec/arch/arm64/kexec-image-arm64.c \ ++ kexec/arch/arm64/kexec-zImage-arm64.c + + arm64_UIMAGE = kexec/kexec-uImage.c + +diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c +index 2992bce8139f..eb3a3a37307c 100644 +--- a/kexec/arch/arm64/kexec-arm64.c ++++ b/kexec/arch/arm64/kexec-arm64.c +@@ -71,6 +71,7 @@ struct file_type file_type[] = { + {"vmlinux", elf_arm64_probe, elf_arm64_load, elf_arm64_usage}, + {"Image", image_arm64_probe, image_arm64_load, image_arm64_usage}, + {"uImage", uImage_arm64_probe, uImage_arm64_load, uImage_arm64_usage}, ++ {"zImage", zImage_arm64_probe, zImage_arm64_load, zImage_arm64_usage}, + }; + + int file_types = sizeof(file_type) / sizeof(file_type[0]); +diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h +index cc3419f4c10f..628de79b7f70 100644 +--- a/kexec/arch/arm64/kexec-arm64.h ++++ b/kexec/arch/arm64/kexec-arm64.h +@@ -38,11 +38,18 @@ int image_arm64_probe(const char *kernel_buf, off_t kernel_size); + int image_arm64_load(int argc, char **argv, const char *kernel_buf, + off_t kernel_size, struct kexec_info *info); + void image_arm64_usage(void); ++ + int uImage_arm64_probe(const char *buf, off_t len); + int uImage_arm64_load(int argc, char **argv, const char *buf, off_t len, + struct kexec_info *info); + void uImage_arm64_usage(void); + ++int zImage_arm64_probe(const char *kernel_buf, off_t kernel_size); ++int zImage_arm64_load(int argc, char **argv, const char *kernel_buf, ++ off_t kernel_size, struct kexec_info *info); ++void zImage_arm64_usage(void); ++ ++ + off_t initrd_base; + off_t initrd_size; + +diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c +index 685a99352e39..aa8f2e22d72b 100644 +--- a/kexec/arch/arm64/kexec-image-arm64.c ++++ b/kexec/arch/arm64/kexec-image-arm64.c +@@ -114,6 +114,6 @@ exit: + void image_arm64_usage(void) + { + printf( +-" An ARM64 binary image, compressed or not, big or little endian.\n" +-" Typically an Image, Image.gz or Image.lzma file.\n\n"); ++" An ARM64 binary image, uncompressed, big or little endian.\n" ++" Typically an Image file.\n\n"); + } +diff --git a/kexec/arch/arm64/kexec-zImage-arm64.c b/kexec/arch/arm64/kexec-zImage-arm64.c +new file mode 100644 +index 000000000000..6ee82ff6c79e +--- /dev/null ++++ b/kexec/arch/arm64/kexec-zImage-arm64.c +@@ -0,0 +1,226 @@ ++/* ++ * ARM64 kexec zImage (Image.gz) support. ++ * ++ * Several distros use 'make zinstall' rule inside ++ * 'arch/arm64/boot/Makefile' to install the arm64 ++ * Image.gz compressed file inside the boot destination ++ * directory (for e.g. /boot). ++ * ++ * Currently we cannot use kexec_file_load() to load vmlinuz ++ * (or Image.gz). ++ * ++ * To support Image.gz, we should: ++ * a). Copy the contents of Image.gz to a temporary file. ++ * b). Decompress (gunzip-decompress) the contents inside the ++ * temporary file. ++ * c). Pass the 'fd' of the temporary file to the kernel space. ++ * ++ * So basically the kernel space still gets a decompressed ++ * kernel image to load via kexec-tools. ++ */ ++ ++#define _GNU_SOURCE ++ ++#include ++#include ++#include ++#include ++#include "crashdump-arm64.h" ++#include "image-header.h" ++#include "kexec.h" ++#include "kexec-arm64.h" ++#include "kexec-syscall.h" ++#include "kexec-zlib.h" ++#include "arch/options.h" ++ ++#define FILENAME_IMAGE "/tmp/ImageXXXXXX" ++ ++/* Returns: ++ * -1 : in case of error/invalid format (not a valid Image.gz format. ++ * fd : File descriptor of the temp file containing the decompressed ++ * Image. ++ */ ++int zImage_arm64_probe(const char *kernel_buf, off_t kernel_size) ++{ ++ int ret = -1; ++ int fd = 0; ++ int kernel_fd = 0; ++ char *fname = NULL; ++ char *kernel_uncompressed_buf = NULL; ++ const struct arm64_image_header *h; ++ ++ if (!is_zlib_file(kernel_buf, &kernel_size)) { ++ dbgprintf("%s: Not an zImage file (Image.gz).\n", __func__); ++ return -1; ++ } ++ ++ if (!(fname = strdup(FILENAME_IMAGE))) { ++ dbgprintf("%s: Can't duplicate strings %s\n", __func__, ++ fname); ++ return -1; ++ } ++ ++ if ((fd = mkstemp(fname)) < 0) { ++ dbgprintf("%s: Can't open file %s\n", __func__, ++ fname); ++ ret = -1; ++ goto fail_mkstemp; ++ } ++ ++ kernel_uncompressed_buf = ++ (char *) calloc(kernel_size, sizeof(off_t)); ++ if (!kernel_uncompressed_buf) { ++ dbgprintf("%s: Can't calloc %ld bytes\n", ++ __func__, kernel_size); ++ ret= -ENOMEM; ++ goto fail_calloc; ++ } ++ ++ /* slurp in the input kernel */ ++ dbgprintf("%s: ", __func__); ++ kernel_uncompressed_buf = slurp_decompress_file(kernel_buf, ++ &kernel_size); ++ ++ /* check for correct header magic */ ++ if (kernel_size < sizeof(struct arm64_image_header)) { ++ dbgprintf("%s: No arm64 image header.\n", __func__); ++ ret = -1; ++ goto fail_bad_header; ++ } ++ ++ h = (const struct arm64_image_header *)(kernel_uncompressed_buf); ++ ++ if (!arm64_header_check_magic(h)) { ++ dbgprintf("%s: Bad arm64 image header.\n", __func__); ++ ret = -1; ++ goto fail_bad_header; ++ } ++ ++ if (write(fd, kernel_uncompressed_buf, ++ kernel_size) != kernel_size) { ++ dbgprintf("%s: Can't write the uncompressed file %s\n", ++ __func__, fname); ++ ret = -1; ++ goto fail_bad_header; ++ } ++ ++ close(fd); ++ ++ /* Open the tmp file again, this time in O_RDONLY mode, as ++ * opening the file in O_RDWR and calling kexec_file_load() ++ * causes the kernel to return -ETXTBSY ++ */ ++ kernel_fd = open(fname, O_RDONLY); ++ if (kernel_fd == -1) { ++ dbgprintf("%s: Failed to open file %s\n", ++ __func__, fname); ++ ret = -1; ++ goto fail_bad_header; ++ } ++ ++ unlink(fname); ++ ++ free(kernel_uncompressed_buf); ++ free(fname); ++ ++ return kernel_fd; ++ ++fail_bad_header: ++ free(kernel_uncompressed_buf); ++ ++fail_calloc: ++ if (fd >= 0) ++ close(fd); ++ ++ unlink(fname); ++ ++fail_mkstemp: ++ free(fname); ++ ++ return ret; ++} ++ ++int zImage_arm64_load(int argc, char **argv, const char *kernel_buf, ++ off_t kernel_size, struct kexec_info *info) ++{ ++ const struct arm64_image_header *header; ++ unsigned long kernel_segment; ++ int result; ++ ++ if (info->file_mode) { ++ if (arm64_opts.initrd) { ++ info->initrd_fd = open(arm64_opts.initrd, O_RDONLY); ++ if (info->initrd_fd == -1) { ++ fprintf(stderr, ++ "Could not open initrd file %s:%s\n", ++ arm64_opts.initrd, strerror(errno)); ++ result = EFAILED; ++ goto exit; ++ } ++ } ++ ++ if (arm64_opts.command_line) { ++ info->command_line = (char *)arm64_opts.command_line; ++ info->command_line_len = ++ strlen(arm64_opts.command_line) + 1; ++ } ++ ++ return 0; ++ } ++ ++ header = (const struct arm64_image_header *)(kernel_buf); ++ ++ if (arm64_process_image_header(header)) ++ return EFAILED; ++ ++ kernel_segment = arm64_locate_kernel_segment(info); ++ ++ if (kernel_segment == ULONG_MAX) { ++ dbgprintf("%s: Kernel segment is not allocated\n", __func__); ++ result = EFAILED; ++ goto exit; ++ } ++ ++ dbgprintf("%s: kernel_segment: %016lx\n", __func__, kernel_segment); ++ dbgprintf("%s: text_offset: %016lx\n", __func__, ++ arm64_mem.text_offset); ++ dbgprintf("%s: image_size: %016lx\n", __func__, ++ arm64_mem.image_size); ++ dbgprintf("%s: phys_offset: %016lx\n", __func__, ++ arm64_mem.phys_offset); ++ dbgprintf("%s: vp_offset: %016lx\n", __func__, ++ arm64_mem.vp_offset); ++ dbgprintf("%s: PE format: %s\n", __func__, ++ (arm64_header_check_pe_sig(header) ? "yes" : "no")); ++ ++ /* create and initialize elf core header segment */ ++ if (info->kexec_flags & KEXEC_ON_CRASH) { ++ result = load_crashdump_segments(info); ++ if (result) { ++ dbgprintf("%s: Creating eflcorehdr failed.\n", ++ __func__); ++ goto exit; ++ } ++ } ++ ++ /* load the kernel */ ++ add_segment_phys_virt(info, kernel_buf, kernel_size, ++ kernel_segment + arm64_mem.text_offset, ++ arm64_mem.image_size, 0); ++ ++ /* load additional data */ ++ result = arm64_load_other_segments(info, kernel_segment ++ + arm64_mem.text_offset); ++ ++exit: ++ if (result) ++ fprintf(stderr, "kexec: load failed.\n"); ++ return result; ++} ++ ++void zImage_arm64_usage(void) ++{ ++ printf( ++" An ARM64 zImage, compressed, big or little endian.\n" ++" Typically an Image.gz or Image.lzma file.\n\n"); ++} +diff --git a/kexec/kexec.c b/kexec/kexec.c +index 8ca3b457cac8..bc6ab3dbd10b 100644 +--- a/kexec/kexec.c ++++ b/kexec/kexec.c +@@ -1206,8 +1206,20 @@ static int do_kexec_file_load(int fileind, int argc, char **argv, + kernel_buf = slurp_decompress_file(kernel, &kernel_size); + + for (i = 0; i < file_types; i++) { ++#ifdef __aarch64__ ++ /* handle Image.gz like cases */ ++ if (is_zlib_file(kernel, &kernel_size)) { ++ if ((ret = file_type[i].probe(kernel, kernel_size)) >= 0) { ++ kernel_fd = ret; ++ break; ++ } ++ } else ++ if (file_type[i].probe(kernel_buf, kernel_size) >= 0) ++ break; ++#else + if (file_type[i].probe(kernel_buf, kernel_size) >= 0) + break; ++#endif + } + + if (i == file_types) { +-- +2.7.4 + diff --git a/SOURCES/kexec-tools-2.0.19-kexec-kexec-zlib.h-Add-is_zlib_file-helper-function.patch b/SOURCES/kexec-tools-2.0.19-kexec-kexec-zlib.h-Add-is_zlib_file-helper-function.patch new file mode 100644 index 0000000..786f90c --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-kexec-kexec-zlib.h-Add-is_zlib_file-helper-function.patch @@ -0,0 +1,89 @@ +From 0e709571bfe7e3b8160044970e2084194f9a963b Mon Sep 17 00:00:00 2001 +From: Bhupesh Sharma +Date: Mon, 15 Jul 2019 11:32:55 +0530 +Subject: [PATCH 3/5] kexec/kexec-zlib.h: Add 'is_zlib_file()' helper function + +This patch adds 'is_zlib_file()' helper function which can be +used to quickly determine with the passed kernel image is a zlib +compressed kernel image. + +This is specifically useful for arm64 zImage (or Image.gz) support, +which is introduced by later patches in this patchset. + +Signed-off-by: Bhupesh Sharma +Signed-off-by: Simon Horman +--- + kexec/kexec-zlib.h | 1 + + kexec/zlib.c | 38 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 39 insertions(+) + +diff --git a/kexec/kexec-zlib.h b/kexec/kexec-zlib.h +index 43c107bf4a72..16300f294759 100644 +--- a/kexec/kexec-zlib.h ++++ b/kexec/kexec-zlib.h +@@ -6,5 +6,6 @@ + + #include "config.h" + ++int is_zlib_file(const char *filename, off_t *r_size); + char *zlib_decompress_file(const char *filename, off_t *r_size); + #endif /* __KEXEC_ZLIB_H */ +diff --git a/kexec/zlib.c b/kexec/zlib.c +index 95b608059d41..9bc340d85001 100644 +--- a/kexec/zlib.c ++++ b/kexec/zlib.c +@@ -23,6 +23,38 @@ static void _gzerror(gzFile fp, int *errnum, const char **errmsg) + } + } + ++int is_zlib_file(const char *filename, off_t *r_size) ++{ ++ gzFile fp; ++ int errnum; ++ int is_zlib_file = 0; /* default: It's not in gzip format */ ++ const char *msg; ++ ssize_t result; ++ ++ if (!filename) ++ goto out; ++ ++ fp = gzopen(filename, "rb"); ++ if (fp == 0) { ++ _gzerror(fp, &errnum, &msg); ++ dbgprintf("Cannot open `%s': %s\n", filename, msg); ++ goto out; ++ } ++ ++ if (!gzdirect(fp)) ++ /* It's in gzip format */ ++ is_zlib_file = 1; ++ ++ result = gzclose(fp); ++ if (result != Z_OK) { ++ _gzerror(fp, &errnum, &msg); ++ dbgprintf(" Close of %s failed: %s\n", filename, msg); ++ } ++ ++out: ++ return is_zlib_file; ++} ++ + char *zlib_decompress_file(const char *filename, off_t *r_size) + { + gzFile fp; +@@ -84,6 +116,12 @@ fail: + return buf; + } + #else ++ ++int is_zlib_file(const char *filename, off_t *r_size) ++{ ++ return 0; ++} ++ + char *zlib_decompress_file(const char *UNUSED(filename), off_t *UNUSED(r_size)) + { + return NULL; +-- +2.7.4 + diff --git a/SOURCES/kexec-tools-2.0.19-kexec-kexec.c-Add-the-missing-close-for-fd-used-for-.patch b/SOURCES/kexec-tools-2.0.19-kexec-kexec.c-Add-the-missing-close-for-fd-used-for-.patch new file mode 100644 index 0000000..4bc6ca7 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-kexec-kexec.c-Add-the-missing-close-for-fd-used-for-.patch @@ -0,0 +1,34 @@ +From 019d8258f15c2a716786880c3cbd0f327a4dfc09 Mon Sep 17 00:00:00 2001 +From: Bhupesh Sharma +Date: Mon, 15 Jul 2019 11:32:53 +0530 +Subject: [PATCH 1/5] kexec/kexec.c: Add the missing close() for fd used for + kexec_file_load() + +In kexec/kexec.c, we open() the kernel Image file and pass this file +descriptor to the kexec_file_load() system call, but never call a +corresponding close(). + +Fix the same via this patch. + +Signed-off-by: Bhupesh Sharma +Signed-off-by: Simon Horman +--- + kexec/kexec.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/kexec/kexec.c b/kexec/kexec.c +index 32ae56c8f1c3..8ca3b457cac8 100644 +--- a/kexec/kexec.c ++++ b/kexec/kexec.c +@@ -1234,6 +1234,8 @@ static int do_kexec_file_load(int fileind, int argc, char **argv, + if (ret != 0) + fprintf(stderr, "kexec_file_load failed: %s\n", + strerror(errno)); ++ ++ close(kernel_fd); + return ret; + } + +-- +2.7.4 + diff --git a/SOURCES/kexec-tools-2.0.19-kexec-uImage-arm64.c-Fix-return-value-of-uImage_arm6.patch b/SOURCES/kexec-tools-2.0.19-kexec-uImage-arm64.c-Fix-return-value-of-uImage_arm6.patch new file mode 100644 index 0000000..644a117 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-kexec-uImage-arm64.c-Fix-return-value-of-uImage_arm6.patch @@ -0,0 +1,55 @@ +From 6ef59c03bf2c42f6577c708b58598868e8e8fb0b Mon Sep 17 00:00:00 2001 +From: Bhupesh Sharma +Date: Mon, 15 Jul 2019 11:32:54 +0530 +Subject: [PATCH 2/5] kexec-uImage-arm64.c: Fix return value of + uImage_arm64_probe() + +Commit bf06cf2095e1 ("kexec/uImage: probe to identify a corrupted image"), +defined the 'uImage_probe_kernel()' function return values and +correspondingly ;uImage_arm64_probe()' returns the same (0 -> If the +image is valid 'type' image, -1 -> If the image is corrupted and +1 -> If the image is not a uImage). + +This causes issues because, in later patches we introduce zImage +support for arm64, and since it is probed after uImage, the return +values from 'uImage_arm64_probe()' needs to be fixed to make sure +that kexec will not return with an invalid error code. + +Now, 'uImage_arm64_probe()' returns the following values instead: + 0 - valid uImage. + -1 - uImage is corrupted. + 1 - image is not a uImage. + +Signed-off-by: Bhupesh Sharma +Signed-off-by: Simon Horman +--- + kexec/arch/arm64/kexec-uImage-arm64.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/kexec/arch/arm64/kexec-uImage-arm64.c b/kexec/arch/arm64/kexec-uImage-arm64.c +index 126ea9c2555b..c4669131b667 100644 +--- a/kexec/arch/arm64/kexec-uImage-arm64.c ++++ b/kexec/arch/arm64/kexec-uImage-arm64.c +@@ -11,7 +11,18 @@ + + int uImage_arm64_probe(const char *buf, off_t len) + { +- return uImage_probe_kernel(buf, len, IH_ARCH_ARM64); ++ int ret; ++ ++ ret = uImage_probe_kernel(buf, len, IH_ARCH_ARM64); ++ ++ /* 0 - valid uImage. ++ * -1 - uImage is corrupted. ++ * 1 - image is not a uImage. ++ */ ++ if (!ret) ++ return 0; ++ else ++ return -1; + } + + int uImage_arm64_load(int argc, char **argv, const char *buf, off_t len, +-- +2.7.4 + 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 new file mode 100644 index 0000000..662fd27 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch @@ -0,0 +1,198 @@ +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 new file mode 100644 index 0000000..90481a1 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch @@ -0,0 +1,129 @@ +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/mkdumprd b/SOURCES/mkdumprd index d2968e3..e8529d6 100644 --- a/SOURCES/mkdumprd +++ b/SOURCES/mkdumprd @@ -13,7 +13,7 @@ export IN_KDUMP=1 conf_file="/etc/kdump.conf" SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" -SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) +SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file) [ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /) @@ -37,7 +37,7 @@ is_wdt_addition_needed [[ $? -eq 0 ]] && WDTCFG="-a watchdog" extra_modules="" -dracut_args=("--quiet" "--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "--hostonly-mode" "strict" "-o" "plymouth dash resume ifcfg" $WDTCFG) +dracut_args=("--quiet" "--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "--hostonly-mode" "strict" "-o" "plymouth dash resume ifcfg earlykdump" $WDTCFG) OVERRIDE_RESETTABLE=0 add_dracut_arg() { @@ -389,7 +389,6 @@ fi while read config_opt config_val; do # remove inline comments after the end of a directive. - config_val=$(strip_comments $config_val) case "$config_opt" in extra_modules) extra_modules="$extra_modules $config_val" @@ -441,13 +440,9 @@ do add_dracut_arg $config_val ;; *) - if [ -n $(echo $config_opt | grep "^#.*$") ] - then - continue - fi ;; esac -done < $conf_file +done <<< "$(read_strip_comments $conf_file)" handle_default_dump_target 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 new file mode 100644 index 0000000..014de57 --- /dev/null +++ b/SOURCES/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch @@ -0,0 +1,235 @@ +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 + user-space VA support) + +With ARMv8.2-LVA architecture extension availability, arm64 hardware +which supports this extension can support upto 52-bit virtual +addresses. It is specially useful for having a 52-bit user-space virtual +address space while the kernel can still retain 48-bit virtual +addresses. + +Since at the moment we enable the support of this extension in the +kernel via a CONFIG flag (CONFIG_ARM64_USER_VA_BITS_52), so there are +no clear mechanisms in user-space to determine this CONFIG +flag value and use it to determine the user-space VA address range +values. + +'makedumpfile' can instead use 'MAX_USER_VA_BITS' value to +determine the maximum virtual physical address supported by user-space. +If 'MAX_USER_VA_BITS' value is greater than 'VA_BITS' than we are +running a use-case where user-space is 52-bit and underlying kernel is +still 48-bit. The increased 'PTRS_PER_PGD' value for such cases can then +be calculated as is done by the underlying kernel (see kernel file +'arch/arm64/include/asm/pgtable-hwdef.h' for details): + + #define PTRS_PER_PGD (1 << (MAX_USER_VA_BITS - PGDIR_SHIFT)) + +I have sent a kernel patch upstream to add 'MAX_USER_VA_BITS' to +vmcoreinfo for arm64 (see [0]). + +This patch is in accordance with ARMv8 Architecture Reference Manual +version D.a + +[0]. +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 +@@ -41,6 +41,7 @@ typedef struct { + + static int pgtable_level; + static int va_bits; ++static int max_user_va_bits; + static unsigned long kimage_voffset; + + #define SZ_4K (4 * 1024) +@@ -61,7 +62,7 @@ static unsigned long kimage_voffset; + + #define PAGE_MASK (~(PAGESIZE() - 1)) + #define PGDIR_SHIFT ((PAGESHIFT() - 3) * pgtable_level + 3) +-#define PTRS_PER_PGD (1 << (va_bits - PGDIR_SHIFT)) ++#define PTRS_PER_PGD (1 << ((max_user_va_bits) - PGDIR_SHIFT)) + #define PUD_SHIFT get_pud_shift_arm64() + #define PUD_SIZE (1UL << PUD_SHIFT) + #define PUD_MASK (~(PUD_SIZE - 1)) +@@ -73,6 +74,10 @@ static unsigned long kimage_voffset; + #define PTRS_PER_PMD PTRS_PER_PTE + + #define PAGE_PRESENT (1 << 0) ++ ++/* ++ * Section address mask and size definitions. ++ */ + #define SECTIONS_SIZE_BITS 30 + /* Highest possible physical address supported */ + #define PHYS_MASK_SHIFT 48 +@@ -284,14 +289,83 @@ get_stext_symbol(void) + return(found ? kallsym : FALSE); + } + ++static int ++get_va_bits_from_stext_arm64(void) ++{ ++ ulong _stext; ++ ++ _stext = get_stext_symbol(); ++ if (!_stext) { ++ ERRMSG("Can't get the symbol of _stext.\n"); ++ return FALSE; ++ } ++ ++ /* Derive va_bits as per arch/arm64/Kconfig */ ++ if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) { ++ va_bits = 36; ++ } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) { ++ va_bits = 39; ++ } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) { ++ va_bits = 42; ++ } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) { ++ va_bits = 47; ++ } else if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) { ++ va_bits = 48; ++ } else { ++ ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n"); ++ return FALSE; ++ } ++ ++ DEBUG_MSG("va_bits : %d\n", va_bits); ++ ++ return TRUE; ++} ++ ++static void ++get_page_offset_arm64(void) ++{ ++ info->page_offset = (0xffffffffffffffffUL) << (va_bits - 1); ++ ++ DEBUG_MSG("page_offset : %lx\n", info->page_offset); ++} ++ + int + get_machdep_info_arm64(void) + { + /* Check if va_bits is still not initialized. If still 0, call + * get_versiondep_info() to initialize the same. + */ ++ if (NUMBER(VA_BITS) != NOT_FOUND_NUMBER) { ++ va_bits = NUMBER(VA_BITS); ++ DEBUG_MSG("va_bits : %d (vmcoreinfo)\n", ++ va_bits); ++ } ++ ++ /* Check if va_bits is still not initialized. If still 0, call ++ * get_versiondep_info() to initialize the same from _stext ++ * symbol. ++ */ + if (!va_bits) +- get_versiondep_info_arm64(); ++ if (get_va_bits_from_stext_arm64() == ERROR) ++ return ERROR; ++ ++ get_page_offset_arm64(); ++ ++ if (NUMBER(MAX_USER_VA_BITS) != NOT_FOUND_NUMBER) { ++ max_user_va_bits = NUMBER(MAX_USER_VA_BITS); ++ DEBUG_MSG("max_user_va_bits : %d (vmcoreinfo)\n", ++ max_user_va_bits); ++ } ++ ++ /* Check if max_user_va_bits is still not initialized. ++ * If still 0, its not available in vmcoreinfo and its ++ * safe to initialize it with va_bits. ++ */ ++ if (!max_user_va_bits) { ++ max_user_va_bits = va_bits; ++ DEBUG_MSG("max_user_va_bits : %d (default = va_bits)\n", ++ max_user_va_bits); ++ } + + if (!calculate_plat_config()) { + ERRMSG("Can't determine platform config values\n"); +@@ -330,34 +404,11 @@ get_xen_info_arm64(void) + int + get_versiondep_info_arm64(void) + { +- ulong _stext; +- +- _stext = get_stext_symbol(); +- if (!_stext) { +- ERRMSG("Can't get the symbol of _stext.\n"); +- return FALSE; +- } +- +- /* Derive va_bits as per arch/arm64/Kconfig */ +- if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) { +- va_bits = 36; +- } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) { +- va_bits = 39; +- } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) { +- va_bits = 42; +- } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) { +- va_bits = 47; +- } else if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) { +- va_bits = 48; +- } else { +- ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n"); +- return FALSE; +- } +- +- info->page_offset = (0xffffffffffffffffUL) << (va_bits - 1); ++ if (!va_bits) ++ if (get_va_bits_from_stext_arm64() == ERROR) ++ return ERROR; + +- DEBUG_MSG("va_bits : %d\n", va_bits); +- DEBUG_MSG("page_offset : %lx\n", info->page_offset); ++ get_page_offset_arm64(); + + 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) + + WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR); + #ifdef __aarch64__ ++ WRITE_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS); + 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); + READ_NUMBER("phys_base", phys_base); + #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; + long phys_base; + #ifdef __aarch64__ ++ long MAX_USER_VA_BITS; + long VA_BITS; + unsigned long PHYS_OFFSET; + unsigned long kimage_voffset; +-- +2.7.4 + diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec index 8a6bafb..40c67e2 100644 --- a/SPECS/kexec-tools.spec +++ b/SPECS/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools -Version: 2.0.17 -Release: 28%{?dist} +Version: 2.0.19 +Release: 12%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -13,10 +13,11 @@ Source4: kdump.sysconfig.i386 Source5: kdump.sysconfig.ppc64 Source7: mkdumprd Source8: kdump.conf -Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.4/makedumpfile-1.6.4.tar.gz +Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/makedumpfile-1.6.5.tar.gz Source10: kexec-kdump-howto.txt Source12: mkdumprd.8 -Source14: 98-kexec.rules +Source13: 98-kexec.rules +Source14: 98-kexec.rules.ppc64 Source15: kdump.conf.5 Source16: kdump.service Source18: kdump.sysconfig.s390x @@ -52,7 +53,7 @@ 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 @@ -60,53 +61,44 @@ BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzi BuildRequires: pkgconfig intltool gettext BuildRequires: systemd-units BuildRequires: automake autoconf libtool -%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le %{arm} +%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le Obsoletes: diskdumputils netdump kexec-tools-eppic %endif -%undefine _hardened_build - #START INSERT # # Patches 0 through 100 are meant for x86 kexec-tools enablement # -Patch0: kexec-tools-2.0.17-makedumpfile-Fix-failure-of-detection-of-SPARSEMEM-EXTREME-.patch + # # Patches 101 through 200 are meant for x86_64 kexec-tools enablement # -Patch101: kexec-tools-2.0.17-makedumpfile-sadump-fix-failure-of-reading-640-KB-ba.patch +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 # -Patch301: kexec-tools-2.0.17-makedumpfile-ppc64-increase-MAX_PHYSMEM_BITS-to-128TB.patch # # Patches 401 through 500 are meant for s390 kexec-tools enablement # -Patch401: kexec-tools-2.0.17-kexec-s390-Add-support-for-kexec_file_load.patch # # Patches 501 through 600 are meant for ARM kexec-tools enablement # -Patch501: kexec-tools-2.0.17-makedumpfile-arm64-Add-__START_KERNEL_map-macro.patch -Patch502: kexec-tools-2.0.17-makedumpfile-arm64-Add-runtime-kaslr-offset-if-it-exists.patch -Patch503: kexec-tools-2.0.17-kexec-arm64-Add-support-to-supply-kaslr-seed-to-secondary-.patch +Patch501: kexec-tools-2.0.19-kexec-kexec.c-Add-the-missing-close-for-fd-used-for-.patch +Patch502: kexec-tools-2.0.19-kexec-uImage-arm64.c-Fix-return-value-of-uImage_arm6.patch +Patch503: kexec-tools-2.0.19-kexec-kexec-zlib.h-Add-is_zlib_file-helper-function.patch +Patch504: kexec-tools-2.0.19-kexec-arm64-Add-support-for-handling-zlib-compressed.patch # # Patches 601 onward are generic patches # Patch601: kexec-tools-2.0.16-koji-build-fail-workaround.patch -Patch602: kexec-tools-2.0.17-makedumpfile-Use-monotonic-clock-to-calculate-ETA-and-s.patch -Patch603: kexec-tools-2.0.17-makedumpfile-Check-if-clock_gettime-requires-lrt.patch -Patch604: kexec-tools-2.0.17-makedumpfile-when-refiltering-initialize-refiltered-bitm.patch -Patch605: kexec-tools-2.0.17-makedumpfile-Update-help-text-to-indicate-mem-usage-is-supp.patch -Patch606: kexec-tools-2.0.17-kexec-arm64-If-getrandom-syscall-fails-don-t-error-out-jus.patch -Patch607: kexec-tools-2.0.17-vmcore-dmesg-fix-infinite-loop-if-log-buffer-wraps-a.patch -Patch608: kexec-tools-2.0.17-makedumpfile-Support-newer-kernels.patch -Patch609: kexec-tools-2.0.17-makedumpfile-Prepare-paddr_to_vaddr-for-arch-specific-p2v-c.patch -Patch610: kexec-tools-2.0.17-makedumpfile-arm64-restore-info-page_offset-and-implement-paddr_t.patch -Patch611: kexec-tools-2.0.17-makedumpfile-x86_64-fix-an-unnecessary-message-with-mem-usa.patch -Patch612: kexec-tools-2.0.17-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.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 %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -122,25 +114,17 @@ mkdir -p -m755 kcp tar -z -x -v -f %{SOURCE9} tar -z -x -v -f %{SOURCE19} -%patch0 -p1 %patch101 -p1 -%patch301 -p1 -%patch401 -p1 %patch501 -p1 %patch502 -p1 %patch503 -p1 +%patch504 -p1 %patch601 -p1 -%patch602 -p1 %patch603 -p1 %patch604 -p1 %patch605 -p1 %patch606 -p1 -%patch607 -p1 -%patch608 -p1 -%patch609 -p1 -%patch610 -p1 -%patch611 -p1 -%patch612 -p1 +%patch102 -p1 %ifarch ppc %define archdef ARCH=ppc @@ -167,10 +151,10 @@ cp %{SOURCE27} . cp %{SOURCE28} . make -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{arm} +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 make -C eppic/libeppic -make -C makedumpfile-1.6.4 LINKTYPE=dynamic USELZO=on USESNAPPY=on -make -C makedumpfile-1.6.4 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so +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 %endif %install @@ -205,24 +189,29 @@ install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8 install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh -%ifnarch s390x +%ifnarch s390x ppc64 ppc64le # For s390x the ELF header is created in the kdump kernel and therefore kexec # udev rules are not required +install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules +%endif +%ifarch ppc64 ppc64le install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules +%endif +%ifnarch s390x install -m 755 %{SOURCE29} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler %endif install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5 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 %{arm} -install -m 755 makedumpfile-1.6.4/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile -install -m 644 makedumpfile-1.6.4/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz -install -m 644 makedumpfile-1.6.4/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz -install -m 644 makedumpfile-1.6.4/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample -install -m 755 makedumpfile-1.6.4/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so +%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 mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ -install -m 644 makedumpfile-1.6.4/eppic_scripts/* $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/ %endif %define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g') @@ -328,7 +317,7 @@ done %{_bindir}/* %{_datadir}/kdump %{_prefix}/lib/kdump -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{arm} +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{_sysconfdir}/makedumpfile.conf.sample %endif %config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump @@ -355,14 +344,86 @@ done %doc supported-kdump-targets.txt %doc kdump-in-cluster-environment.txt %doc live-image-kdump-howto.txt -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{arm} +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{_libdir}/eppic_makedumpfile.so /usr/share/makedumpfile/ %endif %changelog -* Mon May 20 2019 Pablo Greco - 2.0.17-28 -- Fix FTBFS on armhfp +* 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 + +* Wed Jun 12 2019 Pingfan Liu - 2.0.19-6 +- kexec-kdump-howto.txt: Add notes about device dump +- Disable device dump by default + +* Mon Jun 10 2019 Pingfan Liu - 2.0.19-5 +- kdumpctl: check for ssh path availability when rebuild +- kdumpctl: Check kdump.conf for error when rebuild is called +- makedumpfile: x86_64: Add support for AMD Secure Memory Encryption +- aarch64/kdump.sysconfig: Make config options similar to x86_64 + +* Mon May 27 2019 Pingfan Liu - 2.0.19-4 +- kexec-kdump-howto.txt: Add document about encrypted targets +- kexec-kdump-howto.txt: Add document about initramfs rebiuld +- kexec-kdump-howto: Add note on setting correct value of kptr_restrict +- doc: fix dead links in the file kexec-kdump-howto.txt +- earlykdump: provide a prompt message after the rebuilding of kdump initramfs. +- Get rid of duplicated strip_comments when reading config +- mkdumprd: Improve the config reading logic +- kdumpctl: don't always rebuild when extra_modules is set +- kdumpctl: follow symlink when checking for modified files +- fadump: leverage kernel support to re-regisgter FADump + +* Wed May 15 2019 Pingfan Liu - 2.0.19-3 +- earlykdump: Add a note of final_action option to avoid crash loop +- Add final_action option to kdump.conf +- Add failure_action as alias of default and make default obsolete +- earlykdump: warn when installed kernel version differs from dracut target +- earlykdump: add more sanity check when generating initramfs +- fadump: use the original initrd to rebuild fadump initrdfrom + +* Fri May 10 2019 Pingfan Liu - 2.0.19-2 +- kdumpctl: Detect block device driver change for initramfs rebuild +- Revert "kdumpctl: Rebuild initramfs if loaded kernel modules changed" +- mkdumprd: allow spaces after 'path' config phrase with network dump setting +- kexec.rules: create dedicated udev rules for ppc64 +- Revert "rhel-only/kexec.rules: create dedicated udev rules for ppc64" +- rh-only makedumpfile/arm64: Add support for ARMv8.2-LVA (52-bit user-space VA support) + +* Mon Apr 22 2019 Pingfan Liu - 2.0.19-1 +- kexec-tools: rebasing to 2.0.19 +- makedumpfile: upgrade to 1.6.5 +- kexec-tools: x86: Introduce a new option --reuse-video-type +- makedumpfile: exclude pages that are logically offline +- earlykdump: Fix failure when earlykdump is included by dracut +- Update man page for new kdumpctl command: reload / rebuild +- kdumpctl: add rebuild support +- rhel-only/kexec.rules: create dedicated udev rules for ppc64 + +* Mon Apr 15 2019 Pingfan Liu - 2.0.17-30 +- Enable building with hardening flags + +* Fri Mar 15 2019 Pingfan Liu - 2.0.17-29 +- add gating * Fri Feb 22 2019 Pingfan Liu - 2.0.17-28