diffkemp icon indicating copy to clipboard operation
diffkemp copied to clipboard

DiffKemp requires input when building RHEL 8.4 and 8.5 kernels

Open FrNecas opened this issue 1 year ago • 4 comments

When building the RHEL 8.4 and 8.5 kernels (4.18.0-305.el8 and linux-4.18.0-348.el8, respectively) with the current version, DiffKemp hangs and is waiting for input while building the first function (__alloc_disk_node). Upon pressing enter, the build continues. This seems like a bug, I will try to take a closer look when I have time.

Steps to reproduce:

  1. download the kernels using rhel-kernel-get
  2. Run either bin/diffkemp build-kernel kernel/linux-4.18.0-305.el8 snapshots/linux-4.18.0-305.el8 kernel/linux-4.18.0-305.el8/kabi_whitelist_x86_64 or bin/diffkemp build-kernel kernel/linux-4.18.0-348.el8 snapshots/linux-4.18.0-348.el8 kernel/linux-4.18.0-348.el8/kabi_whitelist_x86_64

FrNecas avatar Dec 17 '23 00:12 FrNecas

I have tried to build 4.18.0-305.el8 and it seems that you are correct.

PLukas2018 avatar Dec 18 '23 16:12 PLukas2018

Hint: when you debug this, try to cd to the kernel directory and manually run a build command, e.g.:

$ make V=1 --just-print block/genhd.o

That should also halt and you should see the reason (perhaps a missing config?).

viktormalik avatar Dec 19 '23 08:12 viktormalik

I looked at this and it looks like:

  • When using the standard dev shell (nix develop) for both downloading (with rhel-kernel-get script) and building the mentioned kernels (diffkemp build-kernel) there is no problem (DiffKemp does not hang).

  • When using the shell nix develop .#test-kernel-buildenv for downloading (rhel-kernel-get) the mentioned kernels, the CONFIG_KASAN is undefined. And then when using the normal dev shell (nix develop) for building the mentioned kernels (diffkemp build-kernel) the building hangs at

    *
    * Restart config...
    *
    *
    * KASAN: runtime memory debugger
    *
    KASAN: runtime memory debugger (KASAN) [N/y/?] (NEW)
    

    because of the undefined CONFIG_KASAN configuration.

    To solve this, we could theoretically add scripts/config --disable CONFIG_KASAN inside the rhel-kernel-get script or inside the build-kernel command.

PLukas2018 avatar Jun 14 '24 07:06 PLukas2018

Thanks for the analysis @PLukas2018.

Updating rhel-kernel-get won't help here as this particular config is probably missing b/c the compiler in the Nix environment has different features than the one in normal dev shell. If you tried the mentioned commands in the test-kernel-buildenv shell, they would work just fine.

So, I think that we have two options here:

  1. Update DiffKemp to automatically add the missing config by using make olddefconfig (which will set all the missing configs to the default values). The problem is that the user may not expect that and therefore we may end up analyzing a different kernel configuration than the user intended to. It'd have to be well-documented if we decide to go this way.
  2. Detect the situation (kernel build stuck on a missing config) and fail the build-kernel command with a proper error message (which could even hint the user to run make olddefconfig on their own).

I slightly prefer the second option although I'm not sure how hard the detection would be.

viktormalik avatar Jul 10 '24 11:07 viktormalik

Solved by #372 (detects if some configs are missing and exits with error message).

PLukas2018 avatar Sep 26 '24 18:09 PLukas2018