[Issue]: dkms: false positive in HDMI/DP colorspace property checks due to missing AC_KERNEL_DO_BACKGROUND
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 460
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
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.oin the top-level build directory. - Missing Sandbox:
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). - Compiler Failure:
gccfails to compile the 2-argument test code due to argument mismatch and exits. It does not overwrite or generate a newconftest.o. - Pipeline Deception: In x86 Kbuild environments, the compilation pipeline captured in
$CFLAGSchainsobjtoolexecution with a semicolon (e.g.,gcc ... -c -o conftest.o conftest.c ; objtool check ... conftest.o). The shell ignoresgcc's exit code. - False Positive:
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_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
Paste output here
Additional Information
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with m4/drm_mode_create_hdmi_colorspace_property.m4 and inspect existing uses of AC_KERNEL_DO_BACKGROUND alongside the two colorspace probes. Reproduce or verify the configure checks against Linux 5.17, then confirm both probes run in isolated directories and no stale conftest.o produces a false positive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100