Darling: LKM: incorrect vermagic

Created on 7 May 2018  路  11Comments  路  Source: darlinghq/darling

I am trying to build darling on Ubuntu16.04 but the build fails with the following error:

[ 95%] Building CXX object src/external/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/runtime/CommonIdentifiers.o
clang: error: unable to execute command: Killed
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-apple-darwin11
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: Error generating preprocessed source(s) - cannot generate preprocessed source with multiple -arch options.
src/external/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/build.make:4598: recipe for target 'src/external/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/runtime/CommonIdentifiers.o' failed
make[2]: *** [src/external/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/runtime/CommonIdentifiers.o] Error 254
CMakeFiles/Makefile2:51126: recipe for target 'src/external/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/all' failed
make[1]: *** [src/external/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/all] Error 2
Makefile:127: recipe for target 'all' failed


root@UbuntuSixteen:~/darling/build/src/external# uname -r
4.13.0-39-generic

root@UbuntuSixteen:~/darling/build/src/external# clang --version
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Please help resolve this.
Linux Kernel Module

Most helpful comment

I can reproduce this:

$ modinfo /usr/lib/modules/4.16.7-300.fc28.x86_64/extra/darling-mach.ko
filename:       /usr/lib/modules/4.16.7-300.fc28.x86_64/extra/darling-mach.ko
license:        GPL
depends:        
retpoline:      Y
name:           darling_mach
vermagic:       4.16.7-200.fc27.x86_64 SMP mod_unload 

I have both 4.16.7-300.fc28 and 4.16.7-200.fc27 installed, it seems the kernel build system gets confused somewhere over them both being 4.16.7. uname -r, as used by src/lkm/Makefile, correctly reports 4.16.7-300.fc28.x86_64.

After a dnf remove kernel-4.16.7-200.fc27, the issue went away.

All 11 comments

How much ram do you have?

Its a VM on a ESX host. It has 1GB RAM.

That sure looks like one of your compiler processes was OOM-killed. Try just running make again; if that doesn't help make sure you're not running too much compiler processes in parallel (as would be the case with e.g. make -j8), or increase RAM (and/or swap) size.

Hi , After increasing the RAM to 4GB, I was able to compile and install. But when i run "darling shell", I get the following error:

root@UbuntuSixteen:/lib/modules# darling shell
modprobe: ERROR: could not insert 'darling_mach': Exec format error
Failed to load the kernel module

Dmesg has the following logs:
[14586.647297] darling_mach: version magic '4.13.0-38-generic SMP mod_unload ' should be '4.13.0-39-generic SMP mod_unload '

root@UbuntuSixteen:/lib/modules# uname -r
4.13.0-39-generic

Please help.

Regards,
Muthu

This looks like the kernel module was built for a different version of the kernel that you are trying to use it with.

If you have recently updated your kernel, try rebooting to the new one first.

The kernel was upgraded from 4.10.0.28 to 4.10.0.39. But I started the build process after the kernel upgrade.

@lmuthu please try to re-build and re-install lkm

I can reproduce this:

$ modinfo /usr/lib/modules/4.16.7-300.fc28.x86_64/extra/darling-mach.ko
filename:       /usr/lib/modules/4.16.7-300.fc28.x86_64/extra/darling-mach.ko
license:        GPL
depends:        
retpoline:      Y
name:           darling_mach
vermagic:       4.16.7-200.fc27.x86_64 SMP mod_unload 

I have both 4.16.7-300.fc28 and 4.16.7-200.fc27 installed, it seems the kernel build system gets confused somewhere over them both being 4.16.7. uname -r, as used by src/lkm/Makefile, correctly reports 4.16.7-300.fc28.x86_64.

After a dnf remove kernel-4.16.7-200.fc27, the issue went away.

I resolved this on Ubuntu with the following (all paths relative to the Darling source root unless otherwise noted):

  1. apt autoremove
  2. find src/lkm -name \*.o -delete
  3. rm src/lkm/darling-mach.ko
  4. rm -rf src/lkm (In build root, very important this time)
  5. make lkm (In build root)
  6. make lkm_install (In build root)

@bugaevc @lmuthu @stek29 I am getting this issue on Ubuntu 18.10. Our kernel module build system appears to build for the older kernel while installing to the folder for the newer kernel.

I have narrowed down the issue to the kernel build system not rebuilding darling-mach.mod.o, which is built once and never rebuilt when the kernel version changes. It contains the vermagic. I am going to implement a workaround.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pmannle picture pmannle  路  7Comments

LubosD picture LubosD  路  5Comments

josepmc picture josepmc  路  5Comments

LubosD picture LubosD  路  3Comments

xlmnxp picture xlmnxp  路  7Comments