Commit Graph

186 Commits

Author SHA1 Message Date
Tao Liu
9a937b5e22 kdump-lib.sh: use kdump_get_conf_val to read config values
upstream: fedora
resolves: bz2003832
conflict: none

commit ab1ef78aa2
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 01:18:48 2021 +0800

    kdump-lib.sh: use kdump_get_conf_val to read config values

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

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:09:16 +08:00
Tao Liu
14205c1d6f kdump-lib.sh: add a config value retrive helper
upstream: fedora
resolves: bz2003832
conflict: none

commit 09ccf88405
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Aug 16 23:25:14 2021 +0800

    kdump-lib.sh: add a config value retrive helper
    Add a helper kdump_get_conf_val to replace get_option_value.

    It can help cover more corner cases in the code, like when there are
    multiple spaces in config file, config value separated by a tab,
    heading spaces, or trailing comments.

    And this uses "sed group command" and "sed hold buffer", make it much
    faster than previous `grep <config> | tail -1`.

    This helper is supposed to provide a universal way for kexec-tools
    scripts to read in config value. Currently, different scripts are
    reading the config in many different fragile ways.

    For example, following codes are found in kexec-tools script code base:
      1. grep ^force_rebuild $KDUMP_CONFIG_FILE
	 echo $_force_rebuild | cut -d' '  -f2

      2. grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\  -f2

      3. awk '/^sshkey/ {print $2}' $conf_file

      4. grep ^path $KDUMP_CONFIG_FILE | cut -d' '  -f2-

    1, 2, and 4 will fail if the space is replaced by, e.g. a tab

    1 and 2 might fail if there are multiple spaces between config name
    and config value:
    "kdump_post  /var/crash/scripts/kdump-post.sh"
    A space will be read instead of config value.

    1, 2, 3 will fail if there are space in file path, like:
    "kdump_post /var/crash/scripts dir/kdump-post.sh"

    4 will fail if there are trailing comments:
    "path /var/crash # some comment here"

    And all will fail if there are heading space,
    " path /var/crash"

    And all will most likely cause problems if the config file contains
    the same option more than once.

    And all of them are slower than the new sed call. Old get_option_value
    is also very slow and doesn't handle heading space.

    Although we never claim to support heading space or tailing comments
    before, it's harmless to be more robust on config reading, and many
    conf files in /etc support heading spaces. And have a faster and
    safer config reading helper makes it easier to clean up the code.

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

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:08:50 +08:00
Tao Liu
67b8dd1cb8 kdump-lib.sh: add a config format and read helper
upstream: fedora
resolves: bz2003832
conflict: none

commit a0282ab22c
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Aug 3 19:49:51 2021 +0800

    kdump-lib.sh: add a config format and read helper

    Add a helper `kdump_read_conf` to replace read_strip_comments.
    `kdump_read_conf` does a few more things:

      - remove trailing spaces.
      - format the content, remove duplicated spaces between name and value.
      - read from KDUMP_CONFIG_FILE (/etc/kdump.conf) directly, avoid pasting
	"/etc/kdump.conf" path everywhere in the code.
      - check if config file exists, just in case.

    Also unify the environmental variable, now KDUMP_CONFIG_FILE stands for
    the default config location.

    This helps avoid some shell pitfalls about spaces when reading config.

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

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:08:22 +08:00
Tao Liu
45ebaec123 Add a .editorconfig file
upstream: fedora
resolves: bz2003832
conflict: none

commit bcb1176ec6
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 30 01:08:30 2021 +0800

    Add a .editorconfig file

    EditorConfig file is helpful for tools like `shfmt`, also could be a
    hint for code styling.

    The code style spec used in this new added .editorconfig file is
    generated based on existing code style.

    Following commits will make mkfadumprd, mkdumprd, kdumpctl, kdump-lib.sh,
    and *-module-setup.sh only be used in first kernel, so use bash syntax
    for these scripts. Other scripts will use sh syntax for better POSIX
    compatibility.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:06:56 +08:00
Tao Liu
7ccb7e18e7 Remove hard requirement on grubby
Resolves: bz2014626
Upstream: Fedora
Conflict: None

