]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
acpi: Limit access to custom_method if securelevel is set
authorMatthew Garrett <matthew.garrett@nebula.com>
Mon, 9 Sep 2013 22:49:40 +0000 (15:49 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Mon, 10 Aug 2015 16:24:06 +0000 (09:24 -0700)
Orabug: 21539498

custom_method effectively allows arbitrary access to system memory, making
it possible for an attacker to modify the kernel at runtime. Prevent this
if securelevel has been set.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
drivers/acpi/custom_method.c

index c68e72414a67a9b00231b095335945d5cdd2f31e..359f45d54543ae8e64082e5a918056e480d1c881 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/debugfs.h>
 #include <linux/acpi.h>
+#include <linux/security.h>
 
 #include "internal.h"
 
@@ -29,6 +30,9 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
        struct acpi_table_header table;
        acpi_status status;
 
+       if (get_securelevel() > 0)
+               return -EPERM;
+
        if (!(*ppos)) {
                /* parse the table header to get the table length */
                if (count <= sizeof(struct acpi_table_header))