Re: [PATCH 2/5] hibernation: ensure secretmem pages don't reach a snapshot

From: David Hildenbrand (Arm)

Date: Wed Sep 23 2026 - 06:12:13 EST


On 9/17/26 08:07, Mike Rapoport (Microsoft) wrote:
> 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 secretmem state after userspace is frozen and abort hibernation if
> secretmem is active.
>
> 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 d2479c69d71a4..281ad49411481 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 (secretmem_active()) {
> + error = -EBUSY;
> + goto Thaw;
> + }
> +

Should we instead recheck hibernation_available() like we do at the beginning of
hibernate() before freezing?

--
Cheers,

David