Registry Mirror
Skip to content

kexec_default_hashes.txt may get outdated #2247

Closed

Description

@3hhh

Please identify some basic details to help process the report

On heads-EOL_UNTESTED_t530-hotp-maximized-202610092043-v0.2.1-3253-g23f7474.rom I noticed the following bug:

To Reproduce

  1. Change a file in /boot/ that is in both kexec_hashes.txt and kexec_default_hashes.txt.
  2. Reboot.
  3. Notice that heads correctly identifies the changed file. Re-sign it.
  4. Notice that heads complains during default boot that a signature check failed.
  5. Notice that heads boots the OS anyway.

Expected behavior
Shouldn't boot and ask me to re-sign the default hashes as well.

Looks like a classic out-of-sync bug to me.

Activity

  1. tlaurion commented on Nov 4, 2026

    @tlaurion
    Collaborator

    @3hhh is this a regression to you since #2150 ?

    ie QubesOS with Xen updates in same binary under /boot

    1. xen changed on os, system reboots, hash different under kexec_hashes.txt and kexec_default_hashes.txt
    2. heads checks for kexec_hashes.txt first, see change, reports file changes, asks for resign
    3. can't replicate

    So you modified which file for this issue to happen? Will replicate

  2. tlaurion commented on Nov 4, 2026

    @tlaurion
    Collaborator

    @3hhh i have analysed the code, and actually it works as intended since all boards have export CONFIG_BOOT_REQ_HASH=n since Heads never intended to force this but warn and permit boot. We could

    • Say more clearly that restricted boot enforces hash check of default boot
    • Switch all boards to export CONFIG_BOOT_REQ_HASH=y
    • Remove all traces of checks for "CONFIG_BOOT_REQ_HASH" in code

    Opinions?

  3. 3hhh commented on Nov 4, 2026

    @3hhh
    CollaboratorAuthor
  4. tlaurion commented on Nov 4, 2026

    @tlaurion
    Collaborator

    A possible implementation could be

    
    git diff -u origin/master
    diff --git a/initrd/bin/kexec-sign-config.sh b/initrd/bin/kexec-sign-config.sh
    index c6fe0725c..368de3ab0 100755
    --- a/initrd/bin/kexec-sign-config.sh
    +++ b/initrd/bin/kexec-sign-config.sh
    @@ -59,6 +59,20 @@ if [ "$update" = "y" ]; then
                            hash_pipeline_exit=$?
                    #also save the file & directory structure to detect added files
                    print_tree >"$stagedir/kexec_tree.txt"
    +
    +               # Regenerate kexec_default_hashes.txt if a default boot entry exists
    +               # Use the current default entry to determine which files to hash
    +               for default_entry_file in "$stagedir"/kexec_default.*.txt; do
    +                       [ -r "$default_entry_file" ] || continue
    +                       default_entry="$(cat "$default_entry_file")"
    +                       if [ -n "$default_entry" ]; then
    +                               DEBUG "update=y: Regenerating kexec_default_hashes.txt from default entry $(basename "$default_entry_file")"
    +                               /bin/kexec-boot.sh -b /boot -e "$default_entry" -f 2>/dev/null | xargs sha256sum >"$stagedir/kexec_default_hashes.txt" ||
    +                                       hash_pipeline_exit=$?
    +                               break
    +                       fi
    +               done
    +
                    exit $hash_pipeline_exit
            )
            [ $? -eq 0 ] || DIE "$paramsdir: Failed to update hashes."
    
    
  5. 3hhh commented on Nov 4, 2026

    @3hhh
    CollaboratorAuthor

    The refresh together with the others seems sensible.

    And I'd vote for CONFIG_BOOT_REQ_HASH=y for now, if that fixes the "boot anyway" issue. Then maybe later remove all traces of it.

  6. tlaurion commented on Nov 4, 2026

    @tlaurion
    Collaborator

    The refresh together with the others seems sensible.

    And I'd vote for CONFIG_BOOT_REQ_HASH=y for now, if that fixes the "boot anyway" issue. Then maybe later remove all traces of it.

    Can you open a PR with the desired change since we now understand the policy is correct and it's not a regression @3hhh ?

    Otherwise I'll do it when I get some free time.

  7. tlaurion commented on Nov 5, 2026

    @tlaurion
    Collaborator

    Well. Switching boards configs CONFIG_BOOT_REQ_HASH=n -> CONFIG_BOOT_REQ_HASH=y is not enough in the sense it drops to Recovery Shell if globash hashes good but default boot hashes wrong.

    Following what heads tried to do recently which is to guard and guide user into doing the right thing, this will need more work.

  8. 3hhh commented on Nov 5, 2026

    @3hhh
    CollaboratorAuthor

    I see. I wonder what the flag is for then though...

  9. tlaurion commented on Nov 5, 2026

    @tlaurion
    Collaborator

    I see. I wonder what the flag is for then though...

    Failing (die) once went to recovery and was introduced in 2017 and never enforced in board configs. And enforcing it today in master dies, which die in code are really limited since then to when something fails badly, ie unexpected. And in master, when init dies it respawn, showing a warning.

    Tldr no policy (gui-init, basic or any other boot script called in board from init) ever used it. Expected way is for the user to use options, show boot options,and set a new default since user created digests and is currently warned and permitting boot. So not a bug, but a "feature" in the sense that default boot hashes are not restricted to be good and warn currently.

    Agreed it should offer guidance, but that is not a simple fix.

  10. 78 remaining items

  11. tlaurion commented on Nov 12, 2026

    @tlaurion
    Collaborator

    @3hhh Can you test #2255 ?

  12. 3hhh commented on Nov 12, 2026

    @3hhh
    CollaboratorAuthor
  13. 3hhh commented on Nov 13, 2026

    @3hhh
    CollaboratorAuthor

    574debf0e7c5ebf3947067e9e0f381a4fae611a47512aaadee6f4dd29ac49cfd heads-EOL_t530-hotp-maximized-202611111552-v0.2.1-3321-gdbb96b9.rom indeed seems to fix the issue, thanks a lot!

    Btw I noticed that CircleCI now requires authentication to view the logs or download the artifacts, which is rather annoying.

  14. tlaurion commented on Nov 13, 2026

    @tlaurion
    Collaborator
  15. headsup0129342 commented on Nov 15, 2026

    @headsup0129342

    I am having this same issue with the same screenshot as seen here: https://forum.qubes-os.org/t/security-testing-patch-repeatedly-failing-verification-during-heads-boot/43966
    I guess I am just wondering if the xen-4.19.6.gz is in fact compromise or if this is just a heads bug on a recent dom0 update?

  16. tlaurion commented on Nov 15, 2026

    @tlaurion
    Collaborator

    I am having this same issue with the same screenshot as seen here: https://forum.qubes-os.org/t/security-testing-patch-repeatedly-failing-verification-during-heads-boot/43966 I guess I am just wondering if the xen-4.19.6.gz is in fact compromise or if this is just a heads bug on a recent dom0 update?

    Sorry for the mess @headsup0129342, replied under https://forum.qubes-os.org/t/security-testing-patch-repeatedly-failing-verification-during-heads-boot/43966/7 and reported fixed (this is not the same issue reported there BTW?) under #2255

  17. added a commit that references this issue on Nov 15, 2026
    c2d1d5e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions