Commit Graph

102 Commits

Author SHA1 Message Date
Coiby Xu
e120508100 Don't try to update crashkernel when bootloader is not installed
Resolves: bz2060319
Upstream: Fedora
Conflict: commit a3da46d6 ("Skip reset_crashkernel_after_update
          during package install") hasn't been backported. Note it's now
          no longer needed.

commit 5951b5e268
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Dec 20 13:59:18 2022 +0800

    Don't try to update crashkernel when bootloader is not installed

    Currently when using anaconda to install the OS, the following errors
    occur,

        INF packaging: Configuring (running scriptlet for): kernel-core-5.14.0-70.el9.x86_64 ...
        INF dnf.rpm: grep: /boot/grub2/grubenv: No such file or directory
        grep: /boot/grub2/grubenv: No such file or directory
        grep: /boot/grub2/grubenv: No such file or directory
        grep: /boot/grub2/grubenv: No such file or directory
        ...
        INF packaging: Configuring (running scriptlet for): kexec-tools-2.0.23-9.el9.x86_64 ...
        INF dnf.rpm: grep: /boot/grub2/grubenv: No such file or directory
        grep: /boot/grub2/grubenv: No such file or directory
        grep: /boot/grub2/grubenv: No such file or directory

    Or for s390, the following errors occur,

        INF packaging: Configuring (running scriptlet for): kernel-core-5.14.0-71.el9.s390x ...
        03:37:51,232 INF dnf.rpm: grep: /etc/zipl.conf: No such file or directory
        grep: /etc/zipl.conf: No such file or directory
        grep: /etc/zipl.conf: No such file or directory

        INF packaging: Configuring (running scriptlet for): kexec-tools-2.0.23-9_1.el9_0.s390x ...
        INF dnf.rpm: grep: /etc/zipl.conf: No such file or directory

    This is because when anaconda installs the packages, bootloader hasn't
    been installed and /boot/grub2/grubenv or /etc/zipl.conf doesn't exist.
    So don't try to update crashkernel when bootloader isn't ready to avoid
    the above errors.

    Note this is the second attempt to fix this issue. Previously a file
    /tmp/kexec_tools_package_install was created to avoid running the
    related code thus to avoid the above errors but unfortunately that
    approach has two issues a) somehow osbuild doesn't delete it for RHEL b)
    this file could still exist if users manually remove kexec-tools.

    Fixes: e218128 ("Only try to reset crashkernel for osbuild during package install")
    Reported-by: Jan Stodola <jstodola@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-12-27 03:11:43 +00:00
Lichen Liu
fb93b28df8 fadump: add a kernel install hook to clean up fadump initramfs
Resolves: bz2139000
Upstream: Fedora
Conflict: Upstream doesn't have Source37: supported-kdump-targets.txt,
so the number of SourceXX need to be changed.

commit 4a2dcab26a
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Fri Dec 2 18:46:51 2022 +0530

    fadump: add a kernel install hook to clean up fadump initramfs

    Kdump service will create fadump initramfs when needed, but it won't
    clean up the fadump initramfs on kernel uninstall. So create a kernel
    install hook to do the clean up job.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2022-12-22 14:36:23 +08:00
Lichen Liu
bfe235b413 spec: only install mkfadumprd for ppc
Resolves: bz2139000
Upstream: Fedora
Conflict: None

commit 748eb3a2a6
Author: Kairui Song <kasong@tencent.com>
Date:   Sun Jan 9 18:03:35 2022 +0800

    spec: only install mkfadumprd for ppc

    fadump is a ppc only feature, mkfadumprd is only needed for fadump, drop
    it for other arch.

    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Kairui Song <kasong@tencent.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2022-12-22 14:36:23 +08:00
Tao Liu
dc26e4b45e Release 2.0.25-9
Related: bz2085347
Resolves: bz2151832

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-12-19 12:23:58 +08:00
Tao Liu
243717f988 Release 2.0.25-8
Resolves: bz2145087
Resolves: bz2141536
Resolves: bz2078460

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-12-07 16:45:25 +08:00
Coiby Xu
d88a4a1402 kexec-tools: ppc64: remove rma_top limit
Resolves: bz2145087
Conflict: None

commit 6b6187f546f0ddad8ea84d22c3f7ad72133dcfe3
Author: Sourabh Jain <sourabhjain@linux.ibm.com>
Date:   Thu Sep 15 14:12:40 2022 +0530

    ppc64: remove rma_top limit

    Restricting kexec tool to allocate hole for kexec segments below 768MB
    may not be relavent now since first memory block size can be 1024MB and
    more.

    Removing rma_top restriction will give more space to find holes for
    kexec segments and existing in-place checks make sure that kexec segment
    allocation doesn't cross the first memory block because every kexec segment
    has to be within first memory block for kdump kernel to boot properly.

    Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@kernel.org>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-12-06 11:01:48 +08:00
Pingfan Liu
aa204a3b63 kdump.conf: use a simple generator script to maintain
Resolves: bz2078460
Upstream: Fedora

commit 787b041aab
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Nov 15 12:00:09 2022 +0800

    kdump.conf: use a simple generator script to maintain

    This commit has the same motivation as the commit 677da8a "sysconfig:
    use a simple generator script to maintain".

    At present, only the kdump.conf generated for s390x has a slight
    difference from the other arches, where the core_collector asks the
    makedumpfile to use "-c" option to compress dump data by each page using
    zlib, which is more efficient than lzo on s390x.

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2022-12-01 11:01:17 +08:00
Tao Liu
576b8fa374 Release 2.0.25-7
Resolves: bz2076416

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-11-25 14:46:56 +08:00
Tao Liu
0459f68dcc Release 2.0.25-6
Resolves: bz2076416

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-11-24 11:27:37 +08:00
Tao Liu
812f2c967f Release 2.0.25-5
Resolves: bz2083475

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-11-11 13:25:21 +08:00
Tao Liu
cd64a1a851 Release 2.0.25-4
Resolves: bz2120914
Resolves: bz2076206
Resolves: bz2133129
Resolves: bz2060319
Resolves: bz2048690

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-11-01 11:10:13 +08:00
Tao Liu
557230d1e8 Rebase makedumpfile to 1.7.2
Resolves: bz2120914

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-11-01 11:04:23 +08:00
Coiby Xu
a9968490a2 Only try to reset crashkernel for osbuild during package install
Resolves: bz2060319
Upstream: Fedora
Conflict: None

commit e218128e28
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Sep 8 14:30:02 2022 +0800

    Only try to reset crashkernel for osbuild during package install

    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2060319

    Currently, kexec-tools tries to reset crashkernel when using anaconda to
    install the system. But grubby isn't ready and complains that,
      10:33:17,631 INF packaging: Configuring (running scriptlet for): kernel-core-5.14.0-70.el9.x86_64 1645746534 03dcd32db234b72440ee6764d59b32347c5f0cd98ac3fb55beb47214a76f33b4
      10:34:16,696 INF dnf.rpm: grep: /boot/grub2/grubenv: No such file or directory
      grep: /boot/grub2/grubenv: No such file or directory

    We only need to try resetting crashkernel for osbuild. Skip it for other
    cases. To tell if it's package install instead of package upgrade, make
    use of %pre to write a file /tmp/kexec-tools-install when "$1 == 1" [1].

    [1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax

    Reported-by: Jan Stodola <jstodola@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Lichen Liu <lichenliu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-10-27 14:47:57 +08:00
Coiby Xu
b1b95d234b Prefix reset-crashkernel-{for-installed_kernel,after-update} with underscore
Resolves: bz2048690
Upstream: Fedora
Conflict: None

commit a7ead187a4
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Sep 8 14:08:42 2022 +0800

    Prefix reset-crashkernel-{for-installed_kernel,after-update} with underscore

    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2048690

    To indicate they are for internal use only, underscore them.

    Reported-by: rcheerla@redhat.com
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Lichen Liu <lichenliu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-10-27 14:47:57 +08:00
Coiby Xu
a091409f10 use /run/ostree-booted to tell if scriptlet is running on OSTree system
Related: bz2048690
Upstream: Fedora
Conflict: None

commit f6bcd819fc
Author: Coiby Xu <coxu@redhat.com>
Date:   Fri Jul 15 15:11:44 2022 +0800

    use /run/ostree-booted to tell if scriptlet is running on OSTree system

    Resolves: bz2092012

    According to the ostree team [1], the existence of /run/ostree-booted
    > is the most stable way to signal/check that a system has been
    > booted in ostree-style.  It is also used by rpm-ostree at
    > compose/install time in the sandboxed environment where scriptlets run,
    > in order to signal that the package is being installed/composed into
    > an ostree commit (i.e. not directly on a live system).  See
    > 8ddf5f40d9/src/libpriv/rpmostree-scripts.cxx (L350-L353)
    > for reference.

    By checking the existence of /run/ostree-booted, we could skip trying to
    update kernel cmdline during OSTree compose time.

    [1] https://bugzilla.redhat.com/show_bug.cgi?id=2092012#c3

    Reported-by: Luca BRUNO <lucab@redhat.com>
    Suggested-by: Luca BRUNO <lucab@redhat.com>
    Fixes: 0adb0f4 ("try to reset kernel crashkernel when kexec-tools updates the default crashkernel value")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Acked-by: Timothée Ravier <siosm@fedoraproject.org>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-10-27 14:47:57 +08:00
Tao Liu
1d4de1f185 Release 2.0.25-3
Resolves: bz2085347
Resolves: bz2045949
Resolves: bz2044804

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-10-26 15:47:38 +08:00
Tao Liu
b5a9e54629 Seperate dracut and dracut-squash compressor for zstd
Upstream: fedora
Resolves: bz2045949
Resolves: bz2044804
Conflict: none

commit fc1c79ffd2
Author: Tao Liu <ltao@redhat.com>
Date:   Sat Oct 8 12:09:08 2022 +0800

    Seperate dracut and dracut-squash compressor for zstd

    Previously kexec-tools will pass "--compress zstd" to dracut. It
    will make dracut to decide whether: a) call mksquashfs to make a
    zstd format squash-root.img, b) call cmd zstd to make a initramfs.

    Since dracut(>= 057) has decoupled the compressor for dracut and
    dracut-squash, So in this patch, we will pass the compressor seperately.

    Note:

    The is_squash_available && !dracut_has_option --squash-compressor
    && !is_zsdt_command_available case is left unprocessed on purpose.

    Actually, the situation when we want to call zstd compression is:
    1) If squash function OK, we want dracut to invoke mksquashfs to make
    a zstd format squash-root.img within initramfs.
    2) If squash function is not OK, and cmd zstd presents, we want dracut
    to invoke cmd zstd to make a zstd format initramfs.

    is_zstd_command_available check can handle case 2 completely.

    However, for the is_squash_available check, it cannot handle case 1
    completely. It only checks if the kernel supports squashfs, it doesn't
    check whether the squash module has been added by dracut when making
    initramfs. In fact, in kexec-tools we are unable to do the check,
    there are multiple ways to forbit dracut to load a module, such as
    "dracut -o module" and "omit_dracutmodules in dracut.conf".

    When squash dracut module is omitted, is_squash_available check will
    still pass, so "--compress zstd" will be appended to dracut cmdline,
    and it will call cmd zstd to do the compression. However cmd zstd may
    not exist, so it fails.

    The previous "--compress zstd" is ambiguous, after the intro of
    "--squash-compressor", "--squash-compressor" only effect for
    mksquashfs and "--compress" only effect for specific cmd.

    So for the is_squash_available && !dracut_has_option
    --squash-compressor && !is_zsdt_command_available case, we just leave
    it to be handled the default way.

    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-10-26 10:16:16 +08:00
Tao Liu
8b72bcfbab Release 2.0.25-2
Resolves: bz2090534
Resolves: bz2129842

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-10-17 13:34:00 +08:00
Tao Liu
5f3d92c802 Release 2.0.25-1
Resolves: bz2120916
Resolves: bz2104534
Resolves: bz2089871
Resolves: bz2111857

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-09-21 10:17:22 +08:00
Coiby Xu
928c386f97 Allow to update kexec-tools using virt-customize for cloud base image
Resolves: bz2089871
Upstream: Fedora
Conflict: None

commit da0ca0d205
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Jun 28 14:38:28 2022 +0800

    Allow to update kexec-tools using virt-customize for cloud base image

    Resolves: bz2089871

    Currently, kexec-tools can't be updated using virt-customize because
    older version of kdumpctl can't acquire instance lock for the
    get-default-crashkernel subcommand. The reason is /var/lock is linked to
    /run/lock which however doesn't exist in the case of virt-customize.

    This patch fixes this problem by using /tmp/kdump.lock as the lock
    file if /run/lock doesn't exist.

    Note
    1. The lock file is now created in /run/lock instead of /var/run/lock since
       Fedora has adopted adopted /run [2] since F15.
    2. %pre scriptlet now always return success since package update won't
       be blocked

    [1] https://fedoraproject.org/wiki/Features/var-run-tmpfs

    Fixes: 0adb0f4 ("try to reset kernel crashkernel when kexec-tools updates the default crashkernel value")

    Reported-by: Nicolas Hicher <nhicher@redhat.com>
    Suggested-by: Laszlo Ersek <lersek@redhat.com>
    Suggested-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-09-19 09:10:54 +08:00
Tao Liu
c9bdde4cfb Release 2.0.24-5
Resolves: bz2076425

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-07-12 09:57:55 +08:00
Tao Liu
a743eaeded Release 2.0.24-4
Resolves: bz2041729
Resolves: bz2096132

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-06-15 13:05:39 +08:00
Tao Liu
9daddc7878 Release 2.0.24-3
Resolves: bz2090533

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-06-07 09:45:44 +08:00
Tao Liu
ba836a59b2 Release 2.0.24-2
Resolves: bz2059492
Resolves: bz2073676
Resolves: bz2074473

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-05-23 14:34:43 +08:00
Tao Liu
23f151d7b5 Release 2.0.24-1
Resolves: bz2081323
Resolves: bz2076159
Resolves: bz2076157

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-05-05 16:07:27 +08:00
Tao Liu
d180b099fd Rebase kexec-tools to v2.0.24
Resolves: bz2076157

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-05-05 16:04:09 +08:00
Tao Liu
b5d4920e52 Rebase makedumpfile to 1.7.1
Resolves: bz2076159

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-05-05 15:46:44 +08:00
Philipp Rudo
6348884a9d Avoid false-positive mem_section validation with vmlinux
Resolves: bz2081323
Upstream: github.com/makedumpfile/makedumpfile.git
Conflicts: None

commit 6d0d95ecc04a70f8448d562ff0fbbae237f5c929
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
Date:   Thu Apr 21 08:58:29 2022 +0900

    [PATCH] Avoid false-positive mem_section validation with vmlinux

    Currently get_mem_section() validates if SYMBOL(mem_section) is the address
    of the mem_section array first.  But there was a report that the first
    validation wrongly returned TRUE with -x vmlinux and SPARSEMEM_EXTREME
    (4.15+) on s390x.  This leads to crash failing statup with the following
    seek error:

      crash: seek error: kernel virtual address: 67fffc2800  type: "memory section root table"

    Skip the first validation when satisfying the conditions.

    Reported-by: Dave Wysochanski <dwysocha@redhat.com>
    Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
    Reviewed-and-Tested-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-05-03 14:47:29 +02:00
Tao Liu
aab4b79f41 Release 2.0.23-10
Resolves: bz2060774
Resolves: bz2060824
Resolves: bz2069200

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-04-08 15:26:19 +08:00
Philipp Rudo
673f93346e s390: add support for --reuse-cmdline
Resolves: bz2060824
Upstream: git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflicts: None

commit 2e1ec106dc5aac951ba884ebe4cca036e9a2d45f
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Thu Dec 16 12:43:56 2021 +0100

    s390: add support for --reuse-cmdline

    --reuse-cmdline reads the command line of the currently
    running kernel from /proc/cmdline and uses that for the
    kernel that should be kexec'd.

    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-04-06 18:05:47 +02:00
Philipp Rudo
1ac74b6d66 use slurp_proc_file() in get_command_line()
Resolves: bz2060824
Upstream: git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflicts: None

commit d6516ba4c88f217fe14455db92c60cd0e9af18f8
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Thu Dec 16 12:43:55 2021 +0100

    use slurp_proc_file() in get_command_line()

    This way the size of the command line that get_command_line() can handle
    is no longer fixed.

    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-04-06 18:05:47 +02:00
Philipp Rudo
9e3d3bc043 add slurp_proc_file()
Resolves: bz2060824
Upstream: git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflicts: None

commit 193e51deccc62544f6423eb5e5eefc8a23aad679
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Thu Dec 16 12:43:54 2021 +0100

    add slurp_proc_file()

    slurp_file() cannot be used to read proc files, as they are returning
    a size of zero in stat(). Add a function slurp_proc_file() which is
    similar to slurp_file(), but doesn't require the size of the file to
    be known.

    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-04-06 18:05:47 +02:00
Philipp Rudo
f8e3f42ec1 s390: use KEXEC_ALL_OPTIONS
Resolves: bz2060824
Upstream: git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflicts: None

commit 91a3d0e00a5c18ee9bdd2c6c03ac64a6471e2559
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Thu Dec 16 12:43:53 2021 +0100

    s390: use KEXEC_ALL_OPTIONS

    KEXEC_ALL_OPTIONS could be used instead defining the same
    array several times. This makes code easier to maintain when
    new options are added.

    Suggested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-04-06 18:05:47 +02:00
Philipp Rudo
5c6595e4c0 s390: add variable command line size
Resolves: bz2060824
Upstream: git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflicts: None

commit defb80a20bf1e4d778596ce2447e19d44f31ae5a
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Thu Dec 16 12:43:52 2021 +0100

    s390: add variable command line size

    Newer s390 kernels support a command line size longer than 896
    bytes. Such kernels contain a new member in the parameter area,
    which might be utilized by tools like kexec. Older kernels have
    the location initialized to zero, so we check whether there's a
    non-zero number present and use that. If there isn't, we fallback
    to the legacy command line size of 896 bytes.

    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-04-06 18:05:47 +02:00
Philipp Rudo
574a202f62 util_lib/elf_info: harden parsing of printk buffer
Resolves: bz2069200
Upstream: git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflicts: None

commit f4c59879b830c7d574a953e6ce970ddaf20910d7
Author: Philipp Rudo <prudo@redhat.com>
Date:   Wed Mar 23 16:35:36 2022 +0100

    util_lib/elf_info: harden parsing of printk buffer

    The old printk mechanism (> v3.5.0 and < v5.10.0) had a fixed size
    buffer (log_buf) that contains all messages. The location for the next
    message is stored in log_next_idx. In case the log_buf runs full
    log_next_idx wraps around and starts overwriting old messages at the
    beginning of the buffer. The wraparound is denoted by a message with
    msg->len == 0.

    Following the behavior described above blindly is dangerous as e.g. a
    memory corruption could overwrite (parts of) the log_buf. If the
    corruption adds a message with msg->len == 0 this leads to an endless
    loop when dumping the dmesg. Fix this by verifying that not wrapped
    around before when it encounters a message with msg->len == 0.

    While at it also verify that the index is within the log_buf and thus
    guard against corruptions with msg->len != 0.

    The same bug has been reported and fixed in makedumpfile [1].

    [1] http://lists.infradead.org/pipermail/kexec/2022-March/024272.html

    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-03-28 19:20:45 +02:00
