Commit Graph

629 Commits

Author SHA1 Message Date
Hari Bathini
fa9201b240 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>
2021-06-29 21:35:58 +08:00
Kairui Song
c4749f9c57 Release 2.0.22-4
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-29 21:24:19 +08:00
Tao Liu
50bb8b701f check for invalid physical address of /proc/kcore when making ELF dumpfile
Backport from upstream.

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>
Acked-by: Kairui Song <kasong@redhat.com>
2021-06-28 15:52:21 +08:00
Tao Liu
0feb109818 check for invalid physical address of /proc/kcore when finding max_paddr
Backport from upstream.

commit 38d921a2ef50ebd36258097553626443ffe27496
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Jun 15 18:26:31 2021 +0800

    [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 <yiyan@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2021-06-28 15:52:16 +08:00
Tao Liu
18b9b763de Increase SECTION_MAP_LAST_BIT to 5
Backport from upstream.

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>
Acked-by: Kairui Song <kasong@redhat.com>
2021-06-28 15:52:02 +08:00
Kairui Song
302be5c34b Release 2.0.22-3
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-20 02:38:04 +08:00
Kairui Song
a2306346bc 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>
2021-06-04 14:26:45 +08:00
Kairui Song
13796ca93a Release 2.0.22-2
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-13 17:14:38 +08:00
Kairui Song
c05d8a16a0 Update makedumpfile to 1.6.9
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-13 16:45:36 +08:00
Kairui Song
dece041609 Release 2.0.22-1
Update kexec-tools to 2.0.22

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-11 02:12:50 +08:00
Kairui Song
d0a301aa3a Release 2.0.21-9
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-04-28 16:51:52 +08:00
Tao Liu
475e33030b Make dracut-squash required for kexec-tools
This patch reverts commit "Make dracut-squash a weak dep".

Although kexec-tools can work without dracut-squash, it is essential
for kdump to run properly in cases [1][2] where minimal amount of memory
consumption is expected. Thus dracut-squash is needed for it.

[1] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/message/SJX7CW3WLOYSFI2YJKGTUGDBWSCMZXVZ/
[2] https://www.spinics.net/lists/systemd-devel/msg05864.html

Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2021-04-28 16:13:39 +08:00
Tao Liu
0db060c4e2 Show write byte size in report messages
Backport from upstream:

commit 0ef2ca6c9fa2f61f217a4bf5d7fd70f24e12b2eb
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
Date:   Thu Feb 4 16:29:06 2021 +0900

    [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 <k-hagio-ab@nec.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2021-04-28 16:13:23 +08:00
Tao Liu
8973bd7ed0 Add shorthand --show-stats option to show report stats
Backport from upstream:

commit 6f3e75a558ed50d6ff0b42e3f61c099b2005b7bb
Author: Julien Thierry <jthierry@redhat.com>
Date:   Tue Nov 24 10:45:25 2020 +0000

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

Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2021-04-28 15:45:25 +08:00
Tao Liu
e1ab0275c0 Add --dry-run option to prevent writing the dumpfile
Backport from upstream.

commit 3422e1d6bc3511c5af9cb05ba74ad97dd93ffd7f
Author: Julien Thierry <jthierry@redhat.com>
Date:   Tue Nov 24 10:45:24 2020 +0000

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

Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2021-04-28 15:45:08 +08:00
Kelvin Fan
75bdcb7399 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>
2021-04-19 16:11:17 +08:00
Coiby Xu
eca7711706 Drop dependency on ipcalc
A shell equivalent of "ipcalc -m" has been implemented.

Signed-off-by: Coiby Xu <coxu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2021-04-16 18:51:52 +08:00
Kairui Song
ad655087c9 Release 2.0.21-8
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-04-05 02:33:21 +08:00
Kairui Song
91f1d5989b Update eppic to latest upstream snapshot
Also fixes a package build failure:
ar ccurl libeppic.a eppic_util.o eppic_node.o eppic_var.o eppic_func.o eppic_str.o eppic_op.o eppic_num.o eppic_stat.o eppic_builtin.o eppic_type.o eppic_case.o eppic_api.o eppic_member.o eppic_alloc.o eppic_define.o eppic_input.o eppic_print.o eppicpp.tab.o eppic.tab.o lex.eppic.o lex.eppicpp.o baseops.o
ar: eppic_util.o: file format not recognized

See eppic commit 0037321e64952b4feb3bd37761fb1067266e9e72 for more
details.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-04-05 02:08:02 +08:00
Zbigniew Jędrzejewski-Szmek
4b7ff283f5 Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
2021-03-02 16:13:34 +01:00
Coiby Xu
2721f323a9 add dependency on ipcalc
ipcalc is needed for generating 45route-static.conf. However,
on newer Fedora, e.g. 34, dracut-network drops dependency on
dhcp-client which requires ipcalc. Make kexec-tools explicitly
depends on ipcalc.

Reported-by: Jie Li <jieli@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2021-02-09 17:52:50 +08:00
Kairui Song
7232f5bff2 Release 2.0.21-6
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-02-08 23:22:14 +08:00
Fedora Release Engineering
7a0d2aaed5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 15:28:37 +00:00
Kairui Song
33108ef524 Release 2.0.21-4
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-01-22 15:54:11 +08:00
Kairui Song
550f1c4285 Release 2.0.21-3
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-01-20 14:38:54 +08:00
Kairui Song
24c6b3027f Merge #4 Make dracut-squash a weak dep 2021-01-10 19:18:23 +00:00
Kairui Song
fc70351852 Fix a date error in the change log 2021-01-08 11:15:24 +08:00
Kairui Song
ae142da0a6 Release 2.0.20-2
Signed-off-by: Kairui Song <kasong@redhat.com>
2021-01-08 11:08:05 +08:00
Kairui Song
0e540f7328 makedumpfile: make use of 'uts_namespace.name' offset in VMCOREINFO
Backports:

commit 54aec3878b3f91341e6bc735eda158cca5c54ec9
Author: Alexander Egorenkov <egorenar@linux.ibm.com>
Date:   Fri Sep 18 13:55:56 2020 +0200

    [PATCH] make use of 'uts_namespace.name' offset in VMCOREINFO

    * Required for kernel 5.11

    The offset of the field 'init_uts_ns.name' has changed since
    kernel commit 9a56493f6942 ("uts: Use generic ns_common::count").
    Make use of the offset 'uts_namespace.name' if available in
    VMCOREINFO.

    Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-01-08 11:05:05 +08:00
Tom Stellard
872d6b36de Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-05 22:46:03 +00:00
Kairui Song
7cb4be80cd Release 2.0.20-1
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-12-23 17:41:43 +08:00
Kairui Song
1d5d39f3d4 makedumpfile: printk: use committed/finalized state values
commit 44b073b7ec467aee0d7de381d455b8ace1199184
Author: John Ogness <john.ogness@linutronix.de>
Date:   Wed Nov 25 10:10:31 2020 +0106

    [PATCH 2/2] printk: use committed/finalized state values

    * Required for kernel 5.10

    The ringbuffer entries use 2 state values (committed and finalized)
    rather than a single flag to represent being available for reading.
    Copy the definitions and state lookup function directly from the
    kernel source and use the new states.

    Signed-off-by: John Ogness <john.ogness@linutronix.de>

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-12-23 17:27:10 +08:00
Kairui Song
71e1c651dd makedumpfile: printk: add support for lockless ringbuffer
Backports:

commit c617ec63339222f3a44d73e36677a9acc8954ccd
Author: John Ogness <john.ogness@linutronix.de>
Date:   Thu Nov 19 02:41:21 2020 +0000

    [PATCH 1/2] printk: add support for lockless ringbuffer

    * Required for kernel 5.10

    Linux 5.10 introduces a new lockless ringbuffer. The new ringbuffer
    is structured completely different to the previous iterations.
    Add support for retrieving the ringbuffer from debug information
    and/or using vmcoreinfo. The new ringbuffer is detected based on
    the availability of the "prb" symbol.

    Signed-off-by: John Ogness <john.ogness@linutronix.de>
    Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-12-23 17:26:11 +08:00
Kairui Song
6be14c2bcd Release 2.0.20-21
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-11-30 17:02:40 +08:00
Kairui Song
7d861422fa Rebase makedumpfile to 1.6.8
makedumpfile have moved to Github, so update the upstream URLs.
2020-11-30 16:48:02 +08:00
Kairui Song
4f492cf73e Release 2.0.20-20
Also fix some changelog issue.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-11-19 00:38:23 +08:00
Kairui Song
bfd06661e8 Release 2.0.20-19
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-11-05 01:11:32 +08:00
Jonathan Lebon
c9a0df1ccb Make dracut-squash a weak dep
The dracut module is opportunistic about using the built-in squashfs
support only when available, but the spec file hard requires it. Demote
it to a weak dep to truly make it optional.

This caters to environments which strive to stay minimal, like FCOS and
RHCOS. See https://github.com/coreos/fedora-coreos-config/pull/708 for
details.
2020-10-28 16:36:05 -04:00
Lianbo Jiang
3b743ae6ae enable the logger for kdump
Since the logger was introduced into kdump, let's enable it for kdump
so that we can output kdump messages according the log level and save
these messages for debugging.

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2020-10-27 17:33:54 +08:00
Kairui Song
3d5d9f0c0f Release 2.0.20-18
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-27 13:14:59 +08:00
Kairui Song
a7199c141c Add a kernel install hook to clean up kdump initramfs
Kdump service will create kdump initramfs when needed, but it won't
clean up the kdump initramfs on kernel uninstall. So create a kernel
install hook to do the clean up job.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2020-08-27 11:22:03 +08:00
Kairui Song
f8f8d79d7f Release 2.0.20-17
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 10:50:46 +08:00
Kairui Song
d0d9ff1eb2 Drop static lib dependencies
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 10:47:51 +08:00
Fedora Release Engineering
21b4996e3a - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-08-01 03:43:49 +00:00
Fedora Release Engineering
1844d088f7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 03:00:49 +00:00
Pingfan Liu
8bef2d943b kexec-tools.spec: make the existence of pre.d and post.d mandatory
If the directory /etc/kdump/pre.d is optional, then it is hard
to tell between the following cases:
  -1. no directory "/etc/kdump/pre.d"
  -2. "rm -rf /etc/kdump/pre.d", which removes all scripts under pre.d
For the second case, kdump.img should be rebuilt.

To bail out from this corner case, always creating pre.d and post.d
during rpm installation.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2020-07-20 16:12:04 +08:00
Kairui Song
070d362846 Release 2.0.20-14
Also fix a timestamp issue.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-07-01 17:15:38 +08:00
Kairui Song
e05c550144 Drop switch root capability for non fadump initramfs
Switch root is never used for kdump image, and this will be helpful to
reduce the initramfs size.

Also increase dracut dependency version and the function is
dracut_no_switch_root is new introduced.

This commit is applied to RHEL some time ago, but missing in Fedora as
Fedora's Dracut didn't backport this feature at that time. Now apply
this missing commit.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Pingfan Liu <piliu@redhat.com>
2020-06-10 22:37:34 +08:00
Pingfan Liu
47bdeee35d fadump-howto.txt: source it in spec file
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
2020-06-03 11:34:37 +08:00
Kairui Song
cfd93e2b7e Revert "Add a hook to wait for kdump target in initqueue"
This reverts commit cee618593c.

Upstream dracut have provided a parameter for adding mandantory network
requirement by appending "rd.neednet" parameter, so we should use that
instead.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2020-05-28 16:26:00 +08:00