Skip to content
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

error[E0793]: reference to packed field is unaligned. Ubuntu 20.04 #6

Open
ilorj opened this issue Aug 21, 2023 · 4 comments
Open

error[E0793]: reference to packed field is unaligned. Ubuntu 20.04 #6

ilorj opened this issue Aug 21, 2023 · 4 comments

Comments

@ilorj
Copy link

ilorj commented Aug 21, 2023

nyx-net git:(main) ./setup.sh
[?] Checking submodules ...
[?] Checking QEMU-NYX ...
[?] Checking NYX-Net fuzzer ...
[*] Compiling NYX-Net fuzzer ...
[?] Checking submodules ...
[?] Checking rust_fuzzer ...
Compiling fuzz_runner v0.1.0 (/home/ilorj/Desktop/protocols/nyx-net/fuzzer/libnyx/fuzz_runner)
error[E0793]: reference to packed field is unaligned
--> /home/ilorj/Desktop/protocols/nyx-net/fuzzer/libnyx/fuzz_runner/src/lib.rs:221:9
|
221 | &self.feedback_data.shared.ijon.max_data
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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)

For more information about this error, try rustc --explain E0793.
error: could not compile fuzz_runner due to previous error

nyx-net git:(main) cargo --version
cargo 1.69.0 (6e9a83356 2023-04-12)
nyx-net git:(main) rustc --version
rustc 1.69.0 (84c898d65 2023-04-16)

@ilorj ilorj changed the title error[E0793]: reference to packed field is unaligned error[E0793]: reference to packed field is unaligned. Ubuntu 20.04 Aug 21, 2023
@nj00001
Copy link

nj00001 commented Sep 4, 2023

same error

1 similar comment
@bluestar628
Copy link

same error

@RIeFre
Copy link

RIeFre commented Sep 27, 2023

@ilorj @nj00001 @bluestar628
Hi, I had the same error and resolved it by downgrading rust to 1.63.0, which was done by executing rustup override set 1.63.0 in nyx-net directory.

@zengman
Copy link

zengman commented Oct 30, 2023

I solved this problem by downgrading rust to 1.65.0
Ubuntu 22.04, rustup override set 1.65.0
add #[allow(unaligned_references)] before fn ijon_max_buffer(&self)->&[64] in nyx-net/fuzzer/libnyx/fuzz_runner/src/lib.rs file

for example,

#[allow(unaligned_references)]
fn ijon_max_buffer(&self) -> &[u64] {
    &self.feedback_data.shared.ijon.max_data
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants