bash-stuff/patches-kernel-6.8/hibernate/0001-Hibernate-Patch.patch

69 lines
2.2 KiB
Diff
Raw Permalink Normal View History

From fbebff4599d745d40c409869e31323b678010397 Mon Sep 17 00:00:00 2001
2024-05-30 01:42:30 +01:00
From: Captain ALM <captainalm@captainalm.com>
Date: Fri, 16 Aug 2024 18:54:33 +0100
2024-05-30 01:42:30 +01:00
Subject: [PATCH] Hibernate Patch.
---
Documentation/admin-guide/kernel-parameters.txt | 4 ++++
kernel/power/hibernate.c | 11 ++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
2024-05-30 01:42:30 +01:00
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index e58f3bbb7..d8a8b5c71 100644
2024-05-30 01:42:30 +01:00
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2956,6 +2956,10 @@
confidentiality, kernel features that allow userland
2024-05-30 01:42:30 +01:00
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.acq_writer_lim= [KNL]
Set the time limit in jiffies for a lock
2024-05-30 01:42:30 +01:00
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 4b0b7cf2e..d1bd28cdb 100644
2024-05-30 01:42:30 +01:00
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -37,6 +37,7 @@
2024-05-30 01:42:30 +01:00
#include "power.h"
2024-05-30 01:42:30 +01:00
+static int lockdown_hibernate;
static int nocompress;
static int noresume;
static int nohibernate;
@@ -83,7 +84,7 @@ void hibernate_release(void)
2024-05-30 01:42:30 +01:00
bool hibernation_available(void)
{
return nohibernate == 0 &&
- !security_locked_down(LOCKDOWN_HIBERNATION) &&
+ (lockdown_hibernate || !security_locked_down(LOCKDOWN_HIBERNATION)) &&
!secretmem_active() && !cxl_mem_active();
2024-05-30 01:42:30 +01:00
}
@@ -1370,6 +1371,13 @@ static int __init nohibernate_setup(char *str)
2024-05-30 01:42:30 +01:00
return 1;
}
+
2024-05-30 01:42:30 +01:00
+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);
@@ -1377,3 +1385,4 @@ __setup("hibernate=", hibernate_setup);
2024-05-30 01:42:30 +01:00
__setup("resumewait", resumewait_setup);
__setup("resumedelay=", resumedelay_setup);
__setup("nohibernate", nohibernate_setup);
+__setup("lockdown_hibernate", lockdown_hibernate_setup);
--
2.43.0
2024-05-30 01:42:30 +01:00