Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gapisback opened this issue Apr 25, 2024 · 6 comments
Assignees

Comments

@gapisback
Copy link
Collaborator

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
@gapisback gapisback self-assigned this Apr 25, 2024
@gapisback
Copy link
Collaborator Author

Hi, @rgerganov @yelvmw -- can you help give this issue a fresh look?

This is a brand-new failure happening in CI when I started a PR to merge some doc-changes.
Before I do some deep-dive investigation, would like a quick cross-check from your Linux env.

From my initial investigation, it appears that some Linux system / headers interfaces have changed.

If you have an active Linux-VM on which this CFCC repo was building correctly before, can you please try the following out and let me know how it works?

(Cut-n-paste your outputs here as a reply, so it's publicly visible.)

cd ./sev-snp-simulator
make

This used to build just fine previously.

If you run into an error that /bin/sh: 1: gcc-12: not found, I "worked-around it" by installing gcc-12, as: sudo apt-get install -y gcc-12.

But I am not sure why that should even be necessary.

@gapisback
Copy link
Collaborator Author

gapisback commented Apr 25, 2024

History: The last successful PR that was merged into this repo was in Dec 2023 (PR #232), after which this repo was moved to CCC's ci-infra.

So, that might be one cause for the drift in Linux rev-levels, triggering some build issue.

@gapisback gapisback changed the title CI: make in ./sev-snp-simulator dir fails with fatal error: error: passing argument 1 of ‘class_create’ from incompatible pointer type CI: make in ./sev-snp-simulator dir fails with fatal error: passing argument 1 of ‘class_create’ from incompatible pointer type Apr 25, 2024
gapisback added a commit that referenced this issue Apr 25, 2024
This commit attempts to keep the CI tests runing cleanly. Some tests
are failing due to different issues reported under issue #242
and #244. Those will need some minor corrections in build-steps.
For now, 5 test-cases from test.sh are commented out with a
Warning message.

- Skip few simulated-SEV related build-and-test cases.
- Skip ISLET-related build-and-test tests due to rustc version
  incompatibility.

Those will need to be re-enabled when above two issues are resolved,
if possible.

(If further investigation shows that we cannot support Ubunutu 22.04,
then some changes will need to be made in CI's build.yml to drop-down
to an older Ubuntu rev-level.)
@yelvmw
Copy link
Contributor

yelvmw commented May 3, 2024

Looks like a kernel 6.4 change to API. We might want to try this:

+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
   sev_class = class_create(THIS_MODULE, DEVICE_NAME);
+#else
+  sev_class = class_create(DEVICE_NAME);
+#endif

@yelvmw
Copy link
Contributor

yelvmw commented May 3, 2024

I'm actually not sure about the exact version. Got some hints from discussions elsewhere. Can you confirm the CI environment kernel version?

gapisback added a commit that referenced this issue May 3, 2024
This commit attempts to keep the CI tests runing cleanly. Some tests
are failing due to different issues reported under issue #242
and #244. Those will need some minor corrections in build-steps.
For now, 5 test-cases from test.sh are commented out with a
Warning message.

- Skip few simulated-SEV related build-and-test cases.
- Skip ISLET-related build-and-test tests due to rustc version
  incompatibility.

Those will need to be re-enabled when above two issues are resolved,
if possible.

(If further investigation shows that we cannot support Ubunutu 22.04,
then some changes will need to be made in CI's build.yml to drop-down
to an older Ubuntu rev-level.)
@gapisback
Copy link
Collaborator Author

Thanks for the tip, @yelvmw, that looks promising. -- I'll work on this after Sangwan checks-in his Islet-cleanup PR.

Will let you know what I find out about Linux kernel version.

@TheBankster
Copy link
Contributor

I did a quick search and found the following suggestion. Wonder if this is relevant.
Is this still a problem for others? It is for me.

https://kb.meinbergglobal.com/kb/driver_software/driver_software_for_linux/troubleshooting_build_problems/build_error_related_to_calling_class_create_function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants