Skip to content

wasm_guest_bindgen! macro doesn't support WIT flags types (needed for wasi:filesystem) #1318

@jsturtevant

Description

@jsturtevant

What happened?

The wasm_guest_bindgen! macro in hyperlight_wasm_macro fails to compile when the WIT world includes flags type definitions (e.g. from wasi:filesystem/types@0.2.0).

Error:

error[E0277]: the trait bound `DescriptorFlags: wasmtime::component::Lower` is not satisfied
error[E0277]: the trait bound `PathFlags: wasmtime::component::Lift` is not satisfied
error[E0277]: the trait bound `OpenFlags: wasmtime::component::Lift` is not satisfied

WIT that triggers the error:

flags descriptor-flags {
  read,
  write,
  file-integrity-sync,
  data-integrity-sync,
  requested-write-sync,
  mutate-directory,
}

flags path-flags {
  symlink-follow,
}

flags open-flags {
  create,
  directory,
  exclusive,
  truncate,
}

Steps to Reproduce

Reproduction

  1. Create a WIT with wasi:filesystem/types including flags descriptor-flags { ... }
  2. Compile with wasm-tools component wit ... -w -o world.wasm
  3. Build with WIT_WORLD=world.wasm cargo build -p hyperlight-wasm
  4. Runtime sub-build fails with the Lift/Lower errors above

Expected Results

Without flags support, it's impossible to use wasi:filesystem with hyperlight-wasm component model support.

Actual Results

TODO: What actually happened?

Versions and Environment

Hyperlight version or commit: TODO

OS Version

Run the following to find your OS version:

Linux:

cat /etc/os-release && uname -a

Windows (PowerShell):

cmd /c ver

Hypervisor

Run the following to check hypervisor access:

Linux:

ls -la /dev/kvm /dev/mshv 2>&1; getfacl /dev/kvm /dev/mshv 2>&1; id
[ -r /dev/kvm ] && [ -w /dev/kvm ] && echo "KVM: OK" || echo "KVM: FAIL"
[ -r /dev/mshv ] && [ -w /dev/mshv ] && echo "MSHV: OK" || echo "MSHV: FAIL"

Windows (Admin PowerShell):

Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -match 'Hyper-V|HypervisorPlatform|VirtualMachinePlatform'} | Format-Table

Extra Info

Anything else you'd like to add?

  • hyperlight-wasm-sockets-example — works around by omitting flags from WIT
  • hyperlight-wasm-http-example — avoids the issue by not importing wasi:filesystem at all

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions