70 lines
2.2 KiB
Diff
70 lines
2.2 KiB
Diff
From 71c4fb133b496d62539dd32dc3d377f861f067f2 Mon Sep 17 00:00:00 2001
|
|
From: Captain ALM <captainalm@captainalm.com>
|
|
Date: Sat, 25 May 2024 17:55:24 +0100
|
|
Subject: [PATCH] Hibernate Patch.
|
|
|
|
---
|
|
Documentation/admin-guide/kernel-parameters.txt | 5 +++++
|
|
kernel/power/hibernate.c | 11 +++++++++--
|
|
2 files changed, 14 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
|
|
index a1b25a735..71b537ea6 100644
|
|
--- a/Documentation/admin-guide/kernel-parameters.txt
|
|
+++ b/Documentation/admin-guide/kernel-parameters.txt
|
|
@@ -2684,6 +2684,11 @@
|
|
to extract confidential information from the kernel
|
|
are also disabled.
|
|
|
|
+ lockdown_hibernate [HIBERNATION]
|
|
+ Enable hibernation even if lockdown is enabled. Enable this only if
|
|
+ your swap is encrypted and secured properly, as an attacker can
|
|
+ modify the kernel offline during hibernation.
|
|
+
|
|
locktorture.nreaders_stress= [KNL]
|
|
Set the number of locking read-acquisition kthreads.
|
|
Defaults to being automatically set based on the
|
|
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
|
|
index 9abc73d50..25c3a8fa6 100644
|
|
--- a/kernel/power/hibernate.c
|
|
+++ b/kernel/power/hibernate.c
|
|
@@ -36,7 +36,7 @@
|
|
|
|
#include "power.h"
|
|
|
|
-
|
|
+static int lockdown_hibernate;
|
|
static int nocompress;
|
|
static int noresume;
|
|
static int nohibernate;
|
|
@@ -83,7 +83,7 @@ void hibernate_release(void)
|
|
bool hibernation_available(void)
|
|
{
|
|
return nohibernate == 0 &&
|
|
- !security_locked_down(LOCKDOWN_HIBERNATION) &&
|
|
+ (lockdown_hibernate || !security_locked_down(LOCKDOWN_HIBERNATION)) &&
|
|
!secretmem_active();
|
|
}
|
|
|
|
@@ -1337,6 +1337,12 @@ static int __init nohibernate_setup(char *str)
|
|
return 1;
|
|
}
|
|
|
|
+static int __init lockdown_hibernate_setup(char *str)
|
|
+{
|
|
+ lockdown_hibernate = 1;
|
|
+ return 1;
|
|
+}
|
|
+
|
|
__setup("noresume", noresume_setup);
|
|
__setup("resume_offset=", resume_offset_setup);
|
|
__setup("resume=", resume_setup);
|
|
@@ -1344,3 +1350,4 @@ __setup("hibernate=", hibernate_setup);
|
|
__setup("resumewait", resumewait_setup);
|
|
__setup("resumedelay=", resumedelay_setup);
|
|
__setup("nohibernate", nohibernate_setup);
|
|
+__setup("lockdown_hibernate", lockdown_hibernate_setup);
|
|
--
|
|
2.34.1
|
|
|