rust-vmm / vm-virtio

virtio implementation
Apache License 2.0
364 stars 87 forks source link

Upload a new version of virtio-bindings to crates.io #227

Closed cblichmann closed 1 year ago

cblichmann commented 1 year ago

The current version of virtio-bindings on crates.io refers to the now archived virtio-bindings repo instead of this one. It also hasn't been updated in 3 years, while this repo is much more up-to-date.

Can someone please upload the most recent version to crates.io and maybe increment the version?

andreeaflorescu commented 1 year ago

Hah, great timing! I was just writing about this in the new release for virtio-queue. We discovered some issues in virtio-queue during fuzzing and also some problems with the endianess. I will first publish a patch release to fix these (see #226), and then I am planning on publishing a new virtio-bindings and update to the new version in virtio-queue as well.

cblichmann commented 1 year ago

Hah, great timing! I was just writing about this in the new release for virtio-queue.

Cool :)

... I am planning on publishing a new virtio-bindings and update to the new version in virtio-queue as well.

Will that compile on one of the more recent nightlies? Upgrading our toolchain to rust nightly 2023-02-09 prompted me to look into this issue in the first place.

andreeaflorescu commented 1 year ago

... I am planning on publishing a new virtio-bindings and update to the new version in virtio-queue as well.

Will that compile on one of the more recent nightlies? Upgrading our toolchain to rust nightly 2023-02-09 prompted me to look into this issue in the first place.

Hmmm, I am not really sure. Can you test #228 with your environment and see if it fixes the problem? If now we should probably track it in a separate issue. What errors are you getting?

cblichmann commented 1 year ago

... I am planning on publishing a new virtio-bindings and update to the new version in virtio-queue as well.

Will that compile on one of the more recent nightlies? Upgrading our toolchain to rust nightly 2023-02-09 prompted me to look into this issue in the first place.

Hmmm, I am not really sure. Can you test #228 with your environment and see if it fixes the problem? If now we should probably track it in a separate issue. What errors are you getting?

With v0.1.0 and the nightly I mentioned, I get error like these:

error[E0793]: reference to packed field is unaligned
   --> third_party/rust/virtio_bindings/v0_1/src/bindings_v5_0_0/virtio_blk.rs:270:18
    |
270 |         unsafe { &(*(::std::ptr::null::<virtio_blk_config>())).capacity as *const _ as usize },
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
    = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)

I'll check with v0.2.0 and report back.

andreeaflorescu commented 1 year ago

@cblichmann I've published the new version on crates.io: https://crates.io/crates/virtio-bindings. If the problem you mentioned persists, can you please open a separate issue about it?

cblichmann commented 1 year ago

Thanks! Looking good!