libs icon indicating copy to clipboard operation
libs copied to clipboard

compilation error on RHEL >= 9.4

Open andrei-danschikov opened this issue 1 year ago • 5 comments

hi there! we are facing scap module compilation error on RHEL 9.4:

**_CC [M] /var/lib/dkms/scap/7.0.0+driver/build/main.o In file included from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from ./include/linux/list.h:9, from ./include/linux/smp.h:12, from ./include/linux/tracepoint.h:15, from ./include/trace/syscall.h:5, from /var/lib/dkms/scap/7.0.0+driver/build/main.c:14: /var/lib/dkms/scap/7.0.0+driver/build/main.c: In function 'scap_init': ./include/linux/export.h:17:22: error: passing argument 1 of 'class_create' from incompatible pointer type [-Werror=incompatible-pointer-types] 17 | #define THIS_MODULE (&__this_module) | ~^~~~~~~~~~~~~~~ | | | struct module * /var/lib/dkms/scap/7.0.0+driver/build/main.c:2877:36: note: in expansion of macro 'THIS_MODULE' 2877 | g_ppm_class = class_create(THIS_MODULE, DRIVER_DEVICE_NAME); | ^~~~~~~~~~~ In file included from ./include/linux/device.h:31, from ./include/linux/node.h:18, from ./include/linux/cpu.h:17, from ./include/linux/static_call.h:135, from ./include/linux/tracepoint.h:22: ./include/linux/device/class.h:230:54: note: expected 'const char *' but argument is of type 'struct module ' 230 | struct class * __must_check class_create(const char name); | ~~~~~~~~~~~~^~~~ /var/lib/dkms/scap/7.0.0+driver/build/main.c:2877:23: error: too many arguments to function 'class_create' 2877 | g_ppm_class = class_create(THIS_MODULE, DRIVER_DEVICE_NAME); | ^~~~~~~~~~~~ ./include/linux/device/class.h:230:29: note: declared here 230 | struct class * _must_check class_create(const char *name); | ^~~~~~~~~~~~ cc1: some warnings being treated as errors

As we understand class_create patch backported to ReadHat, if we make the following change the compilation succeeds: if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)) || (PPM_RHEL_RELEASE_CODE > 0 && PPM_RHEL_RELEASE_CODE >= PPM_RHEL_RELEASE_VERSION(9, 4)) g_ppm_class = class_create(DRIVER_DEVICE_NAME); else g_ppm_class = class_create(THIS_MODULE, DRIVER_DEVICE_NAME); endif

is it possible to add the above to scap driver code?

andrei-danschikov avatar Jun 07 '24 08:06 andrei-danschikov

Good day. We have the same issue. Is it possible to fix RHEL >= 9.4 compilation error?

albe19029 avatar Jun 13 '24 09:06 albe19029

Hi! Thanks for opening this issue! This build failure should've been already addressed by https://github.com/falcosecurity/libs/pull/1452 in 7.2.0+driver, that is part of Falco 0.38.0. Can you test with it?

FedeDP avatar Jun 13 '24 09:06 FedeDP

I see that there are configure folder with test modules starting from 7.1.0+driver. And changes are there in image starting from sysdig 0.37.0. This should work. Thanks a lot for help

albe19029 avatar Jun 13 '24 10:06 albe19029

I see that there are configure folder with test modules starting from 7.1.0+driver

Exactly :)

FedeDP avatar Jun 13 '24 12:06 FedeDP

/milestone 0.18.0

FedeDP avatar Jun 13 '24 12:06 FedeDP