[PATCH v2 2/5] hibernation: ensure secretmem pages don't reach a snapshot
From: Mike Rapoport (Microsoft)
Date: Sat Sep 26 2026 - 05:28:17 EST
hibernation_available() checks for active secretmem users, but a secretmem
file can be created after this check and its pages may get into the
hibernation snapshot although they should not.
Recheck that hibernation_available() after userspace is frozen and abort
hibernation if it is not.
Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
---
kernel/power/hibernate.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index d2479c69d71a..97de677e360f 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -412,6 +412,11 @@ int hibernation_snapshot(int platform_mode)
if (error)
goto Close;
+ if (!hibernation_available()) {
+ error = -EBUSY;
+ goto Thaw;
+ }
+
if (hibernation_test(TEST_FREEZER)) {
/*
--
2.53.0