Skip to content

Conversation

@codesmith25103
Copy link
Contributor

Previously, urunc hardcoded MirageOS network interfaces to 'service'
and block devices to 'storage'. This caused failures for unikernels
that defined different interface names in their Solo5 manifest.

This commit introduces dynamic device discovery and mapping:

  • Parsed .note.solo5.manifest from ELF binary for auto-detection.
  • Added support for urunc.dev/mirage-net-map annotations.
  • Updated UnikernelParams to pass binary path and annotations.

This ensures compatibility with diverse MirageOS unikernels.
Fixes: #315

Previously, urunc hardcoded MirageOS network interfaces to 'service' and
block devices to 'storage'. This caused failures for unikernels that
defined different interface names in their Solo5 manifest.

This commit introduces dynamic device discovery and mapping:
- Parsed .note.solo5.manifest from ELF binary for auto-detection.
- Added support for urunc.dev/mirage-net-map annotations.
- Updated UnikernelParams to pass binary path and annotations.

This ensures compatibility with diverse MirageOS unikernels.
Fixes: urunc-dev#315
Signed-off-by: Sankalp <sankalp25103@gmail.com>
@netlify
Copy link

netlify bot commented Dec 23, 2025

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 5aed176
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/694acd5d841e2e0008c4fcd1

@sonarqubecloud
Copy link

Comment on lines +183 to +194
var manifest Solo5Manifest
// Attempt to find the start of the JSON object '{'
jsonStart := strings.Index(string(data), "{")
if jsonStart == -1 {
return nil, fmt.Errorf("invalid manifest format")
}

if err := json.Unmarshal(data[jsonStart:], &manifest); err != nil {
return nil, err
}

return &manifest, nil
Copy link

Choose a reason for hiding this comment

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

The note doesn't contain json. See https://github.com/Solo5/solo5/blob/dabc69fd89b8119449ec4088c54b458d4ccc851b/include/mft_abi.h for the format, or https://git.robur.coop/robur/ocaml-solo5-elftool/src/branch/main/lib/solo5_elftool.ml#L73-L146 for code that parses the format.

If you want json you can use solo5-elftool query-manifest $executable assuming solo5-elftool is in $PATH. This adds an external dependency though.

Comment on lines +78 to +81
mirageID := m.getMirageDeviceName(ifName, "NET_BASIC", "service")

netOption := fmt.Sprintf("--net:%s=%s", mirageID, ifName)
netOption += fmt.Sprintf(" --net-mac:%s=%s", mirageID, mac)
Copy link

Choose a reason for hiding this comment

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

Not sure what the security model is, but you may consider enforcing the constraint that device names are alphanumerical (and at most a fixed length which I don't remember). Otherwise you can inject arbitrary strings here.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple block and network devices over Solo5/MirageOS

3 participants