Summary
The AMI kernel module (sw/AMI/driver/ami_program.c) fails to compile on RHEL 9.5+ and its rebuilds (Rocky Linux 9.5, AlmaLinux 9.5, …), because the preprocessor gate around eventfd_signal() only checks LINUX_VERSION_CODE and not RHEL_RELEASE_CODE.
Affected file
sw/AMI/driver/ami_program.c, two sites:
- around line 94 (inside
do_image_download() per-chunk loop)
- around line 153 (the boot-tag rewrite path)
Both look like this today:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
eventfd_signal(efd_ctx);
#else
eventfd_signal(efd_ctx, bytes_to_write);
#endif
Reproduction
-
Install a RHEL 9.5+ or a derivative (e.g. Rocky Linux 9.5) with matching kernel-devel (any kernel-5.14.0-503.*.el9_5 or newer).
-
From AVED main, build the AMI driver:
cd sw/AMI
python3 scripts/gen_package.py -o /tmp/ami-build
-
Build fails:
INFO: [BUILD_CHECK_DRIVER] Executing: $ cd driver && make clean && make
ERROR: [BUILD_CHECK_DRIVER] Step driver compilation confidence check failed: Unexpected non-zero return code (2) for command: cd driver && make clean && make
Root cause
Upstream Linux v6.8 dropped the unused n argument of eventfd_signal():
commit 3652117f854819a148ff0fbe4492587d3520b5e5
Author: Christian Brauner brauner@kernel.org
Date: Tue Oct 17 17:09:25 2023 +0200
eventfd: simplify eventfd_signal()
Red Hat then backported that change into the 5.14-based RHEL 9.5 kernel; it ships in the GA kernel-5.14.0-503.*.el9_5 and all later 9.5/9.6 errata kernels. On those kernels:
LINUX_VERSION_CODE == KERNEL_VERSION(5, 14, 0), so the current >= KERNEL_VERSION(6, 8, 0) gate evaluates false and the compiler picks the two-arg branch, …
- …but
<linux/eventfd.h> only declares the new one-arg form, so the build fails with too many arguments to function 'eventfd_signal'.
The gate is still correct on stock RHEL 9.4 and earlier (two-arg form), and on stock 6.8+ kernels (one-arg form). Only the RHEL 9.5+ backport case is misdetected.
Proposed fix
Extend the gate to also accept RHEL 9.5+ via RHEL_RELEASE_CODE:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0) || \
(defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 5))
eventfd_signal(efd_ctx);
#else
eventfd_signal(efd_ctx, bytes_to_write);
#endif
This matches the pattern already used in this same driver in sw/AMI/driver/ami_cdev.c (around the class_create() and devnode() signature changes).
I'll open a PR with the fix.
Summary
The AMI kernel module (
sw/AMI/driver/ami_program.c) fails to compile on RHEL 9.5+ and its rebuilds (Rocky Linux 9.5, AlmaLinux 9.5, …), because the preprocessor gate aroundeventfd_signal()only checksLINUX_VERSION_CODEand notRHEL_RELEASE_CODE.Affected file
sw/AMI/driver/ami_program.c, two sites:do_image_download()per-chunk loop)Both look like this today:
Reproduction
Install a RHEL 9.5+ or a derivative (e.g. Rocky Linux 9.5) with matching
kernel-devel(anykernel-5.14.0-503.*.el9_5or newer).From AVED
main, build the AMI driver:cd sw/AMI python3 scripts/gen_package.py -o /tmp/ami-buildBuild fails:
Root cause
Upstream Linux v6.8 dropped the unused
nargument ofeventfd_signal():Red Hat then backported that change into the 5.14-based RHEL 9.5 kernel; it ships in the GA
kernel-5.14.0-503.*.el9_5and all later 9.5/9.6 errata kernels. On those kernels:LINUX_VERSION_CODE == KERNEL_VERSION(5, 14, 0), so the current>= KERNEL_VERSION(6, 8, 0)gate evaluates false and the compiler picks the two-arg branch, …<linux/eventfd.h>only declares the new one-arg form, so the build fails withtoo many arguments to function 'eventfd_signal'.The gate is still correct on stock RHEL 9.4 and earlier (two-arg form), and on stock 6.8+ kernels (one-arg form). Only the RHEL 9.5+ backport case is misdetected.
Proposed fix
Extend the gate to also accept RHEL 9.5+ via
RHEL_RELEASE_CODE:This matches the pattern already used in this same driver in
sw/AMI/driver/ami_cdev.c(around theclass_create()anddevnode()signature changes).I'll open a PR with the fix.