Skip to content

Commit 38bd94b

Browse files
Josh Boyerxjamesmorris
authored andcommitted
hibernate: Disable when the kernel is locked down
There is currently no way to verify the resume image when returning from hibernate. This might compromise the signed modules trust model, so until we can work with signed hibernate images we disable it when the kernel is locked down. Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Matthew Garrett <mjg59@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: rjw@rjwysocki.net Cc: pavel@ucw.cz cc: linux-pm@vger.kernel.org Signed-off-by: James Morris <jmorris@namei.org>
1 parent 155bdd3 commit 38bd94b

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎include/linux/security.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ enum lockdown_reason {
106106
LOCKDOWN_MODULE_SIGNATURE,
107107
LOCKDOWN_DEV_MEM,
108108
LOCKDOWN_KEXEC,
109+
LOCKDOWN_HIBERNATION,
109110
LOCKDOWN_INTEGRITY_MAX,
110111
LOCKDOWN_CONFIDENTIALITY_MAX,
111112
};

‎kernel/power/hibernate.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/ctype.h>
3131
#include <linux/genhd.h>
3232
#include <linux/ktime.h>
33+
#include <linux/security.h>
3334
#include <trace/events/power.h>
3435

3536
#include "power.h"
@@ -68,7 +69,7 @@ static const struct platform_hibernation_ops *hibernation_ops;
6869

6970
bool hibernation_available(void)
7071
{
71-
return (nohibernate == 0);
72+
return nohibernate == 0 && !security_locked_down(LOCKDOWN_HIBERNATION);
7273
}
7374

7475
/**

‎security/lockdown/lockdown.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
2121
[LOCKDOWN_MODULE_SIGNATURE] = "unsigned module loading",
2222
[LOCKDOWN_DEV_MEM] = "/dev/mem,kmem,port",
2323
[LOCKDOWN_KEXEC] = "kexec of unsigned images",
24+
[LOCKDOWN_HIBERNATION] = "hibernation",
2425
[LOCKDOWN_INTEGRITY_MAX] = "integrity",
2526
[LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality",
2627
};

0 commit comments

Comments
 (0)