From: Matthew Garrett Date: Wed, 8 Nov 2017 15:11:34 +0000 (+0000) Subject: ACPI: Limit access to custom_method when the kernel is locked down X-Git-Tag: archive/raspbian/4.16.16-2+rpi1^2~33 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=15453a312c38416092333c9957c8c1b23f42105f;p=linux.git 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 Signed-off-by: David Howells Reviewed-by: "Lee, Chun-Yi" cc: linux-acpi@vger.kernel.org Gbp-Pq: Topic features/all/lockdown Gbp-Pq: Name 0015-ACPI-Limit-access-to-custom_method-when-the-kernel-i.patch --- diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index c68e72414a6..b33fba70ec5 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c @@ -29,6 +29,9 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, struct acpi_table_header table; acpi_status status; + if (kernel_is_locked_down("ACPI custom methods")) + return -EPERM; + if (!(*ppos)) { /* parse the table header to get the table length */ if (count <= sizeof(struct acpi_table_header))