Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Building custom kernel modules requires CONFIG_STACK_VALIDATION= in 1.4.0 #2374

Closed
ryansch opened this issue May 31, 2018 · 8 comments · Fixed by rancher/os-kernel#61
Closed

Comments

@ryansch
Copy link

ryansch commented May 31, 2018

RancherOS Version: (ros os version)
v1.4.0
Where are you running RancherOS? (docker-machine, AWS, GCE, baremetal, etc.)
docker-machine

I have side by side attempts to build https://github.com/maK-/SimplestLKM in a container with the `kernel-headers' service enabled.

1.3.0:

# make
make -C /lib/modules/4.9.80-rancher/build M=/root/SimplestLKM modules
make[1]: Entering directory '/lib/modules/4.9.80-rancher/build'
  CC [M]  /root/SimplestLKM/hello.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /root/SimplestLKM/hello.mod.o
  LD [M]  /root/SimplestLKM/hello.ko
make[1]: Leaving directory '/lib/modules/4.9.80-rancher/build'

1.4.0:

# make
make -C /lib/modules/4.14.32-rancher2/build M=/root/SimplestLKM modules
make[1]: Entering directory '/lib/modules/4.14.32-rancher2/build'
make[2]: *** No rule to make target 'tools/objtool/objtool', needed by '/root/SimplestLKM/hello.o'.  Stop.
Makefile:1528: recipe for target '_module_/root/SimplestLKM' failed
make[1]: *** [_module_/root/SimplestLKM] Error 2
make[1]: Leaving directory '/lib/modules/4.14.32-rancher2/build'
Makefile:12: recipe for target 'default' failed
make: *** [default] Error 2
@ryansch
Copy link
Author

ryansch commented May 31, 2018

This specifically prevents us from building the parallels guest tools.

@ryansch
Copy link
Author

ryansch commented May 31, 2018

More information:
https://lists.debian.org/debian-knoppix/2017/01/msg00002.html

# make CONFIG_STACK_VALIDATION= works

@ryansch
Copy link
Author

ryansch commented May 31, 2018

@ryansch
Copy link
Author

ryansch commented Jun 1, 2018

Here's a functional workaround for this issue: outstand/docker-parallels-tools@6f0188f

@niusmallnan
Copy link
Contributor

Yes, I also feel pain for it.

The build failure appears to have been introduced by a regression in the kernel packaging which breaks all out-of-tree-module builds. The objtool binary is no longer being included and it is required for external module builds when the kernel is compiled with CONFIG_STACK_VALIDATION=y.

@ryansch ryansch changed the title Building custom kernel modules is broken in 1.4.0 Building custom kernel modules requires CONFIG_STACK_VALIDATION= in 1.4.0 Jun 4, 2018
@niusmallnan niusmallnan added this to the v1.5.0 milestone Jun 5, 2018
@zhoubofsy
Copy link

zhoubofsy commented Jul 2, 2018

@ryansch @niusmallnan
Kernel with CONFIG_STACK_VALIDATION, it use objtool to perform stack metadata validation on object file ("*.o") when compile third kernel modules. The objtool is generated in ./tool/objtool directory when building kernel, but there isn't objtool in RancherOS.

There are three way to eliminate influence of STACK_VALIDATAION :

1. Compile source with "CONFIG_STACK_VALIDATION=", it doesn't perform stack metadate validation
2. Copy the objtool into RancherOS and build again
3. Rebuild kernel without "STACK_VALIDATION" of "arch/Kconfig", and chose "CONFIG_UNWINDER_GUESS" instead of "CONFIG_UNWINDER_ORC" or "CONFIG_UNWINDER_FRAME_POINTER"

I recommend the first.
Edit by @niusmallnan: recommend the second.

@rootwuj
Copy link

rootwuj commented Aug 28, 2018

Tested with RancherOS version- v1.4.1-rc2 with AWS.
This version can successfully build SimplestLKM.

@niusmallnan
Copy link
Contributor

Backported to v1.4.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants