Skip to contentSkip to conversation

ACPI: Drop the custom_method debugfs interface

PATCH In review Rafael J. Wysocki 4 participants 4 messages Feb 16, 2024 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ACPI: Drop the custom_method debugfs interface

From: Rafael J. Wysocki <[email protected]>

The ACPI custom_method debugfs interface is security-sensitive and concurrent access to it is broken [1].

Moreover, the recipe for preparing a customized version of a given control method has changed at one point due to ACPICA changes, which has not been reflected in its documentation, so whoever used it before has had to adapt and it had gone unnoticed for a long time.

This interface was a bad idea to start with and its implementation is fragile at the design level. It's been always conceptually questionable, problematic from the security standpoint and implemented poorly.

Patches fixing its most apparent functional issues (for example, [2]) don't actually address much of the above.

Granted, at the time it was introduced, there was no alternative, but there is the AML debugger in the kernel now and there is the configfs interface allowing custom ACPI tables to be loaded. The former can be used for extensive AML debugging and the latter can be use for testing new AML. [3]

Accordingly, drop custom_method along with its (outdated anyway) documentation.

https://lore.kernel.org/linux-acpi/[email protected]/ [2]
https://stackoverflow.com/questions/62849113/how-to-unload-an-overlay-loaded-using-acpi-config-sysfs # [3]

---

v2 -> v3:
* Update changelog.
* Add R-by from Rui.

v1 -> v2: Update index.rst too.

---
 Documentation/firmware-guide/acpi/index.rst              |    1 
 Documentation/firmware-guide/acpi/method-customizing.rst |   89 ------------
 drivers/acpi/Kconfig                                     |   14 --
 drivers/acpi/Makefile                                    |    1 
 drivers/acpi/custom_method.c                             |  103 ---------------
 5 files changed, 208 deletions(-)
drivers/acpi/Kconfig +0 -14
Index: linux-pm/drivers/acpi/Kconfig
===================================================================
@@ -449,20 +449,6 @@ config ACPI_HED
 	  which is used to report some hardware errors notified via
 	  SCI, mainly the corrected errors.
 
-config ACPI_CUSTOM_METHOD
-	tristate "Allow ACPI methods to be inserted/replaced at run time"
-	depends on DEBUG_FS
-	help
-	  This debug facility allows ACPI AML methods to be inserted and/or
-	  replaced without rebooting the system. For details refer to:
-	  Documentation/firmware-guide/acpi/method-customizing.rst.
-
-	  NOTE: This option is security sensitive, because it allows arbitrary
-	  kernel memory to be written to by root (uid=0) users, allowing them
-	  to bypass certain security measures (e.g. if root is not allowed to
-	  load additional kernel modules after boot, this feature may be used
-	  to override that restriction).
-
 config ACPI_BGRT
 	bool "Boottime Graphics Resource Table support"
 	depends on EFI && (X86 || ARM64)
drivers/acpi/Makefile +0 -1
Index: linux-pm/drivers/acpi/Makefile
===================================================================
@@ -101,7 +101,6 @@ obj-$(CONFIG_ACPI_SBS)		+= sbshc.o
 obj-$(CONFIG_ACPI_SBS)		+= sbs.o
 obj-$(CONFIG_ACPI_HED)		+= hed.o
 obj-$(CONFIG_ACPI_EC_DEBUGFS)	+= ec_sys.o
-obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
 obj-$(CONFIG_ACPI_CPPC_LIB)	+= cppc_acpi.o
 obj-$(CONFIG_ACPI_SPCR_TABLE)	+= spcr.o
drivers/acpi/custom_method.c deleted +0 -103

103 lines not on this page · raw message

Documentation/firmware-guide/acpi/method-customizing.rst deleted +0 -89

89 lines not on this page · raw message

Documentation/firmware-guide/acpi/index.rst +0 -1
Index: linux-pm/Documentation/firmware-guide/acpi/index.rst
===================================================================
@@ -14,7 +14,6 @@ ACPI Support
    dsd/phy
    enumeration
    osi
-   method-customizing
    method-tracing
    DSD-properties-rules
    debug
#1 lore raw
Quoted 23 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The ACPI custom_method debugfs interface is security-sensitive and concurrent access to it is broken [1].

Moreover, the recipe for preparing a customized version of a given control method has changed at one point due to ACPICA changes, which has not been reflected in its documentation, so whoever used it before has had to adapt and it had gone unnoticed for a long time.

This interface was a bad idea to start with and its implementation is fragile at the design level. It's been always conceptually questionable, problematic from the security standpoint and implemented poorly.

Patches fixing its most apparent functional issues (for example, [2]) don't actually address much of the above.

Granted, at the time it was introduced, there was no alternative, but there is the AML debugger in the kernel now and there is the configfs interface allowing custom ACPI tables to be loaded. The former can be used for extensive AML debugging and the latter can be use for testing new AML. [3]

Quoted 6 lines

Accordingly, drop custom_method along with its (outdated anyway) documentation.

https://lore.kernel.org/linux-acpi/[email protected]/ [2]
https://stackoverflow.com/questions/62849113/how-to-unload-an-overlay-loaded-using-acpi-config-sysfs # [3]

I believe you missed Link: tags for 2 and 3.

Quoted 3 lines
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 25 lines · Andy Shevchenko
Quoted 23 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The ACPI custom_method debugfs interface is security-sensitive and concurrent access to it is broken [1].

Moreover, the recipe for preparing a customized version of a given control method has changed at one point due to ACPICA changes, which has not been reflected in its documentation, so whoever used it before has had to adapt and it had gone unnoticed for a long time.

This interface was a bad idea to start with and its implementation is fragile at the design level. It's been always conceptually questionable, problematic from the security standpoint and implemented poorly.

Patches fixing its most apparent functional issues (for example, [2]) don't actually address much of the above.

Granted, at the time it was introduced, there was no alternative, but there is the AML debugger in the kernel now and there is the configfs interface allowing custom ACPI tables to be loaded. The former can be used for extensive AML debugging and the latter can be use for testing new AML. [3]

Quoted 8 lines
Quoted 6 lines

Accordingly, drop custom_method along with its (outdated anyway) documentation.

https://lore.kernel.org/linux-acpi/[email protected]/ [2]
https://stackoverflow.com/questions/62849113/how-to-unload-an-overlay-loaded-using-acpi-config-sysfs # [3]

I believe you missed Link: tags for 2 and 3.

Obviously, you are right.

That's easy to fix, though, and I'd rather not confuse people by sending a v4 just because of this.

Quoted 3 lines
Quoted 3 lines
Reviewed-by on v3 1/1
#3 lore raw
In reply to Rafael J. Wysocki
Quoted 23 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The ACPI custom_method debugfs interface is security-sensitive and concurrent access to it is broken [1].

Moreover, the recipe for preparing a customized version of a given control method has changed at one point due to ACPICA changes, which has not been reflected in its documentation, so whoever used it before has had to adapt and it had gone unnoticed for a long time.

This interface was a bad idea to start with and its implementation is fragile at the design level. It's been always conceptually questionable, problematic from the security standpoint and implemented poorly.

Patches fixing its most apparent functional issues (for example, [2]) don't actually address much of the above.

Granted, at the time it was introduced, there was no alternative, but there is the AML debugger in the kernel now and there is the configfs interface allowing custom ACPI tables to be loaded. The former can be used for extensive AML debugging and the latter can be use for testing new AML. [3]

Quoted 8 lines

Accordingly, drop custom_method along with its (outdated anyway) documentation.

https://lore.kernel.org/linux-acpi/[email protected]/ [2]
https://stackoverflow.com/questions/62849113/how-to-unload-an-overlay-loaded-using-acpi-config-sysfs # [3]

Yay! Happy to see this removed. :)

Signature · 1 line
Kees Cook