Skip to content

CI: make in ./sev-snp-simulator dir fails with fatal error: passing argument 1 of ‘class_create’ from incompatible pointer type #242

@gapisback

Description

@gapisback

CI Job for PR #241 fails with following hard error:

make[1]: Leaving directory '/usr/src/linux-headers-6.5.0-1018-azure'
rm -f modules.order Module.symvers Module.markers *.o *.cmd sevnull.ko
rm -rf keys
make -C /lib/modules/6.5.0-1018-azure/build M=/home/runner/work/certifier-framework-for-confidential-computing/certifier-framework-for-confidential-computing/sev-snp-simulator modules
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-1018-azure'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  CC [M]  /home/runner/work/certifier-framework-for-confidential-computing/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.o
In file included from ./include/linux/linkage.h:7,
                 from ./arch/x86/include/asm/cache.h:5,
                 from ./include/linux/cache.h:6,
                 from ./include/linux/time.h:5,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:13,
                 from /home/runner/work/certifier-framework-for-confidential-computing/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.c:14:
/home/runner/work/certifier-framework-for-confidential-computing/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.c: In function ‘sev_guest_init_module’:
./include/linux/export.h:29:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   29 | #define THIS_MODULE (&__this_module)
      |                     ~^~~~~~~~~~~~~~~
      |                      |
      |                      struct module *
/home/runner/work/certifier-framework-for-confidential-computing/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.c:355:28: note: in expansion of macro ‘THIS_MODULE’
  355 |   sev_class = class_create(THIS_MODULE, DEVICE_NAME);
      |                            ^~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:251: /home/runner/work/certifier-framework-for-confidential-computing/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.o] Error 1
make[2]: *** [/usr/src/linux-headers-6.5.0-1018-azure/Makefile:2039: /home/runner/work/certifier-framework-for-confidential-computing/certifier-framework-for-confidential-computing/sev-snp-simulator] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.5.0-1018-azure'
make: *** [Makefile:22: modules] Error 2
 

CI's build.yml specifies: runs-on: ubuntu-latest

I am able to reproduce this on my Linux-VM running: Ubuntu 22.04.4 LTS jammy

Somethings seem to have changed in Linux system / include files. By default, if you do the following:

$ cd ./sev-snp-simulator

$ make

This will fail with:

agurajada-Linux-Vm:[31] $ make
make -C /lib/modules/6.5.0-27-generic/build M=/home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator modules
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-27-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.3.0-1ubuntu1~22.04) 12.3.0
  You are using:
  CC [M]  /home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.o
/bin/sh: 1: gcc-12: not found
make[3]: *** [scripts/Makefile.build:251: /home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.o] Error 127
make[2]: *** [/usr/src/linux-headers-6.5.0-27-generic/Makefile:2039: /home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator] Error 2

Fix this by installing gcc-12 (for whatever reasons): $ sudo apt-get install -y gcc-12

Upon re-run this make command now fails with the same signature of failure as seen in CI job:

agurajada-Linux-Vm:[43] $ make
make -C /lib/modules/6.5.0-27-generic/build M=/home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator modules
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-27-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.3.0-1ubuntu1~22.04) 12.3.0
  You are using:           gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  CC [M]  /home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.o
In file included from ./include/linux/linkage.h:7,
                 from ./arch/x86/include/asm/cache.h:5,
                 from ./include/linux/cache.h:6,
                 from ./include/linux/time.h:5,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:13,
                 from /home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.c:14:
/home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.c: In function ‘sev_guest_init_module’:
./include/linux/export.h:29:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   29 | #define THIS_MODULE (&__this_module)
      |                     ~^~~~~~~~~~~~~~~
      |                      |
      |                      struct module *
/home/agurajada/Projects/certifier-framework-for-confidential-computing/sev-snp-simulator/sevguest.c:355:28: note: in expansion of macro ‘THIS_MODULE’
  355 |   sev_class = class_create(THIS_MODULE, DEVICE_NAME);
      |                            ^~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: some warnings being treated as errors

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions