Skip to content
Snippets Groups Projects
  1. Nov 15, 2024
    • Simon Horman's avatar
      kexec-tools 2.0.30-rc1 · a7fcf2b9
      Simon Horman authored
      
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      v2.0.30-rc1
      a7fcf2b9
    • Andy Shevchenko's avatar
      kexec: x86: Include pref_address when looking for a memory hole · 07a6217a
      Andy Shevchenko authored
      
      When the kernel is built relocatable, the starting address can be
      anything above 1Mb on x86. However, the startup_*() entries consider
      that the minumum address for the kernel for the decompression has to
      be at least LOAD_PHYSICAL_ADDR which is turn the value that is provided
      as pref_address in boot protocol. The boot protocol itself says:
      
        This field, if nonzero, represents a preferred load address for the
        kernel.  A relocating bootloader should attempt to load at this
        address if possible.
      
      Besides that the code in the kernel (arch/x86/kernel/kexec-bzimage64.c)
      has these lines (in bzImage64_load() function):
      
          if (header->pref_address < MIN_KERNEL_LOAD_ADDR)
              kbuf.buf_min = MIN_KERNEL_LOAD_ADDR;
          else
              kbuf.buf_min = header->pref_address;
      
      All that said, do the same in kexec tools. Without this patch
      the relocatable kernel may end up in the memory hole that is
      not enough for in-place decompression and Bad Things will happen
      as it's proven on Intel Merrifield, that has a reserved memory
      block starting at 64Mb.
      
      Note, it doesn't mean that kernel has no issues itself in this particular
      stage, but at least we may work around some corner cases for kexec.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      07a6217a
  2. Nov 07, 2024
  3. Nov 06, 2024
  4. Nov 04, 2024
  5. Oct 21, 2024
  6. Oct 14, 2024
  7. Jul 23, 2024
  8. Jul 18, 2024
  9. Jul 12, 2024
  10. Jul 09, 2024
    • Sourabh Jain's avatar
      doc/hotplug: update man and --help · 0be146b6
      Sourabh Jain authored
      
      Update the man page and --help option to make the description of the
      --hotplug option easier to understand.
      
      Acked-by: default avatarBaoquan He <bhe@redhat.com>
      Acked-by: default avatarHari Bathini <hbathini@linux.ibm.com>
      Signed-off-by: default avatarSourabh Jain <sourabhjain@linux.ibm.com>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      0be146b6
    • Sourabh Jain's avatar
      powerpc/kexec_load: add hotplug support · b8408c95
      Sourabh Jain authored
      
      Kernel commits b741092d5976 ("powerpc/crash: add crash CPU hotplug
      support") and 849599b702ef ("powerpc/crash: add crash memory hotplug
      support") added crash CPU/Memory hotplug support on PowerPC. This patch
      extends that support for the kexec_load syscall.
      
      During CPU/Memory hotplug events on PowerPC, two kexec segments,
      elfcorehdr, and FDT, get updated by the kernel. To ensure the kernel
      can safely update these two kexec segments for the kdump image loaded
      using the kexec_load system call, the following changes are made:
      
      1. Extra size is allocated for both elfcorehdr and FDT to accommodate
         additional resources in the future. For the elfcorehdr, the size hint
         is taken from /sys/kernel/crash_elfcorehdr_size sysfs, while for FDT,
         extra size is allocated to hold possible CPU nodes.
      
      2. Both elfcorehdr and FDT are skipped from SHA calculation.
      
      Acked-by: default avatarHari Bathini <hbathini@linux.ibm.com>
      Signed-off-by: default avatarSourabh Jain <sourabhjain@linux.ibm.com>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      b8408c95
    • Sourabh Jain's avatar
      kexec_load: Use new kexec flag for hotplug support · 3c47f384
      Sourabh Jain authored
      
      Kernel commit 79365026f869 (crash: add a new kexec flag for hotplug
      support) has introduced a new kexec flag to generalize hotplug support.
      The newly introduced kexec flags for hotplug allow architectures to
      exclude all the required kexec segments from SHA calculation so that
      the kernel can update them on hotplug events. This was not possible
      earlier with the KEXEC_UPDATE_ELFCOREHDR kexec flags since it was added
      only for the elfcorehdr segment.
      
      To enable architectures to control the list of kexec segments to exclude
      when hotplug support is enabled, add a new architecture-specific
      function named arch_do_exclude_segment. During the SHA calculation, this
      function gets called to let the architecture decide whether a specific
      kexec segment should be considered for SHA calculation or not.
      
      Note: To avoid breaking backward compatibility, the new kexec flag
      KEXEC_CRASH_HOTPLUG_SUPPORT is not used for x86 for now.
      
      Signed-off-by: default avatarSourabh Jain <sourabhjain@linux.ibm.com>
      Acked-by: default avatarBaoquan He <bhe@redhat.com>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      3c47f384
  11. Jun 18, 2024
  12. Jun 03, 2024
  13. Apr 26, 2024
  14. Apr 23, 2024
  15. Mar 22, 2024
    • Baoquan He's avatar
      util_lib/elf_info.c: fix a warning · 623ceb33
      Baoquan He authored
      
      There's a incorrect array operation in function scan_vmcoreinfo(), it
      will cause below warning message.
      
      -----------------------
      util_lib/elf_info.c: In function ‘scan_vmcoreinfo’:
      util_lib/elf_info.c:360:43: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
        360 |                         temp_buf[len + 1] = '\0';
            |                         ~~~~~~~~~~~~~~~~~~^~~~~~
      util_lib/elf_info.c:319:14: note: at offset 1024 into destination object ‘temp_buf’ of size 1024
        319 |         char temp_buf[1024];
            |              ^~~~~~~~
      ---------------------
      
      Fix it to avoid oob access of array.
      
      Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      623ceb33
  16. Mar 15, 2024
  17. Feb 07, 2024
  18. Feb 02, 2024
  19. Jan 25, 2024
    • Jiri Bohac's avatar
      kexec: don't use kexec_file_load on XEN · 94fbe64f
      Jiri Bohac authored
      
      Since commit 29fe5067 ("kexec: make -a the default")
      kexec tries the kexec_file_load syscall first and only falls back to kexec_load on
      selected error codes.
      
      This effectively breaks kexec on XEN, unless -c is pecified to force the kexec_load
      syscall.
      
      The XEN-specific functions (xen_kexec_load / xen_kexec_unload) are only called
      from my_load / k_unload, i.e. the kexec_load code path.
      
      With -p (panic kernel) kexec_file_load on XEN fails with -EADDRNOTAVAIL (crash
      kernel reservation is ignored by the kernel on XEN), which is not in the list
      of return codes that cause the fallback to kexec_file.
      
      Without -p kexec_file_load actualy leads to a kernel oops on v6.4.0
      (needs to be dubugged separately).
      
      Signed-off-by: default avatarJiri Bohac <jbohac@suse.cz>
      Fixes: 29fe5067 ("kexec: make -a the default")
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      94fbe64f
    • Simon Horman's avatar
      kexec-tools 2.0.28.git · 21ea4569
      Simon Horman authored
      
      Add .git to version so it doesn't look like a release.
      This is just so when people build code from git it can
      be identified as such from the version string.
      
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      21ea4569
  20. Jan 11, 2024
  21. Jan 03, 2024
  22. Dec 02, 2023
    • WANG Rui's avatar
      LoongArch: Load vmlinux.efi to the link address · 54946643
      WANG Rui authored
      
      Currently, kexec loads vmlinux.efi to address 0 instead of the link
      address. This causes kexec to fail to boot the new vmlinux.efi on qemu.
      
        pei_loongarch_load: kernel_segment: 0000000000000000
        pei_loongarch_load: kernel_entry:   00000000013f1000
        pei_loongarch_load: image_size:     0000000001ca0000
        pei_loongarch_load: text_offset:    0000000000200000
        pei_loongarch_load: phys_offset:    0000000000000000
        pei_loongarch_load: PE format:      yes
        loongarch_load_other_segments:333: command_line: kexec console=ttyS0,115200
        kexec_load: entry = 0x13f1000 flags = 0x1020000
        nr_segments = 2
        segment[0].buf   = 0x7fffeea38010
        segment[0].bufsz = 0x1b55200
        segment[0].mem   = (nil)
        segment[0].memsz = 0x1ca0000
        segment[1].buf   = 0x5555570940b0
        segment[1].bufsz = 0x200
        segment[1].mem   = 0x1ca0000
        segment[1].memsz = 0x4000
      
      This patch constrains the range of the kernel segment by `hole_min`
      and `hole_max` to place vmlinux.efi exactly at the link address.
      
        pei_loongarch_load: kernel_segment: 0000000000200000
        pei_loongarch_load: kernel_entry:   00000000013f1000
        pei_loongarch_load: image_size:     0000000001ca0000
        pei_loongarch_load: text_offset:    0000000000200000
        pei_loongarch_load: phys_offset:    0000000000000000
        pei_loongarch_load: PE format:      yes
        loongarch_load_other_segments:339: command_line: kexec console=ttyS0,115200
        kexec_load: entry = 0x13f1000 flags = 0x1020000
        nr_segments = 2
        segment[0].buf   = 0x7ffff2028010
        segment[0].bufsz = 0x1b55200
        segment[0].mem   = 0x200000
        segment[0].memsz = 0x1ca0000
        segment[1].buf   = 0x555557498098
        segment[1].bufsz = 0x200
        segment[1].mem   = 0x1ea0000
        segment[1].memsz = 0x4000
      
      Signed-off-by: default avatarWANG Rui <wangrui@loongson.cn>
      Reviewed-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      54946643
    • WANG Rui's avatar
      LoongArch: Fix an issue with relocatable vmlinux · ba0ac0ef
      WANG Rui authored
      Normally vmlinux for LoongArch is of ET_EXEC type, while if built with
      CONFIG_RELOCATABLE (this is PIE) and Clang, it will be of ET_DYN type.
      Meanwhile, physical address field of segments in vmlinux has actually
      the same value as virtual address field.
      
      Similar to arm64, this patch allows to unconditionally skip the check
      on LoongArch.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1963
      
      
      Signed-off-by: default avatarWANG Rui <wangrui@loongson.cn>
      Reviewed-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      ba0ac0ef
    • Laurent Vivier's avatar
      m68k: fix getrandom() use with uclibc · 74dfaefd
      Laurent Vivier authored
      
      With uclibc, getrandom() is only defined with _GNU_SOURCE, fix that:
      
      kexec/arch/m68k/bootinfo.c: In function 'bootinfo_add_rng_seed':
      kexec/arch/m68k/bootinfo.c:231:13: warning: implicit declaration of function 'getrandom'; did you mean 'srandom'? [-Wimplicit-function-declaration]
        231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
            |             ^~~~~~~~~
            |             srandom
      kexec/arch/m68k/bootinfo.c:231:56: error: 'GRND_NONBLOCK' undeclared (first use in this function)
        231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
            |                                                        ^~~~~~~~~~~~~
      
      Fixes:  b9de0518 ("m68k: pass rng seed via BI_RNG_SEED")
      Cc: Jason@zx2c4.com
      Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      74dfaefd
    • WANG Rui's avatar
      lzma: Relax memory limit for lzma decompressor · 22dcf5cb
      WANG Rui authored
      
      The kexec cannot load LZMA compressed vmlinuz.efi on LoongArch.
      
        Try LZMA decompression.
        lzma_decompress_file: read on /tmp/Image4yyfhM of 65536 bytes failed
        pez_prepare: decompressed size 8563960
        pez_prepare: done
        Cannot load vmlinuz.efi
      
      The root cause is that lzma decompressor requires more memory usage,
      which exceeds the current 64M limit.
      
      Reported-by: default avatarHuacai Chen <chenhuacai@kernel.org>
      Signed-off-by: default avatarWANG Rui <wangrui@loongson.cn>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      22dcf5cb
  23. Nov 16, 2023
    • Aditya Gupta's avatar
      kexec: ppc64: print help to stdout instead of stderr · 44e7b73c
      Aditya Gupta authored
      
      Currently 'kexec --help' on powerpc64 prints the generic help/usage to
      stdout, and the powerpc64 specific options to stderr
      
      That is, if the stdout of 'kexec --help' is redirected to some file,
      some of the help options will not be redirected, and instead printed on
      the terminal/stderr:
      
          [root@machine kexec-tools]# kexec --help > /tmp/out
               --command-line=<Command line> command line to append.
               --append=<Command line> same as --command-line.
               --ramdisk=<filename> Initial RAM disk.
               --initrd=<filename> same as --ramdisk.
               --devicetreeblob=<filename> Specify device tree blob file.
                                           Not applicable while using
          --kexec-file-syscall.
               --dtb=<filename> same as --devicetreeblob.
          elf support is still broken
               --elf64-core-headers Prepare core headers in ELF64 format
               --dt-no-old-root Do not reuse old kernel root= param.
                                while creating flatten device tree.
      
      Fix this inconsistency by writing powerpc64 specific options to stdout,
      similar to the generic 'kexec --help'
      
      With the proposed changes, it is like this (nothing printed to stderr):
      
          [root@machine kexec-tools]# ./build/sbin/kexec --help > /tmp/out
      
      Reported-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: default avatarAditya Gupta <adityag@linux.ibm.com>
      Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      44e7b73c
  24. Oct 11, 2023
Loading