From 97e51323aa93a9e29eba374b28ee4cebbb77cd23 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 29 2022 19:06:47 +0000 Subject: import kexec-tools-2.0.20-68.el8 --- diff --git a/.gitignore b/.gitignore index b231ca3..0e4d7eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/1.6.8.tar.gz +SOURCES/1.7.0.tar.gz SOURCES/eppic_050615.tar.gz SOURCES/kexec-tools-2.0.20.tar.xz diff --git a/.kexec-tools.metadata b/.kexec-tools.metadata index 553f89d..fd2e018 100644 --- a/.kexec-tools.metadata +++ b/.kexec-tools.metadata @@ -1,3 +1,3 @@ -7af5b92c69df9f63b9f02ad07a76a2a2581d4660 SOURCES/1.6.8.tar.gz +a931a40b80df204be1b02bfb502921cc618810fd SOURCES/1.7.0.tar.gz a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz 5d9acd2e741d356d4a48fe4f2d63f66ba431051d SOURCES/kexec-tools-2.0.20.tar.xz diff --git a/SOURCES/dracut-fadump-init-fadump.sh b/SOURCES/dracut-fadump-init-fadump.sh new file mode 100755 index 0000000..94a3751 --- /dev/null +++ b/SOURCES/dracut-fadump-init-fadump.sh @@ -0,0 +1,48 @@ +#!/bin/sh +export PATH=/usr/bin:/usr/sbin +export SYSTEMD_IN_INITRD=lenient + +[ -e /proc/mounts ] || + (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc) + +grep -q '^sysfs /sys sysfs' /proc/mounts || + (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys) + +grep -q '^none / ' /proc/mounts || grep -q '^rootfs / ' /proc/mounts && ROOTFS_IS_RAMFS=1 + +if [ -f /proc/device-tree/rtas/ibm,kernel-dump ] || [ -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then + mkdir /newroot + mount -t ramfs ramfs /newroot + + if [ $ROOTFS_IS_RAMFS ]; then + for FILE in $(ls -A /fadumproot/); do + mv /fadumproot/$FILE /newroot/ + done + exec switch_root /newroot /init + else + mkdir /newroot/sys /newroot/proc /newroot/dev /newroot/run /newroot/oldroot + + grep -q '^devtmpfs /dev devtmpfs' /proc/mounts && mount --move /dev /newroot/dev + grep -q '^tmpfs /run tmpfs' /proc/mounts && mount --move /run /newroot/run + mount --move /sys /newroot/sys + mount --move /proc /newroot/proc + + cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr /fadumproot/. /newroot/ + cd /newroot && pivot_root . oldroot + + loop=1 + while [ $loop ]; do + unset loop + while read -r _ mp _; do + case $mp in + /oldroot/*) umount -d "$mp" && loop=1 ;; + esac + done /dev/null || return 1 - else - modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1 - fi - done - } - - if is_squash_available && ! is_fadump_capable; then + if is_squash_available; then add_opt_module squash else dwarning "Required modules to build a squashed kdump image is missing!" @@ -1015,7 +1005,5 @@ install() { ${initdir}/etc/lvm/lvm.conf &>/dev/null # Save more memory by dropping switch root capability - if ! is_fadump_capable; then - dracut_no_switch_root - fi + dracut_no_switch_root } diff --git a/SOURCES/kdump-lib.sh b/SOURCES/kdump-lib.sh index 67ee10e..bfff546 100755 --- a/SOURCES/kdump-lib.sh +++ b/SOURCES/kdump-lib.sh @@ -19,6 +19,16 @@ is_fadump_capable() return 1 } +is_squash_available() { + for kmodule in squashfs overlay loop; do + if [ -z "$KDUMP_KERNELVER" ]; then + modprobe --dry-run $kmodule &>/dev/null || return 1 + else + modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1 + fi + done +} + perror_exit() { derror "$@" exit 1 diff --git a/SOURCES/kdump.conf.5 b/SOURCES/kdump.conf.5 index ce23dea..ae076df 100644 --- a/SOURCES/kdump.conf.5 +++ b/SOURCES/kdump.conf.5 @@ -118,8 +118,11 @@ All files under /etc/kdump/post.d are collectively sorted and executed in lexical order, before binary or script specified kdump_post parameter is executed. .PP -Note that scripts written for use with this directive must use -the /bin/bash interpreter. +Note that scripts written for use with this directive must use the /bin/bash +interpreter. And since these scripts run in kdump enviroment, the reference to +the storage or network device in the scripts should adhere to the section +\'Supported dump target types and requirements\' in kexec-kdump-howto.txt. + .RE .B kdump_pre @@ -139,8 +142,11 @@ kdump_pre parameter is executed. Even if the binary or script in /etc/kdump/pre.d directory returns non 0 exit status, the processing is continued. .PP -Note that scripts written for this directive must use -the /bin/bash interpreter. +Note that scripts written for use with this directive must use the /bin/bash +interpreter. And since these scripts run in kdump enviroment, the reference to +the storage or network device in the scripts should adhere to the section +\'Supported dump target types and requirements\' in kexec-kdump-howto.txt. + .RE .B extra_bins diff --git a/SOURCES/kdumpctl b/SOURCES/kdumpctl index e8a7a3a..46fa67d 100755 --- a/SOURCES/kdumpctl +++ b/SOURCES/kdumpctl @@ -8,6 +8,7 @@ KEXEC_ARGS="" KDUMP_CONFIG_FILE="/etc/kdump.conf" KDUMP_LOG_PATH="/var/log" MKDUMPRD="/sbin/mkdumprd -f" +MKFADUMPRD="/sbin/mkfadumprd" DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt" SAVE_PATH=/var/crash SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" @@ -104,25 +105,10 @@ save_core() rebuild_fadump_initrd() { - local target_initrd_tmp - - # this file tells the initrd is fadump enabled - touch /tmp/fadump.initramfs - target_initrd_tmp="$TARGET_INITRD.tmp" - ddebug "rebuild fadump initrd: $target_initrd_tmp $DEFAULT_INITRD_BAK $KDUMP_KERNELVER" - $MKDUMPRD $target_initrd_tmp --rebuild $DEFAULT_INITRD_BAK --kver $KDUMP_KERNELVER \ - -i /tmp/fadump.initramfs /etc/fadump.initramfs - if [ $? != 0 ]; then - derror "mkdumprd: failed to rebuild initrd with fadump support" - rm -f /tmp/fadump.initramfs + if ! $MKFADUMPRD "$DEFAULT_INITRD_BAK" "$TARGET_INITRD" --kver "$KDUMP_KERNELVER"; then + derror "mkfadumprd: failed to make fadump initrd" return 1 fi - rm -f /tmp/fadump.initramfs - - # updating fadump initrd - ddebug "updating fadump initrd: $target_initrd_tmp $TARGET_INITRD" - mv $target_initrd_tmp $TARGET_INITRD - sync return 0 } @@ -464,7 +450,11 @@ check_drivers_modified() is_dracut_mod_omitted watchdog || is_dracut_mod_omitted watchdog-modules || _new_drivers+=" $(get_watchdog_drvs)" [ -z "$_new_drivers" ] && return 0 - _old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')" + if is_fadump_capable; then + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/fadump-kernel-modules.txt | tr '\n' ' ')" + else + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')" + fi ddebug "Modules required for kdump: '$_new_drivers'" ddebug "Modules included in old initramfs: '$_old_drivers'" @@ -617,7 +607,7 @@ check_rebuild() #in case of fadump mode, check whether the default/target #initrd is already built with dump capture capability if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then - capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep ^kdumpbase$ | wc -l) + capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep -e ^kdumpbase$ -e ^zz-fadumpinit$ | wc -l) fi fi @@ -960,12 +950,12 @@ selinux_relabel() return fi - for _i in $(find $_path); do - _attr=$(getfattr -m "security.selinux" $_i 2>/dev/null) + while IFS= read -r -d '' _i; do + _attr=$(getfattr -m "security.selinux" "$_i" 2>/dev/null) if [ -z "$_attr" ]; then - restorecon $_i; + restorecon "$_i"; fi - done + done < <(find "$_path" -print0) } check_fence_kdump_config() diff --git a/SOURCES/kexec-kdump-howto.txt b/SOURCES/kexec-kdump-howto.txt index 47e11c2..c39ca72 100644 --- a/SOURCES/kexec-kdump-howto.txt +++ b/SOURCES/kexec-kdump-howto.txt @@ -621,6 +621,9 @@ If /etc/kdump/post.d directory exist, All files in the directory are collectively sorted and executed in lexical order, before binary or script specified kdump_post parameter is executed. +In these scripts, the reference to the storage or network device should adhere +to the section 'Supported dump target types and requirements' + Kdump Pre-Capture Executable ---------------------------- @@ -634,6 +637,9 @@ kdump_pre parameter is executed. Even if the binary or script in /etc/kdump/pre.d directory returns non 0 exit status, the processing is continued. +In these scripts, the reference to the storage or network device should adhere +to the section 'Supported dump target types and requirements' + Extra Binaries -------------- diff --git a/SOURCES/kexec-tools-2.0.20-1-printk-add-support-for-lockless-ringbuffer.patch b/SOURCES/kexec-tools-2.0.20-1-printk-add-support-for-lockless-ringbuffer.patch new file mode 100644 index 0000000..dbb2081 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-1-printk-add-support-for-lockless-ringbuffer.patch @@ -0,0 +1,492 @@ +From 4149df9005f2cdd2ecf70058dfe7d72f48c3a68c Mon Sep 17 00:00:00 2001 +From: John Ogness +Date: Wed, 25 Nov 2020 23:26:59 +0106 +Subject: [PATCH] printk: add support for lockless ringbuffer + +Linux 5.10 moved to a new lockless ringbuffer. The new ringbuffer +is structured completely different to the previous iterations. +Add support for retrieving the ringbuffer using vmcoreinfo. The +new ringbuffer is detected based on the availability of the +"prb" symbol. + +Signed-off-by: John Ogness +Signed-off-by: Simon Horman +--- + util_lib/elf_info.c | 438 +++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 437 insertions(+), 1 deletion(-) + +diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c +index 7803a94..2f23a44 100644 +--- a/util_lib/elf_info.c ++++ b/util_lib/elf_info.c +@@ -27,6 +27,32 @@ static int num_pt_loads; + + static char osrelease[4096]; + ++/* VMCOREINFO symbols for lockless printk ringbuffer */ ++static loff_t prb_vaddr; ++static size_t printk_ringbuffer_sz; ++static size_t prb_desc_sz; ++static size_t printk_info_sz; ++static uint64_t printk_ringbuffer_desc_ring_offset; ++static uint64_t printk_ringbuffer_text_data_ring_offset; ++static uint64_t prb_desc_ring_count_bits_offset; ++static uint64_t prb_desc_ring_descs_offset; ++static uint64_t prb_desc_ring_infos_offset; ++static uint64_t prb_data_ring_size_bits_offset; ++static uint64_t prb_data_ring_data_offset; ++static uint64_t prb_desc_ring_head_id_offset; ++static uint64_t prb_desc_ring_tail_id_offset; ++static uint64_t atomic_long_t_counter_offset; ++static uint64_t prb_desc_state_var_offset; ++static uint64_t prb_desc_info_offset; ++static uint64_t prb_desc_text_blk_lpos_offset; ++static uint64_t prb_data_blk_lpos_begin_offset; ++static uint64_t prb_data_blk_lpos_next_offset; ++static uint64_t printk_info_seq_offset; ++static uint64_t printk_info_caller_id_offset; ++static uint64_t printk_info_ts_nsec_offset; ++static uint64_t printk_info_level_offset; ++static uint64_t printk_info_text_len_offset; ++ + static loff_t log_buf_vaddr; + static loff_t log_end_vaddr; + static loff_t log_buf_len_vaddr; +@@ -304,6 +330,7 @@ void scan_vmcoreinfo(char *start, size_t size) + size_t len; + loff_t *vaddr; + } symbol[] = { ++ SYMBOL(prb), + SYMBOL(log_buf), + SYMBOL(log_end), + SYMBOL(log_buf_len), +@@ -361,6 +388,119 @@ void scan_vmcoreinfo(char *start, size_t size) + *symbol[i].vaddr = vaddr; + } + ++ str = "SIZE(printk_ringbuffer)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_ringbuffer_sz = strtoull(pos + strlen(str), ++ NULL, 10); ++ ++ str = "SIZE(prb_desc)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_sz = strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "SIZE(printk_info)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_info_sz = strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(printk_ringbuffer.desc_ring)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_ringbuffer_desc_ring_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(printk_ringbuffer.text_data_ring)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_ringbuffer_text_data_ring_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc_ring.count_bits)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_ring_count_bits_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc_ring.descs)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_ring_descs_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc_ring.infos)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_ring_infos_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_data_ring.size_bits)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_data_ring_size_bits_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_data_ring.data)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_data_ring_data_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc_ring.head_id)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_ring_head_id_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc_ring.tail_id)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_ring_tail_id_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(atomic_long_t.counter)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ atomic_long_t_counter_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc.state_var)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_state_var_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc.info)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_info_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_desc.text_blk_lpos)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_desc_text_blk_lpos_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_data_blk_lpos.begin)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_data_blk_lpos_begin_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(prb_data_blk_lpos.next)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ prb_data_blk_lpos_next_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(printk_info.seq)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_info_seq_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(printk_info.caller_id)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_info_caller_id_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(printk_info.ts_nsec)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_info_ts_nsec_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(printk_info.level)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_info_level_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ ++ str = "OFFSET(printk_info.text_len)="; ++ if (memcmp(str, pos, strlen(str)) == 0) ++ printk_info_text_len_offset = ++ strtoull(pos + strlen(str), NULL, 10); ++ + /* Check for "SIZE(printk_log)" or older "SIZE(log)=" */ + str = "SIZE(log)="; + if (memcmp(str, pos, strlen(str)) == 0) +@@ -746,9 +886,305 @@ static void dump_dmesg_structured(int fd, void (*handler)(char*, unsigned int)) + handler(out_buf, len); + } + ++/* convenience struct for passing many values to helper functions */ ++struct prb_map { ++ char *prb; ++ ++ char *desc_ring; ++ unsigned long desc_ring_count; ++ char *descs; ++ ++ char *infos; ++ ++ char *text_data_ring; ++ unsigned long text_data_ring_size; ++ char *text_data; ++}; ++ ++/* ++ * desc_state and DESC_* definitions taken from kernel source: ++ * ++ * kernel/printk/printk_ringbuffer.h ++ * ++ * DESC_* definitions modified to provide 32-bit and 64-bit variants. ++ */ ++ ++/* The possible responses of a descriptor state-query. */ ++enum desc_state { ++ desc_miss = -1, /* ID mismatch (pseudo state) */ ++ desc_reserved = 0x0, /* reserved, in use by writer */ ++ desc_committed = 0x1, /* committed by writer, could get reopened */ ++ desc_finalized = 0x2, /* committed, no further modification allowed */ ++ desc_reusable = 0x3, /* free, not yet used by any writer */ ++}; ++ ++#define DESC_SV_BITS (sizeof(uint64_t) * 8) ++#define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2) ++#define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) ++#define DESC_STATE(sv) (3UL & (sv >> DESC_FLAGS_SHIFT)) ++#define DESC_ID_MASK (~DESC_FLAGS_MASK) ++#define DESC_ID(sv) ((sv) & DESC_ID_MASK) ++ ++#define DESC32_SV_BITS (sizeof(uint32_t) * 8) ++#define DESC32_FLAGS_SHIFT (DESC32_SV_BITS - 2) ++#define DESC32_FLAGS_MASK (3UL << DESC32_FLAGS_SHIFT) ++#define DESC32_STATE(sv) (3UL & (sv >> DESC32_FLAGS_SHIFT)) ++#define DESC32_ID_MASK (~DESC32_FLAGS_MASK) ++#define DESC32_ID(sv) ((sv) & DESC32_ID_MASK) ++ ++/* ++ * get_desc_state() taken from kernel source: ++ * ++ * kernel/printk/printk_ringbuffer.c ++ * ++ * get_desc32_state() added as 32-bit variant. ++ */ ++ ++/* Query the state of a descriptor. */ ++static enum desc_state get_desc_state(unsigned long id, ++ uint64_t state_val) ++{ ++ if (id != DESC_ID(state_val)) ++ return desc_miss; ++ ++ return DESC_STATE(state_val); ++} ++ ++static enum desc_state get_desc32_state(unsigned long id, ++ uint64_t state_val) ++{ ++ if (id != DESC32_ID(state_val)) ++ return desc_miss; ++ ++ return DESC32_STATE(state_val); ++} ++ ++static bool record_committed(unsigned long id, uint64_t state_var) ++{ ++ enum desc_state state; ++ ++ if (machine_pointer_bits() == 32) ++ state = get_desc32_state(id, state_var); ++ else ++ state = get_desc_state(id, state_var); ++ ++ return (state == desc_committed || state == desc_finalized); ++} ++ ++static uint64_t id_inc(uint64_t id) ++{ ++ id++; ++ ++ if (machine_pointer_bits() == 32) ++ return (id & DESC32_ID_MASK); ++ ++ return (id & DESC_ID_MASK); ++} ++ ++static uint64_t get_ulong(char *addr) ++{ ++ if (machine_pointer_bits() == 32) ++ return struct_val_u32(addr, 0); ++ return struct_val_u64(addr, 0); ++} ++ ++static uint64_t sizeof_ulong(void) ++{ ++ return (machine_pointer_bits() >> 3); ++} ++ ++static void dump_record(struct prb_map *m, unsigned long id, ++ void (*handler)(char*, unsigned int)) ++{ ++#define OUT_BUF_SIZE 4096 ++ char out_buf[OUT_BUF_SIZE]; ++ imaxdiv_t imaxdiv_usec; ++ imaxdiv_t imaxdiv_sec; ++ uint32_t offset = 0; ++ unsigned short len; ++ uint64_t state_var; ++ uint64_t ts_nsec; ++ uint64_t begin; ++ uint64_t next; ++ char *info; ++ char *text; ++ char *desc; ++ int i; ++ ++ desc = m->descs + ((id % m->desc_ring_count) * prb_desc_sz); ++ info = m->infos + ((id % m->desc_ring_count) * printk_info_sz); ++ ++ /* skip non-committed record */ ++ state_var = get_ulong(desc + prb_desc_state_var_offset + ++ atomic_long_t_counter_offset); ++ if (!record_committed(id, state_var)) ++ return; ++ ++ begin = get_ulong(desc + prb_desc_text_blk_lpos_offset + ++ prb_data_blk_lpos_begin_offset) % ++ m->text_data_ring_size; ++ next = get_ulong(desc + prb_desc_text_blk_lpos_offset + ++ prb_data_blk_lpos_next_offset) % ++ m->text_data_ring_size; ++ ++ ts_nsec = struct_val_u64(info, printk_info_ts_nsec_offset); ++ imaxdiv_sec = imaxdiv(ts_nsec, 1000000000); ++ imaxdiv_usec = imaxdiv(imaxdiv_sec.rem, 1000); ++ ++ offset += sprintf(out_buf + offset, "[%5llu.%06llu] ", ++ (long long unsigned int)imaxdiv_sec.quot, ++ (long long unsigned int)imaxdiv_usec.quot); ++ ++ /* skip data-less text blocks */ ++ if (begin == next) ++ goto out; ++ ++ len = struct_val_u16(info, printk_info_text_len_offset); ++ ++ /* handle wrapping data block */ ++ if (begin > next) ++ begin = 0; ++ ++ /* skip over descriptor ID */ ++ begin += sizeof_ulong(); ++ ++ /* handle truncated messages */ ++ if (next - begin < len) ++ len = next - begin; ++ ++ text = m->text_data + begin; ++ ++ /* escape non-printable characters */ ++ for (i = 0; i < len; i++) { ++ unsigned char c = text[i]; ++ ++ if (!isprint(c) && !isspace(c)) ++ offset += sprintf(out_buf + offset, "\\x%02x", c); ++ else ++ out_buf[offset++] = c; ++ ++ if (offset >= OUT_BUF_SIZE - 64) { ++ if (handler) ++ handler(out_buf, offset); ++ offset = 0; ++ } ++ } ++out: ++ out_buf[offset++] = '\n'; ++ ++ if (offset && handler) ++ handler(out_buf, offset); ++} ++ ++/* ++ * Handle the lockless printk_ringbuffer. ++ */ ++static void dump_dmesg_lockless(int fd, void (*handler)(char*, unsigned int)) ++{ ++ struct prb_map m; ++ uint64_t head_id; ++ uint64_t tail_id; ++ uint64_t kaddr; ++ uint64_t id; ++ int ret; ++ ++ /* setup printk_ringbuffer */ ++ kaddr = read_file_pointer(fd, vaddr_to_offset(prb_vaddr)); ++ m.prb = calloc(1, printk_ringbuffer_sz); ++ if (!m.prb) { ++ fprintf(stderr, "Failed to malloc %lu bytes for prb: %s\n", ++ printk_ringbuffer_sz, strerror(errno)); ++ exit(64); ++ } ++ ret = pread(fd, m.prb, printk_ringbuffer_sz, vaddr_to_offset(kaddr)); ++ if (ret != printk_ringbuffer_sz) { ++ fprintf(stderr, "Failed to read prb of size %lu bytes: %s\n", ++ printk_ringbuffer_sz, strerror(errno)); ++ exit(65); ++ } ++ ++ /* setup descriptor ring */ ++ m.desc_ring = m.prb + printk_ringbuffer_desc_ring_offset; ++ m.desc_ring_count = 1 << struct_val_u32(m.desc_ring, ++ prb_desc_ring_count_bits_offset); ++ kaddr = get_ulong(m.desc_ring + prb_desc_ring_descs_offset); ++ m.descs = calloc(1, prb_desc_sz * m.desc_ring_count); ++ if (!m.descs) { ++ fprintf(stderr, "Failed to malloc %lu bytes for descs: %s\n", ++ prb_desc_sz * m.desc_ring_count, strerror(errno)); ++ exit(64); ++ } ++ ret = pread(fd, m.descs, prb_desc_sz * m.desc_ring_count, ++ vaddr_to_offset(kaddr)); ++ if (ret != prb_desc_sz * m.desc_ring_count) { ++ fprintf(stderr, ++ "Failed to read descs of size %lu bytes: %s\n", ++ prb_desc_sz * m.desc_ring_count, strerror(errno)); ++ exit(65); ++ } ++ ++ /* setup info ring */ ++ kaddr = get_ulong(m.prb + prb_desc_ring_infos_offset); ++ m.infos = calloc(1, printk_info_sz * m.desc_ring_count); ++ if (!m.infos) { ++ fprintf(stderr, "Failed to malloc %lu bytes for infos: %s\n", ++ printk_info_sz * m.desc_ring_count, strerror(errno)); ++ exit(64); ++ } ++ ret = pread(fd, m.infos, printk_info_sz * m.desc_ring_count, ++ vaddr_to_offset(kaddr)); ++ if (ret != printk_info_sz * m.desc_ring_count) { ++ fprintf(stderr, ++ "Failed to read infos of size %lu bytes: %s\n", ++ printk_info_sz * m.desc_ring_count, strerror(errno)); ++ exit(65); ++ } ++ ++ /* setup text data ring */ ++ m.text_data_ring = m.prb + printk_ringbuffer_text_data_ring_offset; ++ m.text_data_ring_size = 1 << struct_val_u32(m.text_data_ring, ++ prb_data_ring_size_bits_offset); ++ kaddr = get_ulong(m.text_data_ring + prb_data_ring_data_offset); ++ m.text_data = calloc(1, m.text_data_ring_size); ++ if (!m.text_data) { ++ fprintf(stderr, ++ "Failed to malloc %lu bytes for text_data: %s\n", ++ m.text_data_ring_size, strerror(errno)); ++ exit(64); ++ } ++ ret = pread(fd, m.text_data, m.text_data_ring_size, ++ vaddr_to_offset(kaddr)); ++ if (ret != m.text_data_ring_size) { ++ fprintf(stderr, ++ "Failed to read text_data of size %lu bytes: %s\n", ++ m.text_data_ring_size, strerror(errno)); ++ exit(65); ++ } ++ ++ /* ready to go */ ++ ++ tail_id = get_ulong(m.desc_ring + prb_desc_ring_tail_id_offset + ++ atomic_long_t_counter_offset); ++ head_id = get_ulong(m.desc_ring + prb_desc_ring_head_id_offset + ++ atomic_long_t_counter_offset); ++ ++ for (id = tail_id; id != head_id; id = id_inc(id)) ++ dump_record(&m, id, handler); ++ ++ /* dump head record */ ++ dump_record(&m, id, handler); ++ ++ free(m.text_data); ++ free(m.infos); ++ free(m.descs); ++ free(m.prb); ++} ++ + void dump_dmesg(int fd, void (*handler)(char*, unsigned int)) + { +- if (log_first_idx_vaddr) ++ if (prb_vaddr) ++ dump_dmesg_lockless(fd, handler); ++ else if (log_first_idx_vaddr) + dump_dmesg_structured(fd, handler); + else + dump_dmesg_legacy(fd, handler); +-- +2.31.1 + diff --git a/SOURCES/kexec-tools-2.0.20-2-printk-Use-ULL-suffix-for-64-bit-constants.patch b/SOURCES/kexec-tools-2.0.20-2-printk-Use-ULL-suffix-for-64-bit-constants.patch new file mode 100644 index 0000000..f40cd3e --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-2-printk-Use-ULL-suffix-for-64-bit-constants.patch @@ -0,0 +1,65 @@ +From 07b272a07164b902acd7d12794f7be033ebf4525 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Wed, 17 Mar 2021 13:14:49 +0100 +Subject: [PATCH] printk: Use ULL suffix for 64-bit constants +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When compiling for 32-bit: + + util_lib/elf_info.c: In function ‘get_desc_state’: + util_lib/elf_info.c:923:31: warning: left shift count >= width of type [-Wshift-count-overflow] + 923 | #define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) + | ^~ + util_lib/elf_info.c:925:25: note: in expansion of macro ‘DESC_FLAGS_MASK’ + 925 | #define DESC_ID_MASK (~DESC_FLAGS_MASK) + | ^~~~~~~~~~~~~~~ + util_lib/elf_info.c:926:30: note: in expansion of macro ‘DESC_ID_MASK’ + 926 | #define DESC_ID(sv) ((sv) & DESC_ID_MASK) + | ^~~~~~~~~~~~ + util_lib/elf_info.c:947:12: note: in expansion of macro ‘DESC_ID’ + 947 | if (id != DESC_ID(state_val)) + | ^~~~~~~ + util_lib/elf_info.c: In function ‘id_inc’: + util_lib/elf_info.c:923:31: warning: left shift count >= width of type [-Wshift-count-overflow] + 923 | #define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) + | ^~ + util_lib/elf_info.c:925:25: note: in expansion of macro ‘DESC_FLAGS_MASK’ + 925 | #define DESC_ID_MASK (~DESC_FLAGS_MASK) + | ^~~~~~~~~~~~~~~ + util_lib/elf_info.c:981:15: note: in expansion of macro ‘DESC_ID_MASK’ + 981 | return (id & DESC_ID_MASK); + | ^~~~~~~~~~~~ + +Indeed, "unsigned long" constants are 32-bit on 32-bit platforms, and +64-bit on 64-bit platforms. + +Fix this by using a "ULL" suffix instead. + +Fixes: 4149df9005f2cdd2 ("printk: add support for lockless ringbuffer") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: John Ogness +Signed-off-by: Simon Horman +--- + util_lib/elf_info.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c +index 2f23a44..7c0a2c3 100644 +--- a/util_lib/elf_info.c ++++ b/util_lib/elf_info.c +@@ -920,8 +920,8 @@ enum desc_state { + + #define DESC_SV_BITS (sizeof(uint64_t) * 8) + #define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2) +-#define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) +-#define DESC_STATE(sv) (3UL & (sv >> DESC_FLAGS_SHIFT)) ++#define DESC_FLAGS_MASK (3ULL << DESC_FLAGS_SHIFT) ++#define DESC_STATE(sv) (3ULL & (sv >> DESC_FLAGS_SHIFT)) + #define DESC_ID_MASK (~DESC_FLAGS_MASK) + #define DESC_ID(sv) ((sv) & DESC_ID_MASK) + +-- +2.31.1 + diff --git a/SOURCES/kexec-tools-2.0.20-3-printk-Use-zu-to-format-size_t.patch b/SOURCES/kexec-tools-2.0.20-3-printk-Use-zu-to-format-size_t.patch new file mode 100644 index 0000000..29ac6fc --- /dev/null +++ b/SOURCES/kexec-tools-2.0.20-3-printk-Use-zu-to-format-size_t.patch @@ -0,0 +1,68 @@ +From 82f7de2724c42a6aecc0cff93881b3dfd09363ce Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Wed, 17 Mar 2021 13:14:50 +0100 +Subject: [PATCH] printk: Use %zu to format size_t +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When compiling for 32-bit: + + util_lib/elf_info.c: In function ‘dump_dmesg_lockless’: + util_lib/elf_info.c:1095:39: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=] + 1095 | fprintf(stderr, "Failed to malloc %lu bytes for prb: %s\n", + | ~~^ + | | + | long unsigned int + | %u + 1096 | printk_ringbuffer_sz, strerror(errno)); + | ~~~~~~~~~~~~~~~~~~~~ + | | + | size_t {aka unsigned int} + util_lib/elf_info.c:1101:49: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=] + 1101 | fprintf(stderr, "Failed to read prb of size %lu bytes: %s\n", + | ~~^ + | | + | long unsigned int + | %u + 1102 | printk_ringbuffer_sz, strerror(errno)); + | ~~~~~~~~~~~~~~~~~~~~ + | | + | size_t {aka unsigned int} + +Indeed, "size_t" is "unsigned int" on 32-bit platforms, and "unsigned +long" on 64-bit platforms. + +Fix this by formatting using "%zu". + +Fixes: 4149df9005f2cdd2 ("printk: add support for lockless ringbuffer") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: John Ogness +Signed-off-by: Simon Horman +--- + util_lib/elf_info.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c +index 7c0a2c3..676926c 100644 +--- a/util_lib/elf_info.c ++++ b/util_lib/elf_info.c +@@ -1092,13 +1092,13 @@ static void dump_dmesg_lockless(int fd, void (*handler)(char*, unsigned int)) + kaddr = read_file_pointer(fd, vaddr_to_offset(prb_vaddr)); + m.prb = calloc(1, printk_ringbuffer_sz); + if (!m.prb) { +- fprintf(stderr, "Failed to malloc %lu bytes for prb: %s\n", ++ fprintf(stderr, "Failed to malloc %zu bytes for prb: %s\n", + printk_ringbuffer_sz, strerror(errno)); + exit(64); + } + ret = pread(fd, m.prb, printk_ringbuffer_sz, vaddr_to_offset(kaddr)); + if (ret != printk_ringbuffer_sz) { +- fprintf(stderr, "Failed to read prb of size %lu bytes: %s\n", ++ fprintf(stderr, "Failed to read prb of size %zu bytes: %s\n", + printk_ringbuffer_sz, strerror(errno)); + exit(65); + } +-- +2.31.1 + diff --git a/SOURCES/kexec-tools-2.0.20-makedumpfile-Add-dry-run-option-to-prevent-writing.patch b/SOURCES/kexec-tools-2.0.20-makedumpfile-Add-dry-run-option-to-prevent-writing.patch deleted file mode 100644 index 631d039..0000000 --- a/SOURCES/kexec-tools-2.0.20-makedumpfile-Add-dry-run-option-to-prevent-writing.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 3422e1d6bc3511c5af9cb05ba74ad97dd93ffd7f Mon Sep 17 00:00:00 2001 -From: Julien Thierry -Date: Tue, 24 Nov 2020 10:45:24 +0000 -Subject: [PATCH] [PATCH 1/2] Add --dry-run option to prevent writing the - dumpfile - -Add a --dry-run option to run all operations without writing the -dump to the output file. - -Signed-off-by: Julien Thierry -Signed-off-by: Kazuhito Hagio ---- - makedumpfile.8 | 6 ++++++ - makedumpfile.c | 37 ++++++++++++++++++++++++++++++------- - makedumpfile.h | 2 ++ - print_info.c | 3 +++ - 4 files changed, 41 insertions(+), 7 deletions(-) - -diff --git a/makedumpfile-1.6.8/makedumpfile.8 b/makedumpfile-1.6.8/makedumpfile.8 -index b68a7e3..5e902cd 100644 ---- a/makedumpfile-1.6.8/makedumpfile.8 -+++ b/makedumpfile-1.6.8/makedumpfile.8 -@@ -637,6 +637,12 @@ Show the version of makedumpfile. - Only check whether the command-line parameters are valid or not, and exit. - Preferable to be given as the first parameter. - -+.TP -+\fB\-\-dry-run\fR -+Do not write the output dump file while still performing operations specified -+by other options. -+This option cannot be used with the --dump-dmesg, --reassemble and -g options. -+ - .SH ENVIRONMENT VARIABLES - - .TP 8 -diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c -index ecd63fa..8c80c49 100644 ---- a/makedumpfile-1.6.8/makedumpfile.c -+++ b/makedumpfile-1.6.8/makedumpfile.c -@@ -1372,6 +1372,8 @@ open_dump_file(void) - if (info->flag_flatten) { - fd = STDOUT_FILENO; - info->name_dumpfile = filename_stdout; -+ } else if (info->flag_dry_run) { -+ fd = -1; - } else if ((fd = open(info->name_dumpfile, open_flags, - S_IRUSR|S_IWUSR)) < 0) { - ERRMSG("Can't open the dump file(%s). %s\n", -@@ -4711,6 +4713,9 @@ write_and_check_space(int fd, void *buf, size_t buf_size, char *file_name) - { - int status, written_size = 0; - -+ if (info->flag_dry_run) -+ return TRUE; -+ - while (written_size < buf_size) { - status = write(fd, buf + written_size, - buf_size - written_size); -@@ -4748,13 +4753,12 @@ write_buffer(int fd, off_t offset, void *buf, size_t buf_size, char *file_name) - } - if (!write_and_check_space(fd, &fdh, sizeof(fdh), file_name)) - return FALSE; -- } else { -- if (lseek(fd, offset, SEEK_SET) == failed) { -- ERRMSG("Can't seek the dump file(%s). %s\n", -- file_name, strerror(errno)); -- return FALSE; -- } -+ } else if (!info->flag_dry_run && -+ lseek(fd, offset, SEEK_SET) == failed) { -+ ERRMSG("Can't seek the dump file(%s). %s\n", file_name, strerror(errno)); -+ return FALSE; - } -+ - if (!write_and_check_space(fd, buf, buf_size, file_name)) - return FALSE; - -@@ -9112,7 +9116,7 @@ close_dump_memory(void) - void - close_dump_file(void) - { -- if (info->flag_flatten) -+ if (info->flag_flatten || info->flag_dry_run) - return; - - if (close(info->fd_dumpfile) < 0) -@@ -10985,6 +10989,11 @@ check_param_for_generating_vmcoreinfo(int argc, char *argv[]) - - return FALSE; - -+ if (info->flag_dry_run) { -+ MSG("--dry-run cannot be used with -g.\n"); -+ return FALSE; -+ } -+ - return TRUE; - } - -@@ -11029,6 +11038,11 @@ check_param_for_reassembling_dumpfile(int argc, char *argv[]) - || info->flag_exclude_xen_dom || info->flag_split) - return FALSE; - -+ if (info->flag_dry_run) { -+ MSG("--dry-run cannot be used with --reassemble.\n"); -+ return FALSE; -+ } -+ - if ((info->splitting_info - = malloc(sizeof(struct splitting_info) * info->num_dumpfile)) - == NULL) { -@@ -11057,6 +11071,11 @@ check_param_for_creating_dumpfile(int argc, char *argv[]) - || (info->flag_read_vmcoreinfo && info->name_xen_syms)) - return FALSE; - -+ if (info->flag_dry_run && info->flag_dmesg) { -+ MSG("--dry-run cannot be used with --dump-dmesg.\n"); -+ return FALSE; -+ } -+ - if (info->flag_flatten && info->flag_split) - return FALSE; - -@@ -11520,6 +11539,7 @@ static struct option longopts[] = { - {"work-dir", required_argument, NULL, OPT_WORKING_DIR}, - {"num-threads", required_argument, NULL, OPT_NUM_THREADS}, - {"check-params", no_argument, NULL, OPT_CHECK_PARAMS}, -+ {"dry-run", no_argument, NULL, OPT_DRY_RUN}, - {0, 0, 0, 0} - }; - -@@ -11686,6 +11706,9 @@ main(int argc, char *argv[]) - info->flag_check_params = TRUE; - message_level = DEFAULT_MSG_LEVEL; - break; -+ case OPT_DRY_RUN: -+ info->flag_dry_run = TRUE; -+ break; - case '?': - MSG("Commandline parameter is invalid.\n"); - MSG("Try `makedumpfile --help' for more information.\n"); -diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h -index 5f50080..4c4222c 100644 ---- a/makedumpfile-1.6.8/makedumpfile.h -+++ b/makedumpfile-1.6.8/makedumpfile.h -@@ -1322,6 +1322,7 @@ struct DumpInfo { - int flag_vmemmap; /* kernel supports vmemmap address space */ - int flag_excludevm; /* -e - excluding unused vmemmap pages */ - int flag_use_count; /* _refcount is named _count in struct page */ -+ int flag_dry_run; /* do not create a vmcore file */ - unsigned long vaddr_for_vtop; /* virtual address for debugging */ - long page_size; /* size of page */ - long page_shift; -@@ -2425,6 +2426,7 @@ struct elf_prstatus { - #define OPT_NUM_THREADS OPT_START+16 - #define OPT_PARTIAL_DMESG OPT_START+17 - #define OPT_CHECK_PARAMS OPT_START+18 -+#define OPT_DRY_RUN OPT_START+19 - - /* - * Function Prototype. -diff --git a/makedumpfile-1.6.8/print_info.c b/makedumpfile-1.6.8/print_info.c -index e0c38b4..d2b0cb7 100644 ---- a/makedumpfile-1.6.8/print_info.c -+++ b/makedumpfile-1.6.8/print_info.c -@@ -308,6 +308,9 @@ print_usage(void) - MSG(" the crashkernel range, then calculates the page number of different kind per\n"); - MSG(" vmcoreinfo. So currently /proc/kcore need be specified explicitly.\n"); - MSG("\n"); -+ MSG(" [--dry-run]:\n"); -+ MSG(" This option runs makedumpfile without writting output dump file.\n"); -+ MSG("\n"); - MSG(" [-D]:\n"); - MSG(" Print debugging message.\n"); - MSG("\n"); --- -2.29.2 - diff --git a/SOURCES/kexec-tools-2.0.20-makedumpfile-Add-shorthand-show-stats-option-to-show.patch b/SOURCES/kexec-tools-2.0.20-makedumpfile-Add-shorthand-show-stats-option-to-show.patch deleted file mode 100644 index 5e935f0..0000000 --- a/SOURCES/kexec-tools-2.0.20-makedumpfile-Add-shorthand-show-stats-option-to-show.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 6f3e75a558ed50d6ff0b42e3f61c099b2005b7bb Mon Sep 17 00:00:00 2001 -From: Julien Thierry -Date: Tue, 24 Nov 2020 10:45:25 +0000 -Subject: [PATCH] [PATCH 2/2] Add shorthand --show-stats option to show report - stats - -Provide shorthand --show-stats option to enable report messages -without needing to set a particular value for message-level. - -Signed-off-by: Julien Thierry -Signed-off-by: Kazuhito Hagio ---- - makedumpfile.8 | 5 +++++ - makedumpfile.c | 9 ++++++++- - makedumpfile.h | 1 + - print_info.c | 7 ++++++- - 4 files changed, 20 insertions(+), 2 deletions(-) - -diff --git a/makedumpfile-1.6.8/makedumpfile.8 b/makedumpfile-1.6.8/makedumpfile.8 -index 5e902cd..dcca2dd 100644 ---- a/makedumpfile-1.6.8/makedumpfile.8 -+++ b/makedumpfile-1.6.8/makedumpfile.8 -@@ -643,6 +643,11 @@ Do not write the output dump file while still performing operations specified - by other options. - This option cannot be used with the --dump-dmesg, --reassemble and -g options. - -+.TP -+\fB\-\-show-stats\fR -+Display report messages. This is an alternative to enabling bit 4 in the level -+provided to --message-level. -+ - .SH ENVIRONMENT VARIABLES - - .TP 8 -diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c -index 8c80c49..ba0003a 100644 ---- a/makedumpfile-1.6.8/makedumpfile.c -+++ b/makedumpfile-1.6.8/makedumpfile.c -@@ -11540,13 +11540,14 @@ static struct option longopts[] = { - {"num-threads", required_argument, NULL, OPT_NUM_THREADS}, - {"check-params", no_argument, NULL, OPT_CHECK_PARAMS}, - {"dry-run", no_argument, NULL, OPT_DRY_RUN}, -+ {"show-stats", no_argument, NULL, OPT_SHOW_STATS}, - {0, 0, 0, 0} - }; - - int - main(int argc, char *argv[]) - { -- int i, opt, flag_debug = FALSE; -+ int i, opt, flag_debug = FALSE, flag_show_stats = FALSE; - - if ((info = calloc(1, sizeof(struct DumpInfo))) == NULL) { - ERRMSG("Can't allocate memory for the pagedesc cache. %s.\n", -@@ -11709,6 +11710,9 @@ main(int argc, char *argv[]) - case OPT_DRY_RUN: - info->flag_dry_run = TRUE; - break; -+ case OPT_SHOW_STATS: -+ flag_show_stats = TRUE; -+ break; - case '?': - MSG("Commandline parameter is invalid.\n"); - MSG("Try `makedumpfile --help' for more information.\n"); -@@ -11718,6 +11722,9 @@ main(int argc, char *argv[]) - if (flag_debug) - message_level |= ML_PRINT_DEBUG_MSG; - -+ if (flag_show_stats) -+ message_level |= ML_PRINT_REPORT_MSG; -+ - if (info->flag_check_params) - /* suppress debugging messages */ - message_level = DEFAULT_MSG_LEVEL; -diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h -index 4c4222c..2fcb62e 100644 ---- a/makedumpfile-1.6.8/makedumpfile.h -+++ b/makedumpfile-1.6.8/makedumpfile.h -@@ -2427,6 +2427,7 @@ struct elf_prstatus { - #define OPT_PARTIAL_DMESG OPT_START+17 - #define OPT_CHECK_PARAMS OPT_START+18 - #define OPT_DRY_RUN OPT_START+19 -+#define OPT_SHOW_STATS OPT_START+20 - - /* - * Function Prototype. -diff --git a/makedumpfile-1.6.8/print_info.c b/makedumpfile-1.6.8/print_info.c -index d2b0cb7..ad4184e 100644 ---- a/makedumpfile-1.6.8/print_info.c -+++ b/makedumpfile-1.6.8/print_info.c -@@ -309,7 +309,12 @@ print_usage(void) - MSG(" vmcoreinfo. So currently /proc/kcore need be specified explicitly.\n"); - MSG("\n"); - MSG(" [--dry-run]:\n"); -- MSG(" This option runs makedumpfile without writting output dump file.\n"); -+ MSG(" Do not write the output dump file while still performing operations specified\n"); -+ MSG(" by other options. This option cannot be used with --dump-dmesg, --reassemble\n"); -+ MSG(" and -g options.\n"); -+ MSG("\n"); -+ MSG(" [--show-stats]:\n"); -+ MSG(" Set message-level to print report messages\n"); - MSG("\n"); - MSG(" [-D]:\n"); - MSG(" Print debugging message.\n"); --- -2.29.2 - diff --git a/SOURCES/kexec-tools-2.0.20-makedumpfile-Show-write-byte-size-in-report-messages.patch b/SOURCES/kexec-tools-2.0.20-makedumpfile-Show-write-byte-size-in-report-messages.patch deleted file mode 100644 index 337288e..0000000 --- a/SOURCES/kexec-tools-2.0.20-makedumpfile-Show-write-byte-size-in-report-messages.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0ef2ca6c9fa2f61f217a4bf5d7fd70f24e12b2eb Mon Sep 17 00:00:00 2001 -From: Kazuhito Hagio -Date: Thu, 4 Feb 2021 16:29:06 +0900 -Subject: [PATCH] [PATCH] Show write byte size in report messages - -Show write byte size in report messages. This value can be different -from the size of the actual file because of some holes on dumpfile -data structure. - - $ makedumpfile --show-stats -l -d 1 vmcore dump.ld1 - ... - Total pages : 0x0000000000080000 - Write bytes : 377686445 - ... - # ls -l dump.ld1 - -rw------- 1 root root 377691573 Feb 4 16:28 dump.ld1 - -Note that this value should not be used with /proc/kcore to determine -how much disk space is needed for crash dump, because the real memory -usage when a crash occurs can vary widely. - -Signed-off-by: Kazuhito Hagio ---- - makedumpfile.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c -index fcd766b..894c88e 100644 ---- a/makedumpfile-1.6.8/makedumpfile.c -+++ b/makedumpfile-1.6.8/makedumpfile.c -@@ -48,6 +48,8 @@ char filename_stdout[] = FILENAME_STDOUT; - static unsigned long long cache_hit; - static unsigned long long cache_miss; - -+static unsigned long long write_bytes; -+ - static void first_cycle(mdf_pfn_t start, mdf_pfn_t max, struct cycle *cycle) - { - cycle->start_pfn = round(start, info->pfn_cyclic); -@@ -4715,6 +4717,8 @@ write_and_check_space(int fd, void *buf, size_t buf_size, char *file_name) - { - int status, written_size = 0; - -+ write_bytes += buf_size; -+ - if (info->flag_dry_run) - return TRUE; - -@@ -10002,6 +10006,7 @@ print_report(void) - REPORT_MSG("Memory Hole : 0x%016llx\n", pfn_memhole); - REPORT_MSG("--------------------------------------------------\n"); - REPORT_MSG("Total pages : 0x%016llx\n", info->max_mapnr); -+ REPORT_MSG("Write bytes : %llu\n", write_bytes); - REPORT_MSG("\n"); - REPORT_MSG("Cache hit: %lld, miss: %lld", cache_hit, cache_miss); - if (cache_hit + cache_miss) --- -2.29.2 - diff --git a/SOURCES/kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-finding-max_paddr.patch b/SOURCES/kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-finding-max_paddr.patch deleted file mode 100644 index c6eb40f..0000000 --- a/SOURCES/kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-finding-max_paddr.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 38d921a2ef50ebd36258097553626443ffe27496 Mon Sep 17 00:00:00 2001 -From: Coiby Xu -Date: Tue, 15 Jun 2021 18:26:31 +0800 -Subject: [PATCH] check for invalid physical address of /proc/kcore - when finding max_paddr - -Kernel commit 464920104bf7adac12722035bfefb3d772eb04d8 ("/proc/kcore: -update physical address for kcore ram and text") sets an invalid paddr -(0xffffffffffffffff = -1) for PT_LOAD segments of not direct mapped -regions: - - $ readelf -l /proc/kcore - ... - Program Headers: - Type Offset VirtAddr PhysAddr - FileSiz MemSiz Flags Align - NOTE 0x0000000000000120 0x0000000000000000 0x0000000000000000 - 0x0000000000002320 0x0000000000000000 0x0 - LOAD 0x1000000000010000 0xd000000000000000 0xffffffffffffffff - ^^^^^^^^^^^^^^^^^^ - 0x0001f80000000000 0x0001f80000000000 RWE 0x10000 - -makedumpfile uses max_paddr to calculate the number of sections for -sparse memory model thus wrong number is obtained based on max_paddr -(-1). This error could lead to the failure of copying /proc/kcore -for RHEL-8.5 on ppc64le machine [1]: - - $ makedumpfile /proc/kcore vmcore1 - get_mem_section: Could not validate mem_section. - get_mm_sparsemem: Can't get the address of mem_section. - - makedumpfile Failed. - -Let's check if the phys_start of the segment is a valid physical -address to fix this problem. - -[1] https://bugzilla.redhat.com/show_bug.cgi?id=1965267 - -Reported-by: Xiaoying Yan -Signed-off-by: Coiby Xu ---- - elf_info.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/makedumpfile-1.6.8/elf_info.c b/makedumpfile-1.6.8/elf_info.c -index e8affb7..bc24083 100644 ---- a/makedumpfile-1.6.8/elf_info.c -+++ b/makedumpfile-1.6.8/elf_info.c -@@ -628,7 +628,7 @@ get_max_paddr(void) - - for (i = 0; i < num_pt_loads; i++) { - pls = &pt_loads[i]; -- if (max_paddr < pls->phys_end) -+ if (pls->phys_start != NOT_PADDR && max_paddr < pls->phys_end) - max_paddr = pls->phys_end; - } - return max_paddr; --- -2.29.2 - diff --git a/SOURCES/kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch b/SOURCES/kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch deleted file mode 100644 index 9180dc6..0000000 --- a/SOURCES/kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 9a6f589d99dcef114c89fde992157f5467028c8f Mon Sep 17 00:00:00 2001 -From: Tao Liu -Date: Fri, 18 Jun 2021 18:28:04 +0800 -Subject: [PATCH] check for invalid physical address of /proc/kcore - when making ELF dumpfile - -Previously when executing makedumpfile with -E option against -/proc/kcore, makedumpfile will fail: - - # makedumpfile -E -d 31 /proc/kcore kcore.dump - ... - write_elf_load_segment: Can't convert physaddr(ffffffffffffffff) to an offset. - - makedumpfile Failed. - -It's because /proc/kcore contains PT_LOAD program headers which have -physaddr (0xffffffffffffffff). With -E option, makedumpfile will -try to convert the physaddr to an offset and fails. - -Skip the PT_LOAD program headers which have such physaddr. - -Signed-off-by: Tao Liu -Signed-off-by: Kazuhito Hagio ---- - makedumpfile.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c -index 894c88e..fcb571f 100644 ---- a/makedumpfile-1.6.8/makedumpfile.c -+++ b/makedumpfile-1.6.8/makedumpfile.c -@@ -7764,7 +7764,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - if (!get_phdr_memory(i, &load)) - return FALSE; - -- if (load.p_type != PT_LOAD) -+ if (load.p_type != PT_LOAD || load.p_paddr == NOT_PADDR) - continue; - - off_memory= load.p_offset; --- -2.29.2 - diff --git a/SOURCES/mkdumprd b/SOURCES/mkdumprd index 3c2fb5d..ce3c0f3 100644 --- a/SOURCES/mkdumprd +++ b/SOURCES/mkdumprd @@ -29,7 +29,7 @@ SAVE_PATH=$(get_save_path) OVERRIDE_RESETTABLE=0 extra_modules="" -dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\"" +dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\" --compress=xz" readonly MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)" [ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed." @@ -68,8 +68,8 @@ to_mount() { if [[ "$_fstype" == "nfs"* ]]; then _pdev=$_target - _options=$(echo $_options | sed 's/,addr=[^,]*//') - _options=$(echo $_options | sed 's/,proto=[^,]*//') + _options=$(echo $_options | sed 's/,\(mount\)\?addr=[^,]*//g') + _options=$(echo $_options | sed 's/,\(mount\)\?proto=[^,]*//g') _options=$(echo $_options | sed 's/,clientaddr=[^,]*//') else # for non-nfs _target converting to use udev persistent name @@ -432,6 +432,11 @@ then add_dracut_arg "--add-drivers" \"$extra_modules\" fi +# TODO: The below check is not needed anymore with the introduction of +# 'zz-fadumpinit' module, that isolates fadump's capture kernel initrd, +# but still sysroot.mount unit gets generated based on 'root=' kernel +# parameter available in fadump case. So, find a way to fix that first +# before removing this check. if ! is_fadump_capable; then # The 2nd rootfs mount stays behind the normal dump target mount, # so it doesn't affect the logic of check_dump_fs_modified(). diff --git a/SOURCES/mkfadumprd b/SOURCES/mkfadumprd new file mode 100644 index 0000000..5447c7a --- /dev/null +++ b/SOURCES/mkfadumprd @@ -0,0 +1,64 @@ +#!/bin/bash --norc +# Generate an initramfs image that isolates dump capture capability within +# the default initramfs using zz-fadumpinit dracut module. + +if [ -f /etc/sysconfig/kdump ]; then + . /etc/sysconfig/kdump +fi + +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh +. /lib/kdump/kdump-lib.sh +. /lib/kdump/kdump-logger.sh + +#initiate the kdump logger +if ! dlog_init; then + echo "mkfadumprd: failed to initiate the kdump logger." + exit 1 +fi + +readonly MKFADUMPRD_TMPDIR="$(mktemp -d -t mkfadumprd.XXXXXX)" +[ -d "$MKFADUMPRD_TMPDIR" ] || perror_exit "mkfadumprd: mktemp -d -t mkfadumprd.XXXXXX failed." +trap ' + ret=$?; + [[ -d $MKFADUMPRD_TMPDIR ]] && rm --one-file-system -rf -- "$MKFADUMPRD_TMPDIR"; + exit $ret; + ' EXIT + +# clean up after ourselves no matter how we die. +trap 'exit 1;' SIGINT + +MKDUMPRD="/sbin/mkdumprd -f" +# Default boot initramfs to be rebuilt +REBUILD_INITRD="$1" && shift +TARGET_INITRD="$1" && shift +FADUMP_INITRD="$MKFADUMPRD_TMPDIR/fadump.img" + +### First build an initramfs with dump capture capability +# this file tells the initrd is fadump enabled +touch "$MKFADUMPRD_TMPDIR/fadump.initramfs" +ddebug "rebuild fadump initrd: $FADUMP_INITRD $DEFAULT_INITRD $KDUMP_KERNELVER" +if ! $MKDUMPRD "$FADUMP_INITRD" -i "$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs; then + perror_exit "mkfadumprd: failed to build image with dump capture support" +fi + +### Unpack the initramfs having dump capture capability +mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot" +if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd --unpack "$FADUMP_INITRD" && \ + popd > /dev/null); then + derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'" + exit 1 +fi + +### Pack it into the normal boot initramfs with zz-fadumpinit module +_dracut_isolate_args="--rebuild $REBUILD_INITRD --add zz-fadumpinit \ + -i $MKFADUMPRD_TMPDIR/fadumproot /fadumproot \ + -i $MKFADUMPRD_TMPDIR/fadumproot/usr/lib/dracut/loaded-kernel-modules.txt + /usr/lib/dracut/fadump-kernel-modules.txt" + +if is_squash_available; then + _dracut_isolate_args="$_dracut_isolate_args --add squash" +fi +if ! dracut --force --quiet $_dracut_isolate_args $@ "$TARGET_INITRD"; then + perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability" +fi diff --git a/SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch b/SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch index 85b5496..7b7ad63 100644 --- a/SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch +++ b/SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch @@ -1,27 +1,30 @@ -From 16028a119c85ed73944bcf6ca310a7ee4d2e64fe Mon Sep 17 00:00:00 2001 +From 0f632fa180e5a44219ab6bbe0879c3583f8c65cf Mon Sep 17 00:00:00 2001 From: Pingfan Liu -Date: Mon, 21 Dec 2020 13:35:38 +0800 +Date: Tue, 9 Nov 2021 11:24:22 +0800 Subject: [PATCH] RHEL-only +Cope with RHEL8 kernel + +Signed-off-by: Pingfan Liu --- arch/arm64.c | 14 +++++++++++++- makedumpfile.c | 2 ++ makedumpfile.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) -diff --git a/makedumpfile-1.6.8/arch/arm64.c b/makedumpfile-1.6.8/arch/arm64.c -index 3d7b416..c8e7f62 100644 ---- a/makedumpfile-1.6.8/arch/arm64.c -+++ b/makedumpfile-1.6.8/arch/arm64.c -@@ -48,6 +48,7 @@ static int lpa_52_bit_support_available; - static int pgtable_level; - static int va_bits; +diff --git a/makedumpfile-1.7.0/arch/arm64.c b/makedumpfile-1.7.0/arch/arm64.c +index 1072178..95beae6 100644 +--- a/makedumpfile-1.7.0/arch/arm64.c ++++ b/makedumpfile-1.7.0/arch/arm64.c +@@ -50,6 +50,7 @@ static int va_bits; + static int vabits_actual; + static int flipped_va; static unsigned long kimage_voffset; +static int max_user_va_bits; #define SZ_4K 4096 #define SZ_16K 16384 -@@ -107,7 +108,7 @@ typedef unsigned long pgdval_t; +@@ -108,7 +109,7 @@ typedef unsigned long pgdval_t; #define PGDIR_SHIFT ARM64_HW_PGTABLE_LEVEL_SHIFT(4 - (pgtable_level)) #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) @@ -30,7 +33,7 @@ index 3d7b416..c8e7f62 100644 /* * Section address mask and size definitions. -@@ -366,6 +367,17 @@ get_machdep_info_arm64(void) +@@ -449,6 +450,17 @@ get_machdep_info_arm64(void) ERRMSG("Can't determine platform config values\n"); return FALSE; } @@ -48,38 +51,38 @@ index 3d7b416..c8e7f62 100644 kimage_voffset = NUMBER(kimage_voffset); info->section_size_bits = SECTIONS_SIZE_BITS; -diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c -index cdde040..9fd3ae9 100644 ---- a/makedumpfile-1.6.8/makedumpfile.c -+++ b/makedumpfile-1.6.8/makedumpfile.c -@@ -2322,6 +2322,7 @@ write_vmcoreinfo_data(void) +diff --git a/makedumpfile-1.7.0/makedumpfile.c b/makedumpfile-1.7.0/makedumpfile.c +index 3ad4443..018ea4c 100644 +--- a/makedumpfile-1.7.0/makedumpfile.c ++++ b/makedumpfile-1.7.0/makedumpfile.c +@@ -2417,6 +2417,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("TCR_EL1_T1SZ", TCR_EL1_T1SZ); should not exists */ WRITE_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET); - WRITE_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset); -@@ -2728,6 +2729,7 @@ read_vmcoreinfo(void) +@@ -2863,6 +2864,7 @@ read_vmcoreinfo(void) READ_NUMBER("phys_base", phys_base); READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE); #ifdef __aarch64__ + READ_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS); READ_NUMBER("VA_BITS", VA_BITS); + READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ); READ_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET); - READ_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset); -diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h -index 698c054..2763a47 100644 ---- a/makedumpfile-1.6.8/makedumpfile.h -+++ b/makedumpfile-1.6.8/makedumpfile.h -@@ -1937,6 +1937,7 @@ struct number_table { +diff --git a/makedumpfile-1.7.0/makedumpfile.h b/makedumpfile-1.7.0/makedumpfile.h +index e59239d..b6236dd 100644 +--- a/makedumpfile-1.7.0/makedumpfile.h ++++ b/makedumpfile-1.7.0/makedumpfile.h +@@ -2064,6 +2064,7 @@ struct number_table { long phys_base; long KERNEL_IMAGE_SIZE; #ifdef __aarch64__ + long MAX_USER_VA_BITS; long VA_BITS; + long TCR_EL1_T1SZ; unsigned long PHYS_OFFSET; - unsigned long kimage_voffset; -- -2.21.0 +2.31.1 diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec index 8ab65a9..79f596a 100644 --- a/SPECS/kexec-tools.spec +++ b/SPECS/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.20 -Release: 57%{?dist} +Release: 68%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -13,7 +13,7 @@ Source4: kdump.sysconfig.i386 Source5: kdump.sysconfig.ppc64 Source7: mkdumprd Source8: kdump.conf -Source9: https://github.com/makedumpfile/makedumpfile/archive/1.6.8.tar.gz +Source9: https://github.com/makedumpfile/makedumpfile/archive/1.7.0.tar.gz Source10: kexec-kdump-howto.txt Source12: mkdumprd.8 Source13: 98-kexec.rules @@ -38,6 +38,7 @@ Source32: 60-kdump.install Source33: kdump-logger.sh Source34: kdump-migrate-action.sh Source35: kdump-restart.sh +Source36: mkfadumprd ####################################### # These are sources for mkdumpramfs @@ -54,9 +55,14 @@ Source107: dracut-kdump-emergency.target Source108: dracut-early-kdump.sh Source109: dracut-early-kdump-module-setup.sh +Source200: dracut-fadump-init-fadump.sh +Source201: dracut-fadump-module-setup.sh + %ifarch ppc64 ppc64le Requires(post): servicelog +Recommends: keyutils %endif + Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units @@ -65,7 +71,7 @@ Requires: dracut >= 049-129 Requires: dracut-network >= 049 Requires: dracut-squash >= 049 Requires: ethtool -BuildRequires: zlib-devel zlib zlib-static elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel +BuildRequires: zlib-devel zlib zlib-static elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel BuildRequires: pkgconfig intltool gettext BuildRequires: systemd-units BuildRequires: automake autoconf libtool @@ -112,15 +118,13 @@ Patch610: kexec-tools-2.0.20-arm64-kexec-allocate-memory-space-avoiding-reserved Patch611: kexec-tools-2.0.20-arm64-kdump-deal-with-a-lot-of-resource-entries-in-p.patch Patch612: kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch Patch613: kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch +Patch614: kexec-tools-2.0.20-1-printk-add-support-for-lockless-ringbuffer.patch +Patch615: kexec-tools-2.0.20-2-printk-Use-ULL-suffix-for-64-bit-constants.patch +Patch616: kexec-tools-2.0.20-3-printk-Use-zu-to-format-size_t.patch # Patches 701 onward for makedumpfile Patch701: rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch -Patch702: kexec-tools-2.0.20-makedumpfile-Add-dry-run-option-to-prevent-writing.patch -Patch703: kexec-tools-2.0.20-makedumpfile-Add-shorthand-show-stats-option-to-show.patch -Patch704: kexec-tools-2.0.20-makedumpfile-Show-write-byte-size-in-report-messages.patch -Patch705: kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-finding-max_paddr.patch -Patch706: kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch %description kexec-tools provides /usr/sbin/kexec binary that facilitates a new @@ -149,12 +153,10 @@ tar -z -x -v -f %{SOURCE19} %patch611 -p1 %patch612 -p1 %patch613 -p1 +%patch614 -p1 +%patch615 -p1 +%patch616 -p1 %patch701 -p1 -%patch702 -p1 -%patch703 -p1 -%patch704 -p1 -%patch705 -p1 -%patch706 -p1 %ifarch ppc %define archdef ARCH=ppc @@ -184,8 +186,8 @@ cp %{SOURCE31} . make %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 make -C eppic/libeppic -make -C makedumpfile-1.6.8 LINKTYPE=dynamic USELZO=on USESNAPPY=on -make -C makedumpfile-1.6.8 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so +make -C makedumpfile-1.7.0 LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on +make -C makedumpfile-1.7.0 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so %endif %install @@ -218,6 +220,7 @@ SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu} install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd +install -m 755 %{SOURCE36} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 @@ -245,17 +248,18 @@ install -m 755 -D %{SOURCE32} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/60- %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 -install -m 755 makedumpfile-1.6.8/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile -install -m 644 makedumpfile-1.6.8/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz -install -m 644 makedumpfile-1.6.8/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz -install -m 644 makedumpfile-1.6.8/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample -install -m 755 makedumpfile-1.6.8/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so +install -m 755 makedumpfile-1.7.0/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile +install -m 644 makedumpfile-1.7.0/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz +install -m 644 makedumpfile-1.7.0/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz +install -m 644 makedumpfile-1.7.0/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample +install -m 755 makedumpfile-1.7.0/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.8/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ +install -m 644 makedumpfile-1.7.0/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ %endif %define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g') %define remove_dracut_early_kdump_prefix() %(echo -n %1|sed 's/.*dracut-early-kdump-//g') +%define remove_dracut_fadump_prefix() %(echo -n %1|sed 's/.*dracut-fadump-//g') # deal with dracut modules mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase @@ -274,6 +278,13 @@ cp %{SOURCE108} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlyk cp %{SOURCE109} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}} chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}} chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}} +%ifarch ppc64 ppc64le +mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit +cp %{SOURCE200} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE200}} +cp %{SOURCE201} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE201}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE200}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE201}} +%endif %define dracutlibdir %{_prefix}/lib/dracut @@ -288,7 +299,7 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d touch /etc/kdump.conf %ifarch ppc64 ppc64le -servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh +servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin %endif @@ -363,6 +374,7 @@ done /usr/sbin/kexec /usr/sbin/makedumpfile /usr/sbin/mkdumprd +/usr/sbin/mkfadumprd /usr/sbin/vmcore-dmesg %{_bindir}/* %{_datadir}/kdump @@ -406,6 +418,47 @@ done %endif %changelog +* Thu Jan 27 2022 Pingfan Liu - 2.0.20-68 +- Revert "Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel" + +* Fri Dec 24 2021 Pingfan Liu - 2.0.20-67 +- Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel + +* Fri Dec 10 2021 Pingfan Liu - 2.0.20-66 +- kdump/ppc64: suppress the error message "Could not find a registered notification tool" from servicelog_notify +- Enable zstd compression for makedumpfile in kexec-tools.spec + +* Thu Dec 2 2021 Pingfan Liu - 2.0.20-65 +- mkdumprd: drop mountaddr/mountproto nfs mount options + +* Fri Nov 26 2021 Pingfan Liu - 2.0.20-64 +- add keytuils as a weak dependency for POWER + +* Fri Nov 19 2021 Pingfan Liu - 2.0.20-63 +- Document/kexec-kdump-howto.txt: fix escape + +* Wed Nov 17 2021 Pingfan Liu - 2.0.20-62 +- Document/kexec-kdump-howto.txt: improve notes for kdump_pre and kdump_post scripts + +* Tue Nov 9 2021 Pingfan Liu - 2.0.20-61 +- rebase makedumpfile to 1.7.0 + +* Fri Oct 22 2021 Pingfan Liu - 2.0.20-60 +- fadump-init: clean up mount points properly +- fadump: kdumpctl should check the modules used by the fadump initramfs +- fadump: isolate fadump initramfs image within the default one +- mkdumprd: Use xz for squash image compression + +* Mon Oct 18 2021 Pingfan Liu - 2.0.20-59 +- makedumpfile: printk: use committed/finalized state values +- makedumpfile: printk: add support for lockless ringbuffer +- kexec-tools: printk: Use %zu to format size_t +- kexec-tools: printk: Use ULL suffix for 64-bit constants +- kexec-tools: printk: add support for lockless ringbuffer + +* Sun Oct 17 2021 Pingfan Liu - 2.0.20-58 +- kdumpctl: fix fragile loops over find output + * Fri Aug 27 2021 Pingfan Liu - 2.0.20-57 - kdumpctl: enable secure boot on ppc64le LPARs