lkrg-org / lkrg

Linux Kernel Runtime Guard
https://lkrg.org
Other
402 stars 72 forks source link

Linux post-6.3 'struct module' has no member named 'core_layout' #267

Closed solardiz closed 11 months ago

solardiz commented 1 year ago

https://github.com/lkrg-org/lkrg/actions/runs/4829549515/jobs/8604723001

make[1]: Entering directory '/usr/src/linux-headers-6.3.0-060300daily20230428-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.2.0-17ubuntu1) 12.2.0
  You are using:           gcc-12 (Ubuntu 12.2.0-17ubuntu1) 12.2.0
  CC [M]  /root/src/src/modules/ksyms/p_resolve_ksym.o
  CC [M]  /root/src/src/modules/hashing/p_lkrg_fast_hash.o
In file included from /root/src/src/modules/ksyms/../../p_lkrg_main.h:405,
                 from /root/src/src/modules/ksyms/p_resolve_ksym.c:19:
/root/src/src/modules/ksyms/../../modules/wrap/p_struct_wrap.h: In function 'p_module_core':
/root/src/src/modules/ksyms/../../modules/wrap/p_struct_wrap.h:106:16: error: 'struct module' has no member named 'core_layout'
  106 |    return p_mod->core_layout.base;
      |                ^~
Adam-pi3 commented 1 year ago

New changes are coming which we need to take into account: https://github.com/torvalds/linux/commit/ac3b43283923440900b4f36ca5f9f0b1ca43b70e

solardiz commented 1 year ago

Linux 6.3 had been released a few days before this change was merged, which was part of tag modules-6.4-rc1. So LKRG builds on the Linux 6.3 release fine, and we need to fix this issue in time for 6.4 (of course, the sooner the better).

https://github.com/torvalds/linux/commit/b6a7828502dc769e1a5329027bc5048222fa210a

Adam-pi3 commented 1 year ago

As for now, I've added verification against KERNEL_VERSION(6, 4, 0) which means before LINUX_VERSION_CODE is bumped we would see compilation failure. If some of the changes are going to be adopted in 6.3.2+, we can adjusted necessary KERNEL_VERSION checks.

solardiz commented 11 months ago

This issue is fixed, so I'll close, but we need to remember to document it properly in our next release. We haven't updated CHANGES since the LKRG 0.9.6 release last December - that's not great. I assume we'll go over the commits to produce a new CHANGES entry for the next release.