Skip to content

nitro-enclaves: mismatched types: NE_SET_USER_MEMORY_REGION expected i32, found u64 #430

@peppergrayxyz

Description

@peppergrayxyz

Build fails on llvm/musl/libcxx (#429)

Upstream issue: virtee/nitro-enclaves#1
PR has been merged in upstream: virtee/nitro-enclaves#2

   Compiling nitro-enclaves v0.3.0
error[E0308]: mismatched types
    --> /home/pepper/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nitro-enclaves-0.3.0/src/launch/mod.rs:83:56
     |
83   |             let ret = unsafe { libc::ioctl(self.vm_fd, NE_SET_USER_MEMORY_REGION, r) };
     |                                -----------             ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u64`
     |                                |
     |                                arguments to this function are incorrect
     |
note: function defined here
    --> /home/pepper/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.172/src/unix/linux_like/linux/mod.rs:7005:12
     |
7005 |     pub fn ioctl(fd: c_int, request: Ioctl, ...) -> c_int;
     |            ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
     |
83   |             let ret = unsafe { libc::ioctl(self.vm_fd, NE_SET_USER_MEMORY_REGION.try_into().unwrap(), r) };
     |                                                                                 ++++++++++++++++++++

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions