fix(dkms): run ./configure on the correct kernel headers - #1787
Merged
Conversation
Closed
robertbaldyga
requested changes
Aug 4, 2026
Member
|
The overall idea behind those changes is great, but as it goes with LLM generated code, there is a huge imbalance between paranoid defensiveness and corner case blindness :) |
kaysond
force-pushed
the
master
branch
3 times, most recently
from
August 11, 2026 16:37
56022a4 to
9180411
Compare
Contributor
Author
|
@robertbaldyga - I took a look at everything and updated the build setup and commit history as requested.
Let me know if you have any more feedback, esp. on whether I should squash the first two commits together |
Contributor
Author
|
bump. @robertbaldyga - any feedback? |
robertbaldyga
requested changes
Aug 19, 2026
Member
One small comment + please look at the checkpatch output. |
kaysond
force-pushed
the
master
branch
2 times, most recently
from
August 19, 2026 23:55
ea279c7 to
a8caf21
Compare
'./configure' always probed the running kernel, which is wrong whenever the modules are built for a different one. Add '--kernel-dir' to point it at an explicit kernel, and describe it (and the config file argument) in a new '--help' message. The kernel is now taken solely from that option, falling back to the running kernel. Reading KERNEL_DIR from the environment as well would leave two ways of saying the same thing, so the RPM spec is updated to pass the directory it exports for 'make' to './configure' too. The CONFIG_UNWINDER_ORC check reads its .config from the selected kernel directory as well; it searched /usr/src/ for a directory named after the running kernel, which would have had './configure' probe one kernel and inspect another one's configuration. Signed-off-by: Aram Akhavan <1147328+kaysond@users.noreply.github.com>
The CONFIG_UNWINDER_ORC check reads the kernel's .config, but header packages of some distributions ship none, so the check was skipped and the user was left with the "unable to find kernel config" warning on a perfectly usable kernel directory. Such packages still carry the resolved configuration in include/config/auto.conf, so read that when there is no .config. Signed-off-by: Aram Akhavan <1147328+kaysond@users.noreply.github.com>
DKMS builds the modules for every installed kernel, but PRE_BUILD ran a bare './configure', which probed the running kernel. On any kernel other than the running one the generated header described the wrong kernel API, so the build either failed or produced modules compiled against mismatched definitions. Pass the kernel DKMS is building for to './configure', and pass the same directory to 'make' so both halves of the build agree on it. Fixes Open-CAS#1772 Signed-off-by: Aram Akhavan <1147328+kaysond@users.noreply.github.com>
… one Nothing tied generated_defines.h to the kernel it was generated for, so running './configure' for one kernel and 'make' for another silently compiled the modules against an API description that does not match the kernel headers in use, failing with unrelated-looking compiler errors. Record the probed kernel in config.out and carry it over into generated_defines.h as CAS_CONFIGURED_KERNEL_DIR. Keeping it in the config file rather than a stamp of its own means a header generated from a saved config states the kernel too, and keeping it in the header means 'make' needs to know nothing about where the config lives. modules/Makefile now compares it with the kernel it is about to build against and stops with an explanation if the two differ. Headers generated before this change carry no such define and are built as before. Signed-off-by: Aram Akhavan <1147328+kaysond@users.noreply.github.com>
robertbaldyga
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1772
This was written by Claude Opus, so it's a little aggressive in preventing the issue from occurring, as coding agents tend to be defensive at paranoid levels. I figured I'd leave it all here in case any of it is desirable for the team.
Please feel free to leave feedback then I'll clean up/update the PR manually.