diff mbox series

[8/9,D] UBUNTU: SAUCE: acpi: disallow loading configfs acpi tables when locked down

Message ID 20200618231429.630733-9-seth.forshee@canonical.com
State New
Headers show
Series Lockdown updates | expand

Commit Message

Seth Forshee June 18, 2020, 11:14 p.m. UTC
From: "Jason A. Donenfeld" <Jason@zx2c4.com>

BugLink: https://bugs.launchpad.net/bugs/1884159

Like other vectors already patched, this one here allows the root user
to load ACPI tables, which enables arbitrary physical address writes,
which in turn makes it possible to disable lockdown. This patch prevents
this by checking the lockdown status before allowing a new ACPI table to be
installed. The link in the trailer shows a PoC of how this might be
used.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: stable@vger.kernel.org
Link: https://git.zx2c4.com/american-unsigned-language/tree/american-unsigned-language-2.sh
Link: https://lore.kernel.org/lkml/20200615104332.901519-1-Jason@zx2c4.com/
[ saf: Backport to older lockdown implementation ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/acpi/acpi_configfs.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
index b58850389094..74fd2b7fbab2 100644
--- a/drivers/acpi/acpi_configfs.c
+++ b/drivers/acpi/acpi_configfs.c
@@ -31,8 +31,12 @@  static ssize_t acpi_table_aml_write(struct config_item *cfg,
 {
 	const struct acpi_table_header *header = data;
 	struct acpi_table *table;
+	bool locked_down = kernel_is_locked_down("modifying ACPI tables");
 	int ret;
 
+	if (locked_down)
+		return -EPERM;
+
 	table = container_of(cfg, struct acpi_table, cfg);
 
 	if (table->header) {