Skip to content

feat(minvmd): build minvmd for release, tweak libkrun search paths - #614

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/mip
Jul 1, 2026
Merged

feat(minvmd): build minvmd for release, tweak libkrun search paths#614
twitchyliquid64 merged 1 commit into
mainfrom
tom/mip

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jul 1, 2026

Copy link
Copy Markdown
Member

An attempt to build minvmd for distribution. We cannot build static as libkrun needs libc unfortunately.

  • On amd64 linux, we just try a regular build and ship that. We might need to do this on an older ubuntu, but lets start here.
  • On MacOS, we use our self-hosted runner to build.
  • Ive tweaked the rpaths to standard locations libkrun is likely to be, as well as adjacent to the binary.

Summary by CodeRabbit

  • New Features

    • Added macOS Apple Silicon release builds and artifacts.
    • Added a native Linux amd64 release artifact for minvmd.
  • Bug Fixes

    • Improved runtime library lookup so packaged binaries can find required shared libraries after being moved or distributed.
    • Increased the Linux release build timeout to reduce build failures.
  • Chores

    • Release automation now waits for the new macOS build before publishing.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Updates the CI workflow to build native minvmd artifacts for Linux amd64 and a new self-hosted macOS arm64 job with codesigning, increasing the release job timeout and expanding release dependencies. Reworks build.rs rpath emission into a multi-entry helper backed by a shared Linux library directory constant.

Changes

CI Release Workflow Changes

Layer / File(s) Summary
Linux amd64 minvmd build and timeout increase
.github/workflows/ci.yml
Increases build-release-linux-amd64 timeout from 45 to 60 minutes and adds steps to fetch libkrun, build native minvmd with LIBKRUN_PREFIX, rename it, and upload as minvmd-linux-amd64.
macOS arm64 release job and release gating
.github/workflows/ci.yml
Adds a new build-release-macos-arm64 job on a self-hosted Apple Silicon runner that provisions libkrun via Homebrew, builds and codesigns minvmd with entitlements, uploads minvmd-macos-arm64, and expands the release job's needs list to include it.

build.rs Rpath Emission Rework

Layer / File(s) Summary
Shared Linux library directory constant
crates/minvmd/build.rs
Adds a LINUX_LIB_DIRS constant with documentation explaining conditional absolute prefix inclusion, binary-relative rpath tokens, and Linux system library seeding.
emit_rpaths implementation and libkrun prefix discovery
crates/minvmd/build.rs
Introduces emit_rpaths and a rpath helper emitting ordered rpath entries (conditional absolute prefix, $ORIGIN/@loader_path, Linux system dirs), and switches find_libkrun_prefix to scan LINUX_LIB_DIRS instead of an inlined candidate list.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
    participant CI as CI Workflow
    participant Linux as build-release-linux-amd64
    participant MacOS as build-release-macos-arm64
    participant Release as release job

    CI->>Linux: run fetch-libkrun.sh, build minvmd
    Linux->>Linux: rename binary, upload minvmd-linux-amd64
    CI->>MacOS: provision libkrun via Homebrew, build minvmd
    MacOS->>MacOS: codesign binary with entitlements
    MacOS->>MacOS: rename binary, upload minvmd-macos-arm64
    Linux-->>Release: artifact ready
    MacOS-->>Release: artifact ready
    Release->>Release: proceed once both artifacts are ready
Loading

Possibly related issues

Possibly related PRs

  • gominimal/minimal#237: Both PRs modify crates/minvmd/build.rs to change how minvmd locates libkrun and emits platform-specific linker/rpath directives.
  • gominimal/minimal#466: Both PRs coordinate around switching CI/libkrun provisioning to scripts/fetch-libkrun.sh and the resulting LIBKRUN_PREFIX layout.
  • gominimal/minimal#508: Both PRs modify macOS CI workflows to provision libkrun via Homebrew on self-hosted Apple Silicon runners.

Suggested reviewers: bryan-minimal, norrietaylor

Poem

A rabbit hops through CI's maze,
Fetching libkrun in new ways,
Signed on macOS, linked with care,
Rpaths ordered, loaded fair,
Two platforms built, one release day! 🐇🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: release builds for minvmd and libkrun search-path adjustments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

277-280: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

persist-credentials: false applied only to this new job.