commit 7ddda7e6d0
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 18 22:25:22 2021 +0800

    Remove hard requirement on grubby

    Downgrade to "Recommends:" as suggested by CoreOS team.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Timothée Ravier <travier@redhat.com>
2021-10-28 13:26:19 +08:00
Tao Liu
c65278f12a Release 2.0.22-14
Resolves: bz1986667

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-09-08 14:11:53 +08:00
Tao Liu
220b190cd8 Add file supported-kdump-targets.txt to kexec-tools
Resolves: bz1986667
Copied from rhel-8.5

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-09-07 14:32:27 +08:00
Mohan Boddu
c1406d2cab Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
Signed-off-by: Mohan Boddu <mboddu@redhat.com>
2021-08-09 21:11:43 +00:00
Tao Liu
572dfb2ae8 Release 2.0.22-13
Resolves: bz1986250

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-08-09 09:56:52 +08:00
Kairui Song
f3db4acbcf Clear old crashkernl=auto in comment and doc
Resolves: bz1986250
Upstream: Fedora

commit 097059dedc
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 30 14:40:45 2021 +0800

    Clear old crashkernl=auto in comment and doc

    Acked-by: Pingfan Liu <piliu@redhat.com>
    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-08-06 01:33:34 +00:00
Tao Liu
a42016ff19 Release 2.0.22-12
Resolves: bz1981684
Resolves: bz1986281

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-08-02 10:31:39 +08:00
Kairui Song
6cc04b5313 kdumpctl: fix a typo
Resolves: bz1981684
Conflict: Minor conflict resolved easily
Upstream: Fedora

commit bcd8d6a47b
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Jul 15 03:08:28 2021 +0800

    kdumpctl: fix a typo

    Recommanded -> Recommended

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-30 09:21:21 +00:00
Kairui Song
abb0c38b7f kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default
Resolves: bz1986281
Conflict: None
Upstream: Fedora

commit 7b7ddaba88
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 2 01:31:26 2021 +0800

    kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default

    The new `crashkernel.default` file in kernel package can be used as the
    ck_cmdline source.

    Also keep the legacy code so old kernel packages will still work.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-30 15:22:14 +08:00
Tao Liu
0ef6c1aa27 Release 2.0.22-11
Resolves: bz1972463
Resolves: bz1982474
Resolves: bz1979879

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-07-26 10:30:33 +08:00
Kairui Song
0cbec881dc Make dump_to_rootfs wait for 90s for real
Previous commit da6b280 ('Cleanup dead systemd services before start sysroot.mount')
is not enough for fixing bz1972463. Coiby found a new issue that never
saw before, this patch fixes it.

Resolves: bz1972463
Conflict: None
Upstream: Fedora

commit 660cf4ac03
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Jul 20 13:41:08 2021 +0800

    Make `dump_to_rootfs` wait for 90s for real

    When `failure_action` is set to `dump_to_rootfs`, the message:
    "Waiting for rootfs mount, will timeout after 90 seconds"
    is actually wrong. Kdump will simply call `systemctl start sysroot.mount`,
    but the timeout value of sysroot.mount depends on the unit service and
    dracut parameters. And by default, dracut will set
    JobRunningTimeoutSec=0 and JobTimeoutSec=0 for the device units,
    which means it will wait forever. (see wait_for_dev function in dracut)

    For some devices, this can be fixed by setting rd.timeout=90. But when
    initqueue is set enabled during initramfs build, dracut will force set
    timeout for host devices to `0`. (see 99base/module-setup.sh).

    Depending on dracut / systemd can make things unpredictable and break as
    parameters or code change. To make things easy to understand and
    maintain, just call `systemctl` with `--no-block` params, and implement
    a standalone wait loop.  Now `dump_to_rootfs` will actually wait for
    90s then timeout.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-22 09:59:16 +00:00
Coiby Xu
d4de3e9dcc Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand
Resolves: bz1982474
Upstream: Fedora
Conflict: None

commit b2bbb54d89
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Jul 15 09:18:33 2021 +0800

    Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand

    On s390x KVM machines, the following errors would show when building kdump
    initramfs that dumps vmcore to a remote target,
        $ kdumpctl rebuild
        /usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh: line 475: /sys/bus/ccwgroup/devices/online: No such file or directory
        /usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh: line 476: [: -ne: unary operator expected

    This happens because s390x KVM machines use virtual network and
    /sys/bus/ccwgroup/devices/ exists but is empty. Fix it by check
    the existence of file "/sys/bus/ccwgroup/devices/*/online".

    Fixes: commit 7d47251568
           ("Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet")

    BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1982474
    Reported-by: Jie Li <jieli@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-07-21 17:24:50 +08:00
Philipp Rudo
3f28dc72a2 kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline
Resolves: bz1979879
Upstream: Fedora
Conflict: None

commit 914a856c66
Author: Philipp Rudo <prudo@redhat.com>
Date:   Fri Jul 16 10:34:35 2021 +0200

    kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline

    "prot_virt" enables the kernel to run Secure Execution virtual machines
    on s390. These virtual machines are isolated from the hypervisor and
    thus protected against tampering by a malicious host. Enabling
    "prot_virt" requires a minimum of ~2.5GB memory which exceeds what is
    typically reserved for the crashkernel. Thus remove "prot_virt" from the
    command line for the 2nd kernel to prevent it to run out-of-memory.

    For more discussions about this, see:
    https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/thread/QSRRNV4ALKXUJC2VM3US4Z2NSQRHVMXB/

    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2021-07-20 17:27:12 +02:00
Tao Liu
b84de553b4 Release 2.0.22-10
Resolves: bz1924115
Resolves: bz1972463
Resolves: bz1977559

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-07-20 15:51:38 +08:00
Kairui Song
2b7f081a06 fadump-init: clean up mount points properly
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit 97930d3cca
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Jun 28 13:57:27 2021 +0800

    fadump-init: clean up mount points properly

    When running with squash module enabled for both initramfs, /dev and
    /run are also mounted by squash-init, so move them to newroot as well,
    else they might leak.

    Also pass `-d` to umount so loop devices (if used) will be force freed.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:43 +08:00
Kairui Song
8e51ebe6fb fadump: kdumpctl should check the modules used by the fadump initramfs
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit bf6671b60d
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jun 25 14:44:45 2021 +0800

    fadump: kdumpctl should check the modules used by the fadump initramfs

    After fadump embedded the fadump initramfs in the normal initramfs,
    kdumpctl will mistakenly rebuild the initramfs everytime.

    kdumpctl checks the hostonly-kernel-modules.txt file in initramfs
    to check if required drivers are included, but the normal initramfs
    is built in non-hostonly mode, so it doesn't have a
    hostonly-kernel-modules.txt file. The check will always fail.

    So let mkfadumprd make a copy of the hostonly-kernel-modules.txt in the
    fadump initramfs and let kdumpctl check that file instead.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:26 +08:00
Kairui Song
96a3fc1ac8 fadump: isolate fadump initramfs image within the default one
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit fa9201b240 (devel)
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Wed Jun 23 20:06:48 2021 +0530

    fadump: isolate fadump initramfs image within the default one

    In case of fadump, the initramfs image has to be built to boot into
    the production environment as well as to offload the active crash dump
    to the specified dump target (for boot after crash). As the same image
    would be used for both boot scenarios, it could not be built optimally
    while accommodating both cases.

    Use --include to include the initramfs image built for offloading
    active crash dump to the specified dump target. Also, introduce a new
    out-of-tree dracut module (99zz-fadumpinit) that installs a customized
    init program while moving the default /init to /init.dracut. This
    customized init program is leveraged to isolate fadump image within
    the default initramfs image by kicking off default boot process
    (exec /init.dracut) for regular boot scenario and activating fadump
    initramfs image, if the system is booting after a crash.

    If squash is available, ensure default initramfs image is also built
    with squash module to reduce memory consumption in capture kernel.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:11 +08:00
Kairui Song
da6b280a63 Cleanup dead systemd services before start sysroot.mount
Resolves: bz1972463
Conflict: None
Upstream: Fedora

commit 2603ba7187 (origin/rawhide, rawhide)
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 2 03:27:05 2021 +0800

    Cleanup dead systemd services before start sysroot.mount

    When kdump failed due to initqueue timeout, the sysroot.mount and other
    serivces could be stuck in `start` but `dead` status:

    Example output of systemctl:

    dev-disk-by\x2duuid-530830d1\x2df2c7\x2d4c9a\x2d9a82\x2d148609097521.device loaded inactive   dead    start
    <... snip ...>
    squash-root.mount               loaded active     mounted       /squash/root
    squash.mount                    loaded active     mounted       /squash
    sysroot.mount                   loaded inactive   dead    start /sysroot
    <... snip ...>
    dracut-cmdline.service          loaded active     exited        dracut cmdline hook
    dracut-initqueue.service        loaded activating start   start dracut initqueue hook
    dracut-mount.service            loaded inactive   dead    start dracut mount hook

    At this point calling `systemctl start sysroot.mount` will just hang as
    systemd will just wait for the services that are stuck in `start`
    status. So call `systemctl cancel` here to cancel all pending jobs and
    have a clean start for mounting sysroot.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 07:12:55 +00:00
Coiby Xu
396e92f397 Revert "Revert "x86_64: enable the kexec file load by default""
Resolves: bz1977559
Upstream: Fedora
Conflict: None

commit 7ae9669f3961c9a95f3b04803bf61730b34f585a
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Jul 6 10:31:36 2021 +0800

    Revert "Revert "x86_64: enable the kexec file load by default""

    This reverts commit 073c30973c, i.e.
    re-enable the kexec file load by default since this dual signature
    issue no longer bothers Fedora 34.

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-07-14 09:21:57 +08:00
Tao Liu
0fb5d148a2 Release 2.0.22-9
Resolves: bz1974638
Resolves: bz1977543

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-07-12 09:04:31 +08:00
Kairui Song
f5ffd4fd22 Add a crashkernel-howto.txt doc
Resolves: bz1974638
Upstream: Fedora
Conflict: None

commit 7dbbb4bb31
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jun 25 04:01:45 2021 +0800

    Add a crashkernel-howto.txt doc

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-08 15:43:40 +08:00
Kairui Song
93ba58b136 Add a new hook: 92-crashkernel.install
Resolves: bz1974638
Upstream: Fedora
Conflict: Minor conflict in spec file resolved easily

commit 6463641935
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Jun 10 13:06:23 2021 +0800

    Add a new hook: 92-crashkernel.install

    To track and manage kernel's crashkernel usage by kernel version,
    each kernel package will include a crashkernel.default containing the
    default `crashkernel=` value of that kernel. So we can use a hook to
    update the kernel cmdline of new installed kernel accordingly.

    Put it after all other grub boot loader setup hooks, so it can simply
    call grubby to modify the kernel cmdline.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-08 15:42:34 +08:00
Kairui Song
a0fe51b32e kdumpctl: Add kdumpctl reset-crashkernel
Resolves: bz1974638
Upstream: Fedora
Conflict: None

commit 86130ec10f
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Jun 10 13:06:22 2021 +0800

    kdumpctl: Add kdumpctl reset-crashkernel

    In newer kernel, crashkernel.default will contain the default
    crashkernel value of a kernel build. So introduce a new sub command
    to help user reset kernel crashkernel size to the default value.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-08 15:42:14 +08:00
Kairui Song
80c1913e4a Revert "kdump-lib.sh: Remove is_atomic"
Resolves: bz1974638
Upstream: Fedora
Conflict: None

commit 017903c3c4
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jun 25 03:42:19 2021 +0800

    Revert "kdump-lib.sh: Remove is_atomic"

    Now we need this helper again, for `reset-crashkernel`

    This reverts commit ff46cfb19e.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-08 15:40:44 +08:00
Coiby Xu
e45a51c995 fix format issue in find_online_znet_device
Related: bz1977543
Upstream: Fedora
Conflict: None

commit ad6f60d70d
Author: Coiby Xu <coxu@redhat.com>
Date:   Mon Jun 28 18:37:11 2021 +0800

    fix format issue in find_online_znet_device

    Change spaces to tab to fix alignment issue.

    Fixes: commit 7d47251568
           ("Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-06-30 10:26:28 +08:00
Coiby Xu
3b4df2455b check the existence of /sys/bus/ccwgroup/devices before trying to find online network device
Resolves: bz1977543
Upstream: Fedora
Conflict: None

commit 03f9b91351
Author: Coiby Xu <coxu@redhat.com>
Date:   Mon Jun 28 18:37:10 2021 +0800

    check the existence of /sys/bus/ccwgroup/devices before trying to find online network device

    /sys/bus/ccwgroup/devices doesn't exist for non-s390x machines which leads to
    the warning "find: '/sys/bus/ccwgroup/devices': No such file or directory".
    This warning can be eliminated by checking the existence of
    "/sys/bus/ccwgroup/devices" beforehand.

    Fixes: commit 7d47251568
           ("Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet")

    Reported-by: Ruowen Qin <ruqin@redhat.com>
    BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1974618
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-06-30 10:10:37 +08:00
Tao Liu
0fb7ca87a1 Release 2.0.22-8
Resolves: bz1974178
Resolves: bz1972464
Resolves: bz1975632
Resolves: bz1968374

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-29 13:15:52 +08:00
Tao Liu
d898f5be01 check for invalid physical address of /proc/kcore when making ELF dumpfile
Resolves: bz1974178
Upstream: Fedora
Conflict: None

commit 9a6f589d99dcef114c89fde992157f5467028c8f
Author: Tao Liu <ltao@redhat.com>
Date:   Fri Jun 18 18:28:04 2021 +0800

    [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 <ltao@redhat.com>
    Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-29 13:14:08 +08:00
Tao Liu
e2829bbdc2 Increase SECTION_MAP_LAST_BIT to 5
Resolves: bz1972464
Upstream: Fedora
Conflict: None

commit 646456862df8926ba10dd7330abf3bf0f887e1b6
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
Date:   Wed May 26 14:31:26 2021 +0900

    [PATCH] Increase SECTION_MAP_LAST_BIT to 5

    * Required for kernel 5.12

    Kernel commit 1f90a3477df3 ("mm: teach pfn_to_online_page() about
    ZONE_DEVICE section collisions") added a section flag
    (SECTION_TAINT_ZONE_DEVICE) and causes makedumpfile an error on
    some machines like this:

      __vtop4_x86_64: Can't get a valid pmd_pte.
      readmem: Can't convert a virtual address(ffffe2bdc2000000) to physical address.
      readmem: type_addr: 0, addr:ffffe2bdc2000000, size:32768
      __exclude_unnecessary_pages: Can't read the buffer of struct page.
      create_2nd_bitmap: Can't exclude unnecessary pages.

    Increase SECTION_MAP_LAST_BIT to 5 to fix this.  The bit had not
    been used until the change, so we can just increase the value.

    Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-28 22:05:35 +08:00
Tao Liu
ba2668b537 kdumpctl: fix check_config error when kdump.conf is empty
Resolves: bz1975632
Upstream: Fedora
Conflict: None

commit 6137956f79
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Apr 14 13:41:19 2021 +0800

    kdumpctl: fix check_config error when kdump.conf is empty

    Kdump scirpt already have default values for core_collector, path in
    many other place. Empty kdump.conf still works. Fix this corner case and
    fix the error message.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-25 12:29:40 +08:00
Pingfan Liu
8ce1f3c1df kdump-lib.sh: fix a warning in prepare_kdump_bootinfo()
Resolves: bz1968374
Upstream: Fedora
Conflict: None

commit 39a642b66b
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Tue Jun 1 16:46:58 2021 +0530

    kdump-lib.sh: fix a warning in prepare_kdump_bootinfo()

    Fix the warning observed when KDUMP_KERNELVER is specified:

      kdumpctl[10926]: /lib/kdump/kdump-lib.sh: line 697: [: missing `]'

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2021-06-25 11:39:31 +08:00
Tao Liu
c96d511a36 Release 2.0.22-7
Resolves: bz1965952

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-23 09:36:06 +08:00
Tao Liu
5f4c5f9819 Write to /var/lib/kdump if $KDUMP_BOOTDIR not writable
Resolves: bz1965952
Upstream: Fedora
Conflict: None

commit 75bdcb7399
Author: Kelvin Fan <kfan@redhat.com>
Date:   Fri Apr 16 22:31:13 2021 +0000

    Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable

    The `/boot` directory on some operating systems might be read-only.
    If we cannot write to `$KDUMP_BOOTDIR` when generating the kdump
    initrd, attempt to place the generated initrd at `/var/lib/kdump`
    instead.

    Signed-off by: Kelvin Fan <kelvinfan001@gmail.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-23 09:34:40 +08:00
Tao Liu
569951017e Release 2.0.22-6
Resolve: bz1941905

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-16 11:32:19 +08:00
Tao Liu
aaac159456 Add gating.yaml to RHEL-9 kexec-tools
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-08 20:03:41 +08:00
Coiby Xu
f0ecf8fef1 Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet
Resolves: bz1941905
Upstream: Fedora
Conflict: None

commit 7d47251568
Author: Coiby Xu <coxu@redhat.com>
Date:   Mon Jun 7 07:26:03 2021 +0800

    Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet

    This patch fixes bz1941106 and bz1941905 which passed empty rd.znet to the
    kernel command line in the following cases,
     - The IBM (Z15) KVM guest uses virtio for all devices including network
       device, so there is no znet device for IBM KVM guest. So we can't
       assume a s390x machine always has a znet device.
     - When a bridged network is used, kexec-tools tries to obtain the znet
       configuration from the ifcfg script of the bridged network rather than
       from the ifcfg script of znet device.

    We can iterate /sys/bus/ccwgroup/devices to tell if there if there is
    a znet network device. By getting an ifname from znet, we can also avoid
    mistaking the slave netdev as a znet network device in a bridged network
    or bonded network.

    Note: This patch also assumes there is only one znet device as commit
    7148c0a30d ("add s390x netdev setup")
    which greatly simplifies the code. According to IBM [1], there could be
    more than znet devices for a z/VM system and a z/VM system may have a
    non-znet network device like ConnectX. Since kdump_setup_znet was
    introduced in 2012 and so far there is no known customer complaint that
    invalidates this assumption I think it's safe to assume an IBM z/VM
    system only has one znet device. Besides, there is no z/VM system found
    on beaker to test the alternative scenarios.

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

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-06-08 13:27:04 +08:00
Tao Liu
ce17b896ea Release 2.0.22-5
Resolve: bz1901024

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-07 14:38:20 +08:00
Kairui Song
50d77e1989 Use a customized emergency shell
Resolves: bz1901024
Upstream: Fedora
Conflict: None

commit 41980f30d9
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Apr 26 17:09:57 2021 +0800

    Use a customized emergency shell

    Use a modified and minimized version of emergency shell.
    The differences of this kdump shell and dracut emergency shell are:

      - Kdump shell won't generate a rdsosreport automatically
      - Customized prompts
      - Never ask root password
      - Won't tangle with dracut's emergency_action. If emergency_action is
        set, dracut emergency shell will perform dracut's emergency_action
        instead of kdump final_action on exit.
      - If rd.shell=no is set, kdump shell will still work, dracut emergency
        shell won't, even if kdump failure_action is set to shell.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-04 14:30:45 +08:00
Kairui Song
06aa5b897f Remove the kdump error handler isolation wrapper
Resolves: bz1901024
Upstream: Fedora
Conflict: None

commit a2306346bc
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Apr 26 17:09:56 2021 +0800

    Remove the kdump error handler isolation wrapper

    The wrapper is introduced in commit 002337c, according to the commit
    message, the only usage of the wrapper is when dracut-initqueue calls
    "systemctl start emergency" directly. In that case, emergency
    is started, but not in a isolation mode, which means dracut-initqueue
    is still running. On the other hand, emergency will call
    "systemctl start dracut-initqueue" again when default action is dump_to_rootfs.

    systemd would block on the last dracut-initqueue, waiting for the first
    instance to exit, which leaves us hang.

    In previous commit we added initqueue status detect in dump_to_rootfs,
    so now even without the wrapper, it will not hang.

    And actually, previously, with the wrapper, emergency might still hang
    for like 30s. When dracut called emergency service because initqueue
    timed out, dump_to_rootfs will try start initqueue again and timeout
    again. Now with the wrapper removed, we can avoid these two kinds of
    hangs, bacause without the isolation we can detect initqueue service
    status correctly in such case.

    Also remove the invalid header comments in service file, the service
    is not part of systemd code. And sync the service spec with dracut.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-04 14:29:28 +08:00
Kairui Song
e5ccb87ef6 Don's try to restart dracut-initqueue if it's already there
Resolves: bz1901024
Upstream: Fedora
Conflict: None

commit 108258139a
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Apr 26 17:09:55 2021 +0800

    Don's try to restart dracut-initqueue if it's already there

    kdump's dump_to_rootfs will try to start initqueue unconditionally.
    dump_to_rootfs will run after systemd isolate to emergency
    target, so this is currently accetable.

    But there is a problem when initqueue starts the emergency action
    because of initqueue timeout. dump_to_rootfs will start initqueue and
    lead to timeout again.

    So following patch will remove the previous isolation wrapper, and
    detect the service status here. Previous isolation makes the detection
    impossible. Now this detection will be valid and helpful to prevent
    double timeout or hang.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-04 14:27:58 +08:00
Tao Liu
6a8b7bf421 Release 2.0.22-4
Resolve: bz1952342

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-05-27 11:56:56 +08:00
Pingfan Liu
73929fc549 kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()
Resolves: bz1952342
Upstream: Fedora
Conflict: None

commit 45377836b0
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue May 25 09:26:09 2021 +0800

    kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()

    For crashkernel=auto policy, if total RAM size is under a throttle,
    there is no memory reserved for kdump.

    Also correct a trivial bug by correcting the arch name.

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2021-05-25 10:36:01 +08:00
Tao Liu
53e6337ee2 Release 2.0.22-3
Resolve: bz1951415
Resolve: bz1896247

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-05-24 15:06:17 +08:00
Kairui Song
a9fda5c885 kdumpctl: Add kdumpctl estimate
Resolves: bz1951415
Upstream: fedora
Conflict: none

commit e9e6a2c745
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Apr 22 03:27:10 2021 +0800

    kdumpctl: Add kdumpctl estimate

    Add a rough esitimation support, currently, following memory usage are
    checked by this sub command:

    - System RAM
    - Kdump Initramfs size
    - Kdump Kernel image size
    - Kdump Kernel module size
    - Kdump userspace user and other runtime allocated memory (currently
      simply using a fixed value: 64M)
    - LUKS encryption memory usage

    The output of kdumpctl estimate looks like this:
      # kdumpctl estimate
      Reserved crashkernel:    256M
      Recommanded crashkernel: 160M

      Kernel image size:   47M
      Kernel modules size: 12M
      Initramfs size:      19M
      Runtime reservation: 64M
      Large modules:
          xfs: 1892352
          nouveau: 2318336

    And if the kdump target is encrypted:
      # kdumpctl estimate
      Encrypted kdump target requires extra memory, assuming using the keyslot with minimun memory requirement

      Reserved crashkernel:    256M
      Recommanded crashkernel: 655M

      Kernel image size:   47M
      Kernel modules size: 12M
      Initramfs size:      19M
      Runtime reservation: 64M
      LUKS required size:  512M
      Large modules:
          xfs: 1892352
          nouveau: 2318336
      WARNING: Current crashkernel size is lower than recommanded size 655M.

    The "Recommanded" value is calculated based on memory usages mentioned
    above, and will be adjusted accodingly to be no less than the value provided
    by kdump_get_arch_recommend_size.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-20 16:08:16 +08:00
Kairui Song
de1c56b637 mkdumprd: make use of the new get_luks_crypt_dev helper
Resolves: bz1951415
Upstream: fedora
Conflict: None

commit 85c725813b
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Apr 8 01:41:21 2021 +0800

    mkdumprd: make use of the new get_luks_crypt_dev helper

    Simplfy the code and also improve the performance. udevadm call is
    heavy.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-20 16:08:10 +08:00
Kairui Song
8387b514f1 kdump-lib.sh: introduce a helper to get all crypt dev used by kdump
Resolves: bz1951415
Upstream: fedora
Conflict: None

commit 1c70cf51c7
Author: Kairui Song <kasong@redhat.com>
Date:   Tue May 18 16:13:16 2021 +0800

    kdump-lib.sh: introduce a helper to get all crypt dev used by kdump

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-20 16:08:05 +08:00