The C compiler version that was used for compiling the kernel is incompatible with the current version of the compiler available in the repositories. Any attempt for building DKMS modules against linux-hardened fails (at least on my system) with the following error message :
% sudo dkms install --no-depmod binder/1 -k 6.12.12-hardened1-1-hardened
Cleaning build area... done.
Building module(s)...(bad exit status: 2)
Failed command:
make -j12 KERNELRELEASE=6.12.12-hardened1-1-hardened all KERNEL_SRC=/lib/modules/6.12.12-hardened1-1-hardened/build
Error! Bad return status for module build on kernel: 6.12.12-hardened1-1-hardened (x86_64)
Consult /var/lib/dkms/binder/1/build/make.log for more information.
The log file contains the following information (here's the example with the binder module but it is the same no matter what the module I'm trying to build is :
DKMS (dkms-3.1.5) make.log for binder/1 for kernel 6.12.12-hardened1-1-hardened (x86_64)
Tue Feb 11 [redacted] 2025
Cleaning build area
# command: make clean
rm -rf *.o *.ko *.mod.c *.symvers *.order .*.cmd .tmp_versions
# exit code: 0
# elapsed time: 00:00:00
Building module(s)
# command: make -j12 KERNELRELEASE=6.12.12-hardened1-1-hardened all KERNEL_SRC=/lib/modules/6.12.12-hardened1-1-hardened/build
make -C /lib/modules/6.12.12-hardened1-1-hardened/build V=0 M=$PWD
make[1]: Entering directory '/usr/lib/modules/6.12.12-hardened1-1-hardened/build'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (GCC) 14.2.1 20250128
You are using: gcc (GCC) 14.2.1 20250207
CC [M] /var/lib/dkms/binder/1/build/deps.o
CC [M] /var/lib/dkms/binder/1/build/binder.o
CC [M] /var/lib/dkms/binder/1/build/binder_alloc.o
CC [M] /var/lib/dkms/binder/1/build/binderfs.o
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/stackleak_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so
cc1: error: incompatible gcc/plugin versions
make[3]: *** [scripts/Makefile.build:229: /var/lib/dkms/binder/1/build/deps.o] Error 1
make[3]: *** Waiting for unfinished jobs....
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/stackleak_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/stackleak_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/stackleak_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so
make[3]: *** [scripts/Makefile.build:229: /var/lib/dkms/binder/1/build/binder.o] Error 1
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so
make[3]: *** [scripts/Makefile.build:229: /var/lib/dkms/binder/1/build/binderfs.o] Error 1
make[3]: *** [scripts/Makefile.build:229: /var/lib/dkms/binder/1/build/binder_alloc.o] Error 1
make[2]: *** [/usr/lib/modules/6.12.12-hardened1-1-hardened/build/Makefile:1937: /var/lib/dkms/binder/1/build] Error 2
make[1]: *** [Makefile:224: __sub-make] Error 2
make[1]: Leaving directory '/usr/lib/modules/6.12.12-hardened1-1-hardened/build'
make: *** [Makefile:8: all] Error 2
# exit code: 2
# elapsed time: 00:00:01
gcc version: 14.2.1+r753+g1cd744a6828f-1
linux-hardened & linux-hardened-headers version: 6.12.12.hardened1-1
dkms version: 3.1.5-1