-
Notifications
You must be signed in to change notification settings - Fork 26
feat(mirage): add dynamic device naming via manifest and annotations #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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>
✅ Deploy Preview for urunc canceled.
|
|
| 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 |
There was a problem hiding this comment.
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.
| mirageID := m.getMirageDeviceName(ifName, "NET_BASIC", "service") | ||
|
|
||
| netOption := fmt.Sprintf("--net:%s=%s", mirageID, ifName) | ||
| netOption += fmt.Sprintf(" --net-mac:%s=%s", mirageID, mac) |
There was a problem hiding this comment.
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.



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:
This ensures compatibility with diverse MirageOS unikernels.
Fixes: #315