From: Matthew Garrett Date: Fri, 9 Mar 2012 13:46:50 +0000 (-0500) Subject: asus-wmi: Restrict debugfs interface when securelevel is set X-Git-Tag: archive/raspbian/4.9.82-1+deb9u3+rpi1_jessie~8^2~40 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3fc0b4489f82fe6c715ccb3cb5fdb43162a41de1;p=linux-4.9.git asus-wmi: Restrict debugfs interface when securelevel is set We have no way of validating what all of the Asus WMI methods do on a given machine, and there's a risk that some will allow hardware state to be manipulated in such a way that arbitrary code can be executed in the kernel. Prevent that if securelevel is set. Signed-off-by: Matthew Garrett Gbp-Pq: Topic features/all/securelevel Gbp-Pq: Name asus-wmi-restrict-debugfs-interface-when-securelevel.patch --- diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 8499d3ae4257..39fb5470bfd5 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -1900,6 +1901,9 @@ static int show_dsts(struct seq_file *m, void *data) int err; u32 retval = -1; + if (get_securelevel() > 0) + return -EPERM; + err = asus_wmi_get_devstate(asus, asus->debug.dev_id, &retval); if (err < 0) @@ -1916,6 +1920,9 @@ static int show_devs(struct seq_file *m, void *data) int err; u32 retval = -1; + if (get_securelevel() > 0) + return -EPERM; + err = asus_wmi_set_devstate(asus->debug.dev_id, asus->debug.ctrl_param, &retval); @@ -1940,6 +1947,9 @@ static int show_call(struct seq_file *m, void *data) union acpi_object *obj; acpi_status status; + if (get_securelevel() > 0) + return -EPERM; + status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, 1, asus->debug.method_id, &input, &output);