From: Matthew Garrett Date: Mon, 9 Sep 2013 22:49:43 +0000 (-0700) Subject: uswsusp: Disable when securelevel is set X-Git-Tag: v4.1.12-92~310^2~6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=eb4fa31a4a8f9d5974dc518edb2c5044926a0b61;p=users%2Fjedix%2Flinux-maple.git uswsusp: Disable when securelevel is set Orabug: 21539498 uswsusp allows a user process to dump and then restore kernel state, which makes it possible to modify the running kernel. Disable this if securelevel has been set. Signed-off-by: Matthew Garrett Signed-off-by: Santosh Shilimkar --- diff --git a/kernel/power/user.c b/kernel/power/user.c index 526e8911460a0..40618bf41620a 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -52,6 +53,9 @@ static int snapshot_open(struct inode *inode, struct file *filp) if (!hibernation_available()) return -EPERM; + if (get_securelevel() > 0) + return -EPERM; + lock_system_sleep(); if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {