aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/custom_method.c
diff options
context:
space:
mode:
authorMatthew Garrett <[email protected]>2019-08-20 00:17:50 +0000
committerJames Morris <[email protected]>2019-08-20 04:54:16 +0000
commitf474e1486b78ac15322f8a1cda48a32a1deff9d3 (patch)
treefe775561f6ce6e2a47ec9b837d398e5ab987efdd /drivers/acpi/custom_method.c
parentx86/msr: Restrict MSR access when the kernel is locked down (diff)
downloadkernel-f474e1486b78ac15322f8a1cda48a32a1deff9d3.tar.gz
kernel-f474e1486b78ac15322f8a1cda48a32a1deff9d3.zip
ACPI: Limit access to custom_method when the kernel is locked down
custom_method effectively allows arbitrary access to system memory, making it possible for an attacker to circumvent restrictions on module loading. Disable it if the kernel is locked down. Signed-off-by: Matthew Garrett <[email protected]> Signed-off-by: David Howells <[email protected]> Reviewed-by: Kees Cook <[email protected]> cc: [email protected] Signed-off-by: James Morris <[email protected]>
Diffstat (limited to 'drivers/acpi/custom_method.c')
-rw-r--r--drivers/acpi/custom_method.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
index b2ef4c2ec955..7031307becd7 100644
--- a/drivers/acpi/custom_method.c
+++ b/drivers/acpi/custom_method.c
@@ -9,6 +9,7 @@
#include <linux/uaccess.h>
#include <linux/debugfs.h>
#include <linux/acpi.h>
+#include <linux/security.h>
#include "internal.h"
@@ -29,6 +30,11 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
struct acpi_table_header table;
acpi_status status;
+ int ret;
+
+ ret = security_locked_down(LOCKDOWN_ACPI_TABLES);
+ if (ret)
+ return ret;
if (!(*ppos)) {
/* parse the table header to get the table length */