This checkout step sets persist-credentials: false, but no other actions/checkout step in this file (including the other release jobs) sets it. Based on learnings, this repo's convention is to apply that hardening consistently repo-wide rather than piecemeal per step/job.

📝 Learning reference

Learnt from: norrietaylor, Repo: gominimal/minimal PR: 274 — "don't harden individual actions/checkout steps by adding persist-credentials: false only in one workflow/step ... apply it consistently as a repo-wide change".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 277 - 280, The checkout hardening is
applied only in one new job, but the repo convention is to make this consistent
across all `actions/checkout` uses in this workflow. Update every
`actions/checkout` step in `.github/workflows/ci.yml`—including the other
release jobs—to use the same `persist-credentials: false` setting, keeping the
change uniform rather than scoped to just one job.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 295-300: The current minvmd codesigning step in the CI workflow
uses ad-hoc signing, which will still trigger Gatekeeper for downloaded macOS
releases. Update the release workflow around the codesign step to either use
Developer ID signing and notarization for the published binary, or explicitly
document the manual Gatekeeper override for users if ad-hoc signing is intended.
Reference the existing “Codesign minvmd” job so the release packaging and upload
flow stay consistent.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 277-280: The checkout hardening is applied only in one new job,
but the repo convention is to make this consistent across all `actions/checkout`
uses in this workflow. Update every `actions/checkout` step in
`.github/workflows/ci.yml`—including the other release jobs—to use the same
`persist-credentials: false` setting, keeping the change uniform rather than
scoped to just one job.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 65abd26c-4d41-4525-8454-6df5b31d4d82

📥 Commits

Reviewing files that changed from the base of the PR and between c4d6f82 and df4a27d.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • crates/minvmd/build.rs

Comment thread .github/workflows/ci.yml
Comment on lines +295 to +300
- name: Codesign minvmd (hypervisor entitlement, R1.4)
# Codesigning must be the LAST thing to touch the binary: any later relink
# (a stray cargo build/test) drops the ad-hoc signature and
# krun_start_enter then fails with EINVAL. Renaming + uploading below
# preserve the embedded signature (they don't rewrite the Mach-O).
run: codesign --entitlements crates/minvmd/minvmd.entitlements --force -s - target/release/minvmd

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does an ad-hoc codesigned macOS binary trigger Gatekeeper "unidentified developer" warning when downloaded from the internet?

💡 Result:

Yes, an ad-hoc codesigned macOS binary will trigger a Gatekeeper warning if it is downloaded from the internet and carries a quarantine attribute [1][2][3]. When a binary is downloaded via a browser or similar application, macOS attaches a com.apple.quarantine extended attribute to the file [1][4]. Upon the first execution, Gatekeeper checks the binary's code signature and notarization status [1]. Because ad-hoc signing does not involve a trusted developer identity (i.e., a certificate issued by Apple to an identified developer), the binary fails the requirement for being from an "identified developer" [1][5][6]. Consequently, Gatekeeper will prevent the application from running and typically display a security dialog indicating that the developer cannot be verified or that the app is from an unidentified developer [1][3]. To bypass this, a user must manually override the restriction (e.g., via the Privacy & Security settings in System Settings or by right-clicking the app and selecting "Open") [7][1][8]. Note that on modern versions of macOS, simply ad-hoc signing a binary is insufficient to satisfy Gatekeeper's trust requirements for downloaded software; only software signed with a valid Developer ID and notarized by Apple can pass these checks without manual user intervention [1][4].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the workflow around the cited lines
sed -n '260,330p' .github/workflows/ci.yml

# Find where this binary is uploaded/published
rg -n "minvmd|codesign --entitlements|upload|release|artifact|notar|gatekeeper" .github/workflows . -g '!**/node_modules/**'

Repository: gominimal/minimal

Length of output: 50374


Ad-hoc signing will still trip Gatekeeper on the published macOS release
Browser downloads of this binary will hit the unidentified-developer prompt unless the release is Developer ID–signed and notarized. If that’s intentional, document the manual override for macOS users.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 295 - 300, The current minvmd
codesigning step in the CI workflow uses ad-hoc signing, which will still
trigger Gatekeeper for downloaded macOS releases. Update the release workflow
around the codesign step to either use Developer ID signing and notarization for
the published binary, or explicitly document the manual Gatekeeper override for
users if ad-hoc signing is intended. Reference the existing “Codesign minvmd”
job so the release packaging and upload flow stay consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants