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.30-2+deb9u2+rpi1~8^2~61 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=303fe43a6a574ff268d081a32b62eb61a8304f6d;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)) {