Project Description

When we experience a early boot crash, we are not able to analyze the kernel dump, as user-space wasn't able to load the crash system. The idea is to make the crash system compiled into the host kernel (think of initramfs) so that we can create a kernel dump really early in the boot process.

Goal for the Hackweeks

  1. Investigate if this is possible and the implications it would have (done in HW21)
  2. Hack up a PoC (done in HW22 and HW23)
  3. Prepare RFC series (giving it's only one week, we are entering wishful thinking territory here).

update HW23

  • I was able to include the crash kernel into the kernel Image.
  • I'll need to find a way to load that from init/main.c:start_kernel() probably after kcsan_init()
  • I workaround for a smoke test was to hack kexec_file_load() systemcall which has two problems:
    1. My initramfs in the porduction kernel does not have a new enough kexec version, that's not a blocker but where the week ended
    2. As the crash kernel is part of init.data it will be already stale once I can call kexec_file_load() from user-space.

The solution is probably to rewrite the POC so that the invocation can be done from init.text (that's my theory) but I'm not sure if I can reuse the kexec infrastructure in the kernel from there, which I rely on heavily.

Resources

Looking for hackers with the skills:

kernel kdump

This project is part of:

Hack Week 21 Hack Week 22 Hack Week 23 Hack Week 24

Activity

  • 7 days ago: djais joined this project.
  • 27 days ago: jmodak liked this project.
  • 2 months ago: eomelette joined this project.
  • 3 months ago: m.crivellari liked this project.
  • about 1 year ago: vbabka liked this project.
  • about 1 year ago: pvorel liked this project.
  • almost 2 years ago: jzerebecki liked this project.
  • almost 2 years ago: tdz liked this project.
  • almost 2 years ago: Zildj1an liked this project.
  • almost 2 years ago: Zildj1an joined this project.
  • almost 2 years ago: tschmitz liked this project.
  • almost 2 years ago: paolodepa liked this project.
  • almost 2 years ago: afeijoo liked this project.
  • over 2 years ago: clin liked this project.
  • over 2 years ago: ptesarik liked this project.
  • over 2 years ago: akumar joined this project.
  • over 2 years ago: akumar liked this project.
  • over 2 years ago: coolgw liked this project.
  • over 2 years ago: mbrugger started this project.
  • over 2 years ago: mbrugger added keyword "kdump" to this project.
  • over 2 years ago: mbrugger added keyword "kernel" to this project.
  • over 2 years ago: mbrugger originated this project.

  • Comments

    • mbrugger
      about 1 year ago by mbrugger | Reply

      I got a tip to look into grub2 multiboot. Maybe we can load the crash kernel to the reserved memory region from grub. We then would only need to pass a kernel argument so that the kernel takes this into account.

    • ptesarik
      4 months ago by ptesarik | Reply

      FWIW I was contemplating a similar scheme back in 2016. My idea was to load: 1. kdump kernel 2. kdump initrd 3. production kernel 4. production initrd Then boot into the kdump kernel, update memory maps and kexec to the production kernel. When the production kernel crashes, pass control back to the kdump kernel. For the return to the kdump kernel, I was looking at the KEXEC_PRESERVE_CONTEXT flag, but in the end I doubt it's really helpful without further modifications to the production kernel. At this point, it's probably easier to boot the production kernel first and set up an initial crash kernel at early boot.

      Good luck!

    Similar Projects

    Improve various phones kernel mainline support (Qualcomm, Exynos, MediaTek) by pvorel

    Similar to previous hackweeks ( [https://hackwe...


    Kill DMA and DMA32 memory zones by ptesarik

    Description

    Provide a better allocator fo...


    Contributing to Linux Kernel security by pperego

    Description

    A couple of weeks ago, I foun...


    Create a DRM driver for VGA video cards by tdz

    Yes, those [VGA video cards](https://en.wikiped...


    Officially Become a Kernel Hacker! by m.crivellari

    Description

    My studies as well my spare tim...