Skip to content

Commit

Permalink
hibernate: Disable when the kernel is locked down
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Cc: [email protected]
Cc: [email protected]
cc: [email protected]
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
Josh Boyer authored and James Morris committed Aug 20, 2019
1 parent 155bdd3 commit 38bd94b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/linux/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ enum lockdown_reason {
LOCKDOWN_MODULE_SIGNATURE,
LOCKDOWN_DEV_MEM,
LOCKDOWN_KEXEC,
LOCKDOWN_HIBERNATION,
LOCKDOWN_INTEGRITY_MAX,
LOCKDOWN_CONFIDENTIALITY_MAX,
};
Expand Down
3 changes: 2 additions & 1 deletion kernel/power/hibernate.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/ctype.h>
#include <linux/genhd.h>
#include <linux/ktime.h>
#include <linux/security.h>
#include <trace/events/power.h>

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

bool hibernation_available(void)
{
return (nohibernate == 0);
return nohibernate == 0 && !security_locked_down(LOCKDOWN_HIBERNATION);
}

/**
Expand Down
1 change: 1 addition & 0 deletions security/lockdown/lockdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
[LOCKDOWN_MODULE_SIGNATURE] = "unsigned module loading",
[LOCKDOWN_DEV_MEM] = "/dev/mem,kmem,port",
[LOCKDOWN_KEXEC] = "kexec of unsigned images",
[LOCKDOWN_HIBERNATION] = "hibernation",
[LOCKDOWN_INTEGRITY_MAX] = "integrity",
[LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality",
};
Expand Down

0 comments on commit 38bd94b

Please sign in to comment.