KVM-VMI / kvm

Fork of KVM with Virtual Machine Introspection patches
Other
33 stars 28 forks source link

kvm port to a 5.15? #54

Closed asia-makai closed 2 years ago

asia-makai commented 2 years ago

Hi,

I have tried to compile kvm on Ubuntu 22.04. I'm not sure if it's possible without downgrading a loooot. I wanted to ask if you have by any chance ported the VMI extensions to 5.15?

Thank you!

Wenzel commented 2 years ago

Hi @asia-makai, I manage to compile this old 5.4 kernel on Ubuntu 22.04, with a few hacks. Tell me what issue you are running into

asia-makai commented 2 years ago

I've already added a few #pragma to gently ask gcc not to complain too much.. I'm not sure about this problem though:

  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  CHK     include/generated/compile.h
  AS      arch/x86/entry/thunk_64.o
arch/x86/entry/thunk_64.o: warning: objtool: missing symbol table
make[2]: *** [scripts/Makefile.build:348: arch/x86/entry/thunk_64.o] Error 1
make[2]: *** Deleting file 'arch/x86/entry/thunk_64.o'
make[1]: *** [scripts/Makefile.build:500: arch/x86/entry] Error 2
make: *** [Makefile:1690: arch/x86] Error 2

Thanks a million @Wenzel!

x1tan commented 2 years ago

It could be possible that you need to downgrade binutils, since the version shipped by Ubuntu 22.04 is too new for the relatively old 5.4 kernel [1].

1: https://www.spinics.net/lists/kernel/msg3797871.html

asia-makai commented 2 years ago

@x1tan Oops, I see.. that's what I've feared. Downgrading binutils causes a domino effect, doesn't it? I.e., won't I end up downgrading half of my packages, incl gcc? Thanks!

Wenzel commented 2 years ago

so by googling the error I stumbled upon this thread: https://lore.kernel.org/lkml/YAlUUBs2qPIqLgCt@xps-13-7390/T/

Which mentions kernel preemption and playing with the config, I managed to build the kernel on ubuntu 22.04:

./scripts/config --enable PREEMPT

Not sure why it works at this point, didn't dig in, but it's a workaround.

asia-makai commented 2 years ago

Thanks @Wenzel!

I've made further steps, so that it compiles. (Options below). Then I had to disable secure boot in my BIOS (to avoid signing the kernel), but it panics... Have you seen that one with your Ubuntu 22.04 by any chance?

IMG_2922

My config script:

make distclean
make olddefconfig
./scripts/config --enable KVM
./scripts/config --enable KVM_INTEL
./scripts/config --enable KVM_AMD
./scripts/config --enable KVM_INTROSPECTION
./scripts/config --disable TRANSPARENT_HUGEPAGE
./scripts/config --enable REMOTE_MAPPING
./scripts/config --enable PREEMPT

# https://askubuntu.com/questions/1329538/compiling-the-kernel-5-11-11
./scripts/config --disable SYSTEM_TRUSTED_KEYS
./scripts/config --disable SYSTEM_REVOCATION_KEYS

./scripts/config --disable DEBUG_INFO_BTF
Wenzel commented 2 years ago

Are you using XFS as the main partition filesystem by any chance ?

I think i remember having this issue, and the problem was related to a driver fs driver (not present by default on 5.4 kernel, but present on newer ones, which explains why it won't boot)

Have a look at that and regenerate the initramfs

asia-makai commented 2 years ago

@Wenzel yes, you've seen it all! Impressive :) Thank you! I'll dig further.

asia-makai commented 2 years ago

I had ext4. It boots now @Wenzel!

Other things I had to do:

I'll see if i manage to get network connection ;)

But I fear that I'll need to port your work to a more recent kernel... Do you have a recommendation or just a meld/diff? (I used to intensively play with a Nitro-like system, but this was 7 years ago ;)) Thank you

Wenzel commented 2 years ago

Awesome news ! Thanks for the tips 👍 Now waiting for your pull requests 💪

Regarding rebasing the patches, that's huge task that you are undertaking, so be careful :)

You might to have a chat with @adlazar on the Slack channel about this.

asia-makai commented 2 years ago

Thank you for your help! :)

netanelc305 commented 1 year ago

How you deal with new hardware? I encounter a lot of drivers issues since the kernel is old