2

I would like to know if a Linux Kernel Module can be used with a Linux Kernel version of a higher patch number (last number in the version) than the kernel was compiled against.

Take the following example:

  • You are currently using Linux 4.14.75 for an ARM target
  • I give you an RPM containing an application and kernel module that work together. The module was compiled against the 4.14.75 kernel. The module is loaded with insmod by the application.
  • A security concern arises and you update your target's kernel to 4.14.100.

Given this situation, will the kernel module in the RPM I gave you work with the new kernel?Is it possible to compile a kernel once and have it be compatible with all 4.14 kernels?

I am NOT asking if depmod/modprobe will work or if it is good practice.

Liam Kelly
  • 3,524
  • 1
  • 17
  • 41

1 Answers1

2

"Is it possible to compile a kernel once and have it be compatible with all 4.14 kernels?" If security updates and backports do not break anything, maybe. However there is no stable Kernel API/ABI in the Kernel. Just userland API/ABIs are stable. https://www.phoronix.com/scan.php?page=news_item&px=Linux-Kernel-Stable-API-ABI https://github.com/torvalds/linux/blob/master/Documentation/process/stable-api-nonsense.rst

Here a post to automatically check, if any API/ABI to userland will break/breaks: Linux kernel API changes/additions

For Kernel ABI I found a tool for that (and your use case): https://developers.redhat.com/blog/2018/03/28/analyzing-binary-interface-changes-linux-kernel/

Jay-Pi
  • 343
  • 3
  • 13