From: Matthew Garrett Date: Tue, 3 Sep 2013 15:23:29 +0000 (-0400) Subject: uswsusp: Disable when securelevel is set X-Git-Tag: archive/raspbian/4.9.82-1+deb9u3+rpi1_jessie~10^2~42 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=349c09774a3803edbc18ec6ff67ca7786b9fe15f;p=linux-4.9.git uswsusp: Disable when securelevel is set 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 Gbp-Pq: Topic features/all/securelevel Gbp-Pq: Name uswsusp-disable-when-securelevel-is-set.patch --- diff --git a/kernel/power/user.c b/kernel/power/user.c index 35310b627388..d1b274d7c49d 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)) {