Re: [PATCH] PM: hibernate: Allow hibernation opt-in when locked down
Sean Rhodes <[email protected]>
| Newsgroups | org.kernel.vger.linux-security-module,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <CABtds-1d8uYi5YbxgbL5MwZOXTUgBmeLQWiggVhBKtqct5VC-g@mail.gmail.com> |
Please ignore this patch; the approach was wrong. I'll follow up with a v2. On Thu, 9 Jul 2026 12:23:11 -0700, Sean Rhodes <[email protected]> wrote: > Kernel lockdown disables hibernation because the resume image cannot be > verified before it is restored. On systems where external platform or > storage policy protects the hibernation image from offline modification, > users may still need hibernation while lockdown is active. > > Add a hibernate=allow_locked_down command line option to make that opt-in > explicit. This only bypasses the LOCKDOWN_HIBERNATION gate; nohibernate, > secretmem and CXL memory restrictions still apply. > > The kernel does not validate the external policy or authenticate the image > with this option. > > Build-tested with Fedora config: > make O=../linux-lockdown-hibernate-build kernel/power/hibernate.o > > Signed-off-by: Sean Rhodes <[email protected]> > --- > Documentation/admin-guide/kernel-parameters.txt | 5 +++++ > kernel/power/hibernate.c | 6 +++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index b5493a7f8f22..0d20ad9c7d78 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1967,6 +1967,11 @@ Kernel parameters > protect_image Turn on image protection during restoration > (that will set all pages holding image data > during restoration read-only). > + allow_locked_down > + Allow hibernation even when kernel lockdown would > + otherwise disable it. The kernel does not verify > + the hibernation image; only use this when external > + policy protects the image from offline modification. > > hibernate.compressor= [HIBERNATION] Compression algorithm to be > used with hibernation. > diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c > index d2479c69d71a..71232eece9a3 100644 > --- a/kernel/power/hibernate.c > +++ b/kernel/power/hibernate.c > @@ -41,6 +41,7 @@ > static int nocompress; > static int noresume; > static int nohibernate; > +static bool allow_locked_down_hibernation; > static int resume_wait; > static unsigned int resume_delay; > static char resume_file[256] = CONFIG_PM_STD_PARTITION; > @@ -109,7 +110,8 @@ bool hibernation_in_progress(void) > bool hibernation_available(void) > { > return nohibernate == 0 && > - !security_locked_down(LOCKDOWN_HIBERNATION) && > + (allow_locked_down_hibernation || > + !security_locked_down(LOCKDOWN_HIBERNATION)) && > !secretmem_active() && !cxl_mem_active(); > } > > @@ -1433,6 +1435,8 @@ static int __init hibernate_setup(char *str) > } else if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX) > && !strncmp(str, "protect_image", 13)) { > enable_restore_image_protection(); > + } else if (!strncmp(str, "allow_locked_down", 17)) { > + allow_locked_down_hibernation = true; > } > return 1; > } > -- > 2.53.0