Philipp Rudo
7620d676de print error when reading with unsupported compression
Resolves: bz2069200
Upstream: github.com/makedumpfile/makedumpfile.git
Conflicts: goto out_error --> return FALSE
	   due to missing 64b5b29 ("[PATCH 03/15] remove variable length
	   array in readpage_kdump_compressed()")

commit 5035c0821f07da3badda645cd0064d4b80e1667d
Author: Philipp Rudo <prudo@redhat.com>
Date:   Mon Mar 14 17:04:32 2022 +0100

    [PATCH] print error when reading with unsupported compression

    Currently makedumpfile only checks if the required compression algorithm
    was enabled during build when compressing a dump but not when reading
    from one. This can lead to situations where, one version of makedumpfile
    creates the dump using a compression algorithm an other version of
    makedumpfile doesn't support. When the second version now tries to, e.g.
    extract the dmesg from the dump it will fail with an error similar to

      # makedumpfile --dump-dmesg vmcore dmesg.txt
      __vtop4_x86_64: Can't get a valid pgd.
      readmem: Can't convert a virtual address(ffffffff92e18284) to physical address.
      readmem: type_addr: 0, addr:ffffffff92e18284, size:390
      check_release: Can't get the address of system_utsname.

      makedumpfile Failed.

    That's because readpage_kdump_compressed{_parallel} does not return
    with an error if the page it is trying to read is compressed with an
    unsupported compression algorithm. Thus readmem copies random data from
    the (uninitialized) cachebuf to its caller and thus causing the error
    above.

    Fix this by checking if the required compression algorithm is supported
    in readpage_kdump_compressed{_parallel} and print a proper error message
    if it isn't.

    Reported-by: Dave Wysochanski <dwysocha@redhat.com>
    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com>
    Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-03-28 19:19:43 +02:00
Philipp Rudo
fb25c11f79 use cycle detection when parsing the prink log_buf
Resolves: bz2069200
Upstream: github.com/makedumpfile/makedumpfile.git
Conflicts: None

commit 68d120b30af5e930afafed81e79712af3c1a278c
Author: Philipp Rudo <prudo@redhat.com>
Date:   Mon Mar 14 17:04:31 2022 +0100

    [PATCH v2 3/3] use cycle detection when parsing the prink log_buf

    The old printk mechanism (> v3.5.0 and < v5.10.0) had a fixed size
    buffer (log_buf) that contains all messages. The location for the next
    message is stored in log_next_idx. In case the log_buf runs full
    log_next_idx wraps around and starts overwriting old messages at the
    beginning of the buffer. The wraparound is denoted by a message with
    msg->len == 0.

    Following the behavior described above blindly in makedumpfile is
    dangerous as e.g. a memory corruption could overwrite (parts of) the
    log_buf. If the corruption adds a message with msg->len == 0 this leads
    to an endless loop when dumping the dmesg with makedumpfile appending
    the messages up to the corruption over and over again to the output file
    until file system is full. Fix this by using cycle detection and aboard
    once one is detected.

    While at it also verify that the index is within the log_buf and thus
    guard against corruptions with msg->len != 0.

    Reported-by: Audra Mitchell <aubaker@redhat.com>
    Suggested-by: Dave Wysochanski <dwysocha@redhat.com>
    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-03-28 18:39:31 +02:00
Philipp Rudo
92f7d2ba5e use pointer arithmetics for dump_dmesg
Resolves: bz2069200
Upstream: github.com/makedumpfile/makedumpfile.git
Conflicts: None

commit e1d2e5302b016c6f7942f46ffa27aa31326686c5
Author: Philipp Rudo <prudo@redhat.com>
Date:   Mon Mar 14 17:04:30 2022 +0100

    [PATCH v2 2/3] use pointer arithmetics for dump_dmesg

    When parsing the printk buffer for the old printk mechanism (> v3.5.0+ and
    < 5.10.0) a log entry is currently specified by the offset into the
    buffer where the entry starts. Change this to use a pointers instead.
    This is done in preparation for using the new cycle detection mechanism.

    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com>
    Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-03-28 18:39:04 +02:00
Philipp Rudo
90da030e61 add generic cycle detection
Resolves: bz2069200
Upstream: github.com/makedumpfile/makedumpfile.git
Conflicts: None

commit feae3d1754d2b0788ce1f18b0cd4b40098ff52ff
Author: Philipp Rudo <prudo@redhat.com>
Date:   Mon Mar 14 17:04:29 2022 +0100

    [PATCH v2 1/3] add generic cycle detection

    In order to work makedumpfile needs to interpret data read from the
    dump. This can cause problems as the data from the dump cannot be
    trusted (otherwise the kernel wouldn't have panicked in the first
    place). This also means that every loop which stop condition depend on
    data read from the dump has a chance to loop forever. Thus add a generic
    cycle detection mechanism that allows to detect and handle such
    situations appropriately.

    For cycle detection use Brent's algorithm [1] as it has constant memory
    usage. With this it can also be used in the kdump kernel without the
    danger that it runs oom when iterating large data structures.
    Furthermore it only depends on some pointer arithmetic. Thus the
    performance impact (as long as no cycle was detected) should be
    comparatively small.

    [1] https://en.wikipedia.org/wiki/Cycle_detection#Brent's_algorithm

    Suggested-by: Dave Wysochanski <dwysocha@redhat.com>
    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-03-28 18:38:30 +02:00
Tao Liu
1eadf2b8a8 Release 2.0.23-9
Resolves: bz2055498

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-02-25 09:58:26 +08:00
Tao Liu
6e2f52ede1 makedumpfile: sadump, kaslr: fix failure of calculating kaslr_offset
upstream: fedora
resolves: bz2055498
conflict: none

commit 59b1726fbcc251155140c8a1972384498fee4daf
Author: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date:   Tue Jan 25 12:55:15 2022 +0000

    [PATCH] sadump, kaslr: fix failure of calculating kaslr_offset

    On kernels v5.8 or later, makedumpfile fails for memory dumps in the
    sadump-related formats as follows:

        # makedumpfile -f -l -d 31 -x ./vmlinux /dev/sdd4 /root/vmcore-ld31
        __vtop4_x86_64: Can't get a valid pud_pte.
        ...110 lines of the same message...
        __vtop4_x86_64: Can't get a valid pud_pte.
        calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0
        readmem: type_addr: 1, addr:ffffffff85411858, size:8
        __vtop4_x86_64: Can't get pgd (page_dir:ffffffff85411858).
        readmem: Can't convert a virtual address(ffffffff059be980) to physical address.
        readmem: type_addr: 0, addr:ffffffff059be980, size:1024
        cpu_online_mask_init: Can't read cpu_online_mask memory.

        makedumpfile Failed.

    This is caused by the kernel commit 9d06c4027f21 ("x86/entry: Convert
    Divide Error to IDTENTRY") that renamed divide_error to
    asm_exc_divide_error, breaking logic for calculating kaslr offset.

    Fix this by adding initialization of asm_exc_divide_error.

    Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-02-25 09:53:51 +08:00
Tao Liu
c19658357d Release 2.0.23-8
Resolves: bz2051822

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-02-21 10:37:44 +08:00
Coiby Xu
06b51aac41 update kernel crashkernel in posttrans RPM scriptlet when updating kexec-tools
Resolves: bz2051822
Upstream: Fedora
Conflict: None

commit 311b5b100b
Author: Coiby Xu <coxu@redhat.com>
Date:   Fri Feb 11 13:11:17 2022 +0800

    update kernel crashkernel in posttrans RPM scriptlet when updating kexec-tools

    When doing in-place upgrading using leapp on x86_64, kdumpcl can't
    acquire instance lock when running in %post RPM scriplet on x86_64,
      localhost upgrade[1306]: /bin/kdumpctl: line 49: /var/lock/kdump: No such file or directory
      localhost upgrade[1306]: kdump: Create file lock failed

    and running "touch /var/lock/dkump" also fails with
    "No such file or directory". Thus kdumpctl can't be run in %post
    scriptlet. But kdumpctl can be run in %posttrans RPM scriplet.

    Besides, it's better to update crashkernel after the kernel has been
    updated. So let's update kernel crashkernel in the %posttrans
    scriptlet which will be run in the end of a transaction i.e. after
    the kernel has been updated.

    Note for %posttrans scriptlet, "$1 == 1" means both installing a new
    package and upgrading a package.

    [1] https://github.com/apptainer/singularity/issues/2386#issuecomment-474747054

    Reported-by: Jie Li <jieli@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-02-18 09:05:25 +08:00
Tao Liu
e2d1f68d0f Release 2.0.23-7
Related: bz1895258
Resolves: bz2024976

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-02-14 12:37:55 +08:00
Tao Liu
32276a35f2 Release 2.0.23-6
Resolves: bz2031736
Resolves: bz2017196
Resolves: bz2041911
Resolves: bz2017121
Resolves: bz2042726
Resolves: bz2045971
Resolves: bz2045969
Resolves: bz2024976

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-01-26 15:05:37 +08:00
Philipp Rudo
1362366c86 s390: handle R_390_PLT32DBL reloc entries in machine_apply_elf_rel()
Resolves: bz2041911
Upstream: git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflicts: None

commit 186e7b0752d8fce1618fa37519671c834c46340e
Author: Alexander Egorenkov <egorenar@linux.ibm.com>
Date:   Wed Dec 15 18:48:53 2021 +0100

    s390: handle R_390_PLT32DBL reloc entries in machine_apply_elf_rel()

    Starting with gcc 11.3, the C compiler will generate PLT-relative function
    calls even if they are local and do not require it. Later on during linking,
    the linker will replace all PLT-relative calls to local functions with
    PC-relative ones. Unfortunately, the purgatory code of kexec/kdump is
    not being linked as a regular executable or shared library would have been,
    and therefore, all PLT-relative addresses remain in the generated purgatory
    object code unresolved. This in turn lets kexec-tools fail with
    "Unknown rela relocation: 0x14 0x73c0901c" for such relocation types.

    Furthermore, the clang C compiler has always behaved like described above
    and this commit should fix the purgatory code built with the latter.

    Because the purgatory code is no regular executable or shared library,
    contains only calls to local functions and has no PLT, all R_390_PLT32DBL
    relocation entries can be resolved just like a R_390_PC32DBL one.

    * https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries/x1633.html#AEN1699

    Relocation entries of purgatory code generated with gcc 11.3
    ------------------------------------------------------------

    $ readelf -r purgatory/purgatory.o

    Relocation section '.rela.text' at offset 0x6e8 contains 27 entries:
      Offset          Info           Type           Sym. Value    Sym. Name + Addend
    00000000000c  000300000013 R_390_PC32DBL     0000000000000000 .data + 2
    00000000001a  001000000014 R_390_PLT32DBL    0000000000000000 sha256_starts + 2
    000000000030  001100000014 R_390_PLT32DBL    0000000000000000 sha256_update + 2
    000000000046  001200000014 R_390_PLT32DBL    0000000000000000 sha256_finish + 2
    000000000050  000300000013 R_390_PC32DBL     0000000000000000 .data + 102
    00000000005a  001300000014 R_390_PLT32DBL    0000000000000000 memcmp + 2
    ...
    000000000118  001600000014 R_390_PLT32DBL    0000000000000000 setup_arch + 2
    00000000011e  000300000013 R_390_PC32DBL     0000000000000000 .data + 2
    00000000012c  000f00000014 R_390_PLT32DBL    0000000000000000 verify_sha256_digest + 2
    000000000142  001700000014 R_390_PLT32DBL    0000000000000000
    post_verification[...] + 2

    Relocation entries of purgatory code generated with gcc 11.2
    ------------------------------------------------------------

    $ readelf -r purgatory/purgatory.o

    Relocation section '.rela.text' at offset 0x6e8 contains 27 entries:
      Offset          Info           Type           Sym. Value    Sym. Name + Addend
    00000000000e  000300000013 R_390_PC32DBL     0000000000000000 .data + 2
    00000000001c  001000000013 R_390_PC32DBL     0000000000000000 sha256_starts + 2
    000000000036  001100000013 R_390_PC32DBL     0000000000000000 sha256_update + 2
    000000000048  001200000013 R_390_PC32DBL     0000000000000000 sha256_finish + 2
    000000000052  000300000013 R_390_PC32DBL     0000000000000000 .data + 102
    00000000005c  001300000013 R_390_PC32DBL     0000000000000000 memcmp + 2
    ...
    00000000011a  001600000013 R_390_PC32DBL     0000000000000000 setup_arch + 2
    000000000120  000300000013 R_390_PC32DBL     0000000000000000 .data + 122
    000000000130  000f00000013 R_390_PC32DBL     0000000000000000 verify_sha256_digest + 2
    000000000146  001700000013 R_390_PC32DBL     0000000000000000 post_verification[...] + 2

    Corresponding s390 kernel discussion:
    * https://lore.kernel.org/linux-s390/20211208105801.188140-1-egorenar@linux.ibm.com/T/#u

    Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
    Reported-by: Tao Liu <ltao@redhat.com>
    Suggested-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    [hca@linux.ibm.com: changed commit message as requested by Philipp Rudo]
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2022-01-19 10:35:02 +01:00
Pingfan Liu
4bc3baa72f spec: add hostname.rpm into Recommends list
Resolves: bz2017196
Upstream: Fedora
Conflict: None

commit c480be7ccf
Author: Pingfan Liu <piliu@redhat.com>
Date:   Wed Jan 12 19:24:26 2022 +0800

    spec: add hostname.rpm into Recommends list

    kexec-tools runs hostname binary in the case of fence_kdump. Since this
    is a trival dependency and should not block the kexec-tools installation
    if non-existent, using weak-dependency to resolve it.

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2022-01-18 15:16:39 +08:00
Tao Liu
84fc25737e Release 2.0.23-5
resolves: bz1896698
resolves: bz1895258

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-01-11 10:07:07 +08:00
Tao Liu
a501dcbd7b Set zstd as recommented for kexec-tools
resolves: bz1896698
upstream: fedora
conflict: none

commit b8ec5cbda89610244fdd4711e5974350f78e63e3
Author: Tao Liu <ltao@redhat.com>
Date:   Fri Jan 7 19:47:06 2022 +0800

    Set zstd as recommented for kexec-tools

    This patch will make zstd as recommended instead of required for
    kexec-tools. If zstd command/package is unavaliable, it can failback to invoke
    gzip when making kdump initramfs.

    Fixes: 0311f6e ("Set zstd as the default compression method for kdump initrd")

    Signed-off-by: Tao Liu <ltao@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-01-11 10:02:52 +08:00
Coiby Xu
d91054f2d3 use grep -s to suppress error messages about nonexistent or unreadable files
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit d5c31605f3
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Jan 6 09:48:17 2022 +0800

    use grep -s to suppress error messages about nonexistent or unreadable files

    When a file doesn't exist or isn't readable, grep complains as follows,

    grep: /proc/cmdline: No such file or directory
    grep: /etc/kernel/cmdline: No such file or directory

    /proc/cmdline doesn't exist when installing package for an OS image and
    /etc/kernel/cmdline may not exist if osbuild doesn't want set custom
    kernel cmdline.

    Use "-s" to suppress the error messages.

    Fixes: 0adb0f4 ("try to reset kernel crashkernel when kexec-tools updates the default crashkernel value")
    Fixes: ddd428a ("set up kernel crashkernel for osbuild in kernel hook")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-07 12:30:52 +08:00