Login
You're viewing the techdon.dev public feed.
  • Oct 8, 2026, 3:48 PM

    Brief intro into why hibernate support is disabled On Linux when secure boot is enabled! The goal of secure boot is to prevent malware from getting into your kernel, by performing cryptographic validation of the bootloader and kernel during the boot process. If malware tampers with that (and it does! Search for "bootkits") then secure boot ensures that the boot fails and you can fall back to good components instead.

    💬 1🔄 48⭐ 67

Replies

  • Oct 8, 2026, 3:51 PM

    So, if someone can just modify the kernel via some other means, that kind of defeats the point. That's why Linux has the Lockdown feature, which blocks various ways you could modify the running kernel - like requiring signed modules, blocking the ability to directly modify the contents of RAM (including the kernel) and... blocking hibernation

    💬 1🔄 1⭐ 18
  • Oct 8, 2026, 3:55 PM

    Why block hibernation? When you suspend to disk, the entire contents of RAM are written out. Including the kernel. When you resume, the resume kernel reads that all into RAM and then jumps back to the old kernel. So, the securely-booted kernel replaces itself with whatever was on disk. You might see the problem now. There's nothing to stop an attacker from writing their own image onto the hibernation partition, and then triggering a resume. You resume into the attacker's kernel.

    💬 1🔄 5⭐ 28
  • Oct 8, 2026, 3:58 PM

    So we need to prove that the image was written by the kernel and not modified afterwards. This is hard! Remember that we're resuming as part of a new boot, there's no persistent state except stuff that's on disk, and someone could boot another OS and check what's on disk to get the secret. We need the secret material to live somewhere else. Enter the TPM.

    💬 1🔄 0⭐ 13
  • Oct 8, 2026, 4:03 PM

    We can have the TPM generate a key, sign the image with that, and then verify it with the public key. We can even prove the key was generated in the TPM. That solves the problem, right? Sadly, no. Userland can use the TPM to generate a key, and we can't tell the difference. Or can we? TPMs have the concept of an audited session, one where the TPM tracks the commands executed and the responses, and can then sign that log. So, if we have something there that proves it's the kernel, we're good.

    💬 1🔄 0⭐ 13
  • Oct 8, 2026, 4:05 PM

    TPMs have some nvram that can be used to store data. My patchset reserves one of these for the kernel, and writes a magic value to it when the kernel generates a signing key. Userland can't write the same value, so we can prove the key was generated in kernel. Great! Except old kernels don't block that access, so you could generate a key with an old kernel. We need to be able to tell the difference between a kernel that implements this and one that doesn't.

    💬 1🔄 0⭐ 11
  • Oct 8, 2026, 4:09 PM

    The normal way to do this is to perform a PCR extension if the feature exists, meaning the TPM state differs if the feature is there or not. Unfortunately nothing stops userland performing the same extension. This is normally prevented by "capping" the PCRs, adding an extra measurement between security transitions. But the kernel doesn't do that (it probably should? Too late now...) which means userland can perform that extension and generate identical state. Ugh.

    💬 1🔄 0⭐ 11
  • Oct 8, 2026, 4:11 PM

    What we need is the opportunity to extend a PCR which is then capped, and which is capped even with old kernels that do none of this. That sounds impossible, but it's not. On EFI systems, the last thing we do as we transition from the firmware environment to the kernel is call "ExitBootServices", an EFI function. And calling that triggers an extension of PCR 5. And we run code in the boot stub before that happens, so we can do an extension there and then have the firmware cap it for us.

    💬 1🔄 0⭐ 10
  • Oct 8, 2026, 4:14 PM

    This all works! As long as the firmware actually follows the spec, which, well. So we then have to copy the PCR 5 values before ExitBootServices up to the kernel so it can check the firmware did that extension, and if so we can make use of the feature knowing that userland can't spoof it. And, therefore, we can prove the key was generated in the kernel, which proves the image was written by the kernel, which prevents an attacker providing a fake image.

    💬 1🔄 0⭐ 16
  • Oct 8, 2026, 4:15 PM

    (why not just rely on full disk encryption? We're not just trying to protect against offline attacks, we're trying to protect against root being able to write out an image to disk and escalate their control into the kernel - and FDE does nothing to protect against that, because the kernel will happily provide access to the encrypted block device and then encrypt the data root writes out)

    💬 0🔄 2⭐ 19