Problem Description
Issue Description
The DKMS configure script produces false positives for drm_mode_create_hdmi_colorspace_property and drm_mode_create_dp_colorspace_property on older kernels (e.g., v5.17) that only support the 1-argument version of these functions.
Latent Bug Nature & Reproduction
This bug is currently masked in the vanilla AMDGPU tree purely due to macro execution order (preceding foreground tests happen to fail or not leave a valid conftest.o). However, it reliably breaks downstream forks or custom backports that introduce a successful foreground macro just before these colorspace checks.
Time-oriented Execution Flow & Root Cause
The issue stems from a missing sandbox isolation wrapper, which causes a sequential state contamination when combined with the Kbuild toolchain.
- State Contamination: A prior synchronous test in the configuration sequence succeeds, leaving a valid
conftest.o in the top-level build directory.
- Missing Sandbox:
AC_AMDGPU_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY is executed. Because it lacks the AC_KERNEL_DO_BACKGROUND wrapper, it runs synchronously in the same polluted top-level directory instead of a clean, isolated temporary directory (mktemp -d).
- Compiler Failure:
gcc fails to compile the 2-argument test code due to argument mismatch and exits. It does not overwrite or generate a new conftest.o.
- Pipeline Deception: In x86 Kbuild environments, the compilation pipeline captured in
$CFLAGS chains objtool execution with a semicolon (e.g., gcc ... -c -o conftest.o conftest.c ; objtool check ... conftest.o). The shell ignores gcc's exit code.
- False Positive:
objtool runs, validates the stale conftest.o left by step 1, and returns 0. AC_KERNEL_COMPILE_IFELSE catches this 0 and incorrectly defines HAVE_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY_2ARGS.
Suggested Fix
Wrap the affected macros in AC_KERNEL_DO_BACKGROUND to align with the existing concurrent probing architecture. This ensures they execute in ephemeral, isolated directories, completely avoiding stale object files.
--- a/m4/drm_mode_create_hdmi_colorspace_property.m4
+++ b/m4/drm_mode_create_hdmi_colorspace_property.m4
@@ -1,13 +1,15 @@
AC_DEFUN([AC_AMDGPU_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY], [
- AC_KERNEL_TRY_COMPILE_SYMBOL([
- #include <drm/drm_connector.h>
- ], [
- drm_mode_create_hdmi_colorspace_property(NULL, 0);
- ], [drm_mode_create_hdmi_colorspace_property], [drivers/gpu/drm/drm_connector.c], [
- AC_DEFINE(HAVE_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY_2ARGS, 1,
- [drm_mode_create_hdmi_colorspace_property() has 2 args])
- ])
+ AC_KERNEL_DO_BACKGROUND([
+ AC_KERNEL_TRY_COMPILE_SYMBOL([
+ #include <drm/drm_connector.h>
+ ], [
+ drm_mode_create_hdmi_colorspace_property(NULL, 0);
+ ], [drm_mode_create_hdmi_colorspace_property], [drivers/gpu/drm/drm_connector.c], [
+ AC_DEFINE(HAVE_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY_2ARGS, 1,
+ [drm_mode_create_hdmi_colorspace_property() has 2 args])
+ ])
+ ])
])
dnl #
@@ -15,12 +17,14 @@
dnl # drm/connector: Allow drivers to pass list of supported colorspaces
dnl #
AC_DEFUN([AC_AMDGPU_DRM_MODE_CREATE_DP_COLORSPACE_PROPERTY], [
- AC_KERNEL_TRY_COMPILE_SYMBOL([
- #include <drm/drm_connector.h>
- ], [
- drm_mode_create_dp_colorspace_property(NULL, 0);
- ], [drm_mode_create_dp_colorspace_property], [drivers/gpu/drm/drm_connector.c], [
- AC_DEFINE(HAVE_DRM_MODE_CREATE_DP_COLORSPACE_PROPERTY_2ARGS, 1,
- [drm_mode_create_dp_colorspace_property() has 2 args])
- ])
+ AC_KERNEL_DO_BACKGROUND([
+ AC_KERNEL_TRY_COMPILE_SYMBOL([
+ #include <drm/drm_connector.h>
+ ], [
+ drm_mode_create_dp_colorspace_property(NULL, 0);
+ ], [drm_mode_create_dp_colorspace_property], [drivers/gpu/drm/drm_connector.c], [
+ AC_DEFINE(HAVE_DRM_MODE_CREATE_DP_COLORSPACE_PROPERTY_2ARGS, 1,
+ [drm_mode_create_dp_colorspace_property() has 2 args])
+ ])
+ ])
])
Operating System
Linux 5.17
CPU
Hygon C86-3G
GPU
None
ROCm Version
ROCm 6.0.0
ROCm Component
No response
Steps to Reproduce
No response
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
rocminfo --support output
Additional Information
No response
Problem Description
Issue Description
The DKMS
configurescript produces false positives fordrm_mode_create_hdmi_colorspace_propertyanddrm_mode_create_dp_colorspace_propertyon older kernels (e.g., v5.17) that only support the 1-argument version of these functions.Latent Bug Nature & Reproduction
This bug is currently masked in the vanilla AMDGPU tree purely due to macro execution order (preceding foreground tests happen to fail or not leave a valid
conftest.o). However, it reliably breaks downstream forks or custom backports that introduce a successful foreground macro just before these colorspace checks.Time-oriented Execution Flow & Root Cause
The issue stems from a missing sandbox isolation wrapper, which causes a sequential state contamination when combined with the Kbuild toolchain.
conftest.oin the top-level build directory.AC_AMDGPU_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTYis executed. Because it lacks theAC_KERNEL_DO_BACKGROUNDwrapper, it runs synchronously in the same polluted top-level directory instead of a clean, isolated temporary directory (mktemp -d).gccfails to compile the 2-argument test code due to argument mismatch and exits. It does not overwrite or generate a newconftest.o.$CFLAGSchainsobjtoolexecution with a semicolon (e.g.,gcc ... -c -o conftest.o conftest.c ; objtool check ... conftest.o). The shell ignoresgcc's exit code.objtoolruns, validates the staleconftest.oleft by step 1, and returns0.AC_KERNEL_COMPILE_IFELSEcatches this0and incorrectly definesHAVE_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY_2ARGS.Suggested Fix
Wrap the affected macros in
AC_KERNEL_DO_BACKGROUNDto align with the existing concurrent probing architecture. This ensures they execute in ephemeral, isolated directories, completely avoiding stale object files.Operating System
Linux 5.17
CPU
Hygon C86-3G
GPU
None
ROCm Version
ROCm 6.0.0
ROCm Component
No response
Steps to Reproduce
No response
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
rocminfo --support output
Additional Information
No response