Skip to content

os: drop the sound modules and refuse unsigned modules in mkimage (#708) - #723

Merged
bong-water-water-bong merged 2 commits into
osv2/704-image-versionfrom
osv2/708-module-signatures
Nov 1, 2026
Merged

bong-water-water-bong merged 2 commits into
osv2/704-image-versionfrom
osv2/708-module-signatures

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Fixes #708. The c18 boot rejected snd_usbmidi_lib ("Loading of unsigned module is rejected") and then printed
eleven Unknown symbol snd_ctl_new1 (err -2) lines; measured here, those sound modules are signed with
"Build time autogenerated kernel key", not the MOK/Kernel key the image's other modules carry.

The appliance has no audio and nothing else loads them, so snd_hda_intel/snd_usb_audio leave the image and
init's list. mkimage additionally refuses any .ko/.ko.xz/.ko.zst in the initramfs whose modinfo -F signer
is empty (it names each one), and prints the signer table for the record.
PR-READY.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

At df18a68b. Built the image at this head, because the new gate could plausibly break every build if modinfo could not read the staged modules:

bash -n os/mini/mkimage.sh / init.sh                     -> OK
EC_MODULE=skip AMDXDNA_KO=skip LEMONADE=<prebuilt> ./os/mini/mkimage.sh /tmp/osimg723 <engine build>
   signer:     108 Build time autogenerated kernel key
   signer:       1 strixhalo Secure Boot Kernel
   == 1bit-os.efi … == 1bit-os.img …                    (no UNSIGNED, exit 0)

So the refusal works on this box's staged modules — 109 .ko files read, none unsigned, image assembled — and the signer summary prints as intended. The sound-module removal is consistent on both sides (init.sh's modprobe list and mkimage.sh's mods), and nothing else in the tree loads snd_hda_intel/snd_usb_audio, so dropping them is the whole fix rather than half of it.

One substantive note, and it is the gap between the comment and the code. The comment states the right criterion:

the signers are printed either way, because "the module is signed" is not the question - signed by a key this kernel trusts is.

but the implementation only tests [ -z "$signer" ], i.e. "has a signer". On this box that distinction is not academic: 108 of 109 modules are signed by Build time autogenerated kernel key, not by the strixhalo Secure Boot Kernel MOK that signs amdxdna/ec_su_axb35. Today that is fine — those in-tree modules come from the same kernel build, whose embedded keyring trusts its own signing key — but the gate would pass a module signed by any other key, which is exactly the rejection the PR exists to prevent. If you want the check to match its comment, compare the signer against the image kernel's own module key (or against the MOK list) and refuse on a mismatch; if not, soften the comment to "refuses an unsigned module" and leave the trusted-key question where it is.

Not a blocker for merge: the failure mode it closes (the c18 snd_usbmidi_lib refusal plus eleven Unknown symbol snd_ctl_new1 lines) is real and this closes it, and the gate cannot regress a build that passes today.

tprs-ready applied. Same scope note as its stack neighbours: it inherits #719/#720's two open items and cannot land before them.

@bong-water-water-bong bong-water-water-bong added the tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit d37209c)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

708 - Partially compliant

Compliant requirements:

  • Drop sound modules (snd_hda_intel, snd_usb_audio) from the initramfs
  • Add unsigned module check in mkimage.sh that verifies module signatures
  • The script now refuses unsigned modules and prints signer information for all modules

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Unsigned Module Check Logic

The new unsigned module check in mkimage.sh scans all .ko, .ko.xz, and .ko.zst files in the initramfs and exits if any are unsigned. This is a good defensive measure, but it assumes that all modules in the initramfs must be signed by the kernel's trusted key. This could potentially break builds if legitimate unsigned modules are needed for boot (though this is unlikely given the context of a minimal initramfs).

# #708: refuse an unsigned module, the same way this script refuses a module built for another kernel.
# Secure Boot is on for the owner, so an unsigned module is not a line in a log: it is a rejection and then
# every symbol error of the module that depended on it. The signers are printed either way, because "the
# module is signed" is not the question - signed by a key this kernel trusts is.
unsigned=0
while IFS= read -r ko; do
    signer=$(modinfo -F signer "$ko" 2>/dev/null)
    if [ -z "$signer" ]; then
        echo "   UNSIGNED: ${ko#"$root"}"
        unsigned=$((unsigned + 1))
    fi
done < <(find "$root/lib/modules" -type f \( -name '*.ko' -o -name '*.ko.xz' -o -name '*.ko.zst' \))
if [ "$unsigned" != 0 ]; then
    echo "this image would ship $unsigned unsigned module(s) (named above) into a Secure Boot machine; stopping"
    exit 1
fi

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit d37209c

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

Re-confirmed at the current head. The author patch is unchanged from the head I reviewed — the delta since then is the rest of this stack arriving through rebases (#719's serial-log fix and its neighbours), which I have reviewed and re-verdicted in their own PRs. So everything in my earlier verdict on this PR applies unchanged at this head, including what I recorded there as not-verified-by-me (the QEMU gate).

tprs-ready stands.

Base automatically changed from osv2/707-console-font to osv2/704-image-version November 1, 2026 04:27
@bong-water-water-bong
bong-water-water-bong merged commit 295be91 into osv2/704-image-version Nov 1, 2026
3 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the osv2/708-module-signatures branch November 1, 2026 04:27
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Superseded by #742 — the same reviewed content as one commit on origin/main (+598 −63, six files in os/mini/), because #721/#725/#727 were merged into their base branches rather than main and each later branch was then built on a base that had moved (which is why #726 read CONFLICTING). Both review fixes are in #742 (/dev/kmsg transcript for #703; ls-tree HRX pin for #704). Please close this one and merge #742 so nothing lands twice.

bong-water-water-bong added a commit that referenced this pull request Nov 1, 2026
…ntity (#704) (#720)

* os: the banner and the release check read the image's own release identity (#704)

* os: the release identity reports the HRX pin, not the engine commit (#704)

Review of #720: `git -C third_party/hrx-system rev-parse HEAD` walks up to the parent repository when the
submodule is not checked out - the way the release lane builds - so the image shipped
'hrx-system: <engine sha>' and the '|| unknown' fallback never fired. The gitlink recorded in this tree is
the pin the release ships: `git ls-tree HEAD third_party/hrx-system`. Measured before/after below.

* os: one boot flow - countdown on the choice line, live status while DHCP and Lemonade come up (#705)

* os: a 16x32 console font and a full-width selection bar (#707) (#722)

Co-authored-by: bong-water-water-bong <[email protected]>

* os: drop the sound modules and refuse unsigned modules in mkimage (#708) (#723)

* os: a 16x32 console font and a full-width selection bar (#707)

* os: drop the sound modules and refuse unsigned modules in mkimage (#708)

---------

Co-authored-by: bong-water-water-bong <[email protected]>

* os: prepare-stick grows the data partition to the stick's full size (#706) (#724)

* os: a 16x32 console font and a full-width selection bar (#707)

* os: drop the sound modules and refuse unsigned modules in mkimage (#708)

* os: prepare-stick grows the data partition to the stick's full size (#706)

---------

Co-authored-by: bong-water-water-bong <[email protected]>

---------

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 3/5 tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant