Skip to content

Commit

Permalink
ACPI: Limit access to custom_method when the kernel is locked down
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mjg59 authored and James Morris committed Aug 20, 2019
1 parent 95f5e95 commit f474e14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/acpi/custom_method.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/uaccess.h>
#include <linux/debugfs.h>
#include <linux/acpi.h>
#include <linux/security.h>

#include "internal.h"

Expand All @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions include/linux/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ enum lockdown_reason {
LOCKDOWN_PCI_ACCESS,
LOCKDOWN_IOPORT,
LOCKDOWN_MSR,
LOCKDOWN_ACPI_TABLES,
LOCKDOWN_INTEGRITY_MAX,
LOCKDOWN_CONFIDENTIALITY_MAX,
};
Expand Down
1 change: 1 addition & 0 deletions security/lockdown/lockdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
[LOCKDOWN_PCI_ACCESS] = "direct PCI access",
[LOCKDOWN_IOPORT] = "raw io port access",
[LOCKDOWN_MSR] = "raw MSR access",
[LOCKDOWN_ACPI_TABLES] = "modifying ACPI tables",
[LOCKDOWN_INTEGRITY_MAX] = "integrity",
[LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality",
};
Expand Down

0 comments on commit f474e14

Please sign in to comment.