Skip to contentSkip to conversation

drm/amd: Taint the kernel when enabling overdrive

PATCH In review Mario Limonciello 2 participants 4 messages Sep 25, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd: Taint the kernel when enabling overdrive

Some distributions have been patching amdgpu to enable overdrive by default which may compromise stability. Furthermore when bug reports are brought upstream it's not obvious that the system has been tampered with.

When overdrive is enabled taint the kernel and leave a critical message in the logs for users so that it's obvious in a bug report it's been tampered with.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index f57411ed2dc2..99717a1d7f61 100644
@@ -3067,6 +3067,11 @@ static int __init amdgpu_init(void)
 	/* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
 	amdgpu_amdkfd_init();
 
+	if (amdgpu_pp_feature_mask & PP_OVERDRIVE_MASK) {
+		add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
+		pr_crit("Overdrive is enabled, please disable it before reporting any bugs.\n");
+	}
+
 	/* let modprobe override vga console setting */
 	return pci_register_driver(&amdgpu_kms_pci_driver);
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 20 lines · Mario Limonciello

Some distributions have been patching amdgpu to enable overdrive by default which may compromise stability. Furthermore when bug reports are brought upstream it's not obvious that the system has been tampered with.

When overdrive is enabled taint the kernel and leave a critical message in the logs for users so that it's obvious in a bug report it's been tampered with.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index f57411ed2dc2..99717a1d7f61 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int __init amdgpu_init(void) · line 3072

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
@@ -3067,6 +3067,11 @@ static int __init amdgpu_init(void)
        /* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
        amdgpu_amdkfd_init();
 
+       if (amdgpu_pp_feature_mask & PP_OVERDRIVE_MASK) {
+               add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
+               pr_crit("Overdrive is enabled, please disable it before reporting any bugs.\n");

Might want to reword this to something like:
"Overdrive is enabled, please disable it before reporting any bugs unrelated to overdrive.\n"

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
+       }
+
        /* let modprobe override vga console setting */
        return pci_register_driver(&amdgpu_kms_pci_driver);
 
--

2.43.0

#2 lore raw
Quoted 25 lines · Alex Deucher
Quoted 23 lines · Mario Limonciello

Some distributions have been patching amdgpu to enable overdrive by default which may compromise stability. Furthermore when bug reports are brought upstream it's not obvious that the system has been tampered with.

When overdrive is enabled taint the kernel and leave a critical message in the logs for users so that it's obvious in a bug report it's been tampered with.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index f57411ed2dc2..99717a1d7f61 100644
@@ -3067,6 +3067,11 @@ static int __init amdgpu_init(void)
         /* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
         amdgpu_amdkfd_init();
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int __init amdgpu_init(void) · line 3072

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
+       if (amdgpu_pp_feature_mask & PP_OVERDRIVE_MASK) {
+               add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
+               pr_crit("Overdrive is enabled, please disable it before reporting any bugs.\n");

Might want to reword this to something like:
"Overdrive is enabled, please disable it before reporting any bugs unrelated to overdrive.\n"

Thanks, good suggestion; I'll reword. Are you in agreement with the selected taint code and location in the driver?

Quoted 10 lines

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
+       }
+
         /* let modprobe override vga console setting */
         return pci_register_driver(&amdgpu_kms_pci_driver);
 
--

2.43.0

Reviewed-by
#3 lore raw
Quoted 35 lines · Mario Limonciello
Quoted 25 lines · Alex Deucher
Quoted 23 lines · Mario Limonciello

Some distributions have been patching amdgpu to enable overdrive by default which may compromise stability. Furthermore when bug reports are brought upstream it's not obvious that the system has been tampered with.

When overdrive is enabled taint the kernel and leave a critical message in the logs for users so that it's obvious in a bug report it's been tampered with.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index f57411ed2dc2..99717a1d7f61 100644
@@ -3067,6 +3067,11 @@ static int __init amdgpu_init(void)
         /* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
         amdgpu_amdkfd_init();
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int __init amdgpu_init(void) · line 3072

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
+       if (amdgpu_pp_feature_mask & PP_OVERDRIVE_MASK) {
+               add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
+               pr_crit("Overdrive is enabled, please disable it before reporting any bugs.\n");

Might want to reword this to something like:
"Overdrive is enabled, please disable it before reporting any bugs unrelated to overdrive.\n"

Quoted 2 lines

Thanks, good suggestion; I'll reword. Are you in agreement with the selected taint code and location in the driver?

Yes, with that change, the patch is:

Quoted 12 lines
Quoted 11 lines

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
+       }
+
         /* let modprobe override vga console setting */
         return pci_register_driver(&amdgpu_kms_pci_driver);
 
--

2.43.0