-
Notifications
You must be signed in to change notification settings - Fork 105
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
ZST DST PME when calling FromBytes::ref_from_bytes
in client code
#1867
Comments
I'm going to see if I can make a few tweaks to make this easier to debug, but likely what's happening is that you're calling an API that doesn't support DSTs whose trailing slice element type is a zero-sized type. The reason we don't support these is that it's ambiguous how many trailing slice elements should be constructed since, no matter what number is chosen, the resulting value will have the same number of bytes. For example, see these docs. |
Okay, I looked more closely at your compiler output, and it seems like the problem is coming from I tried locally to add |
From what I can tell there is no usage of My suspicion is that the feature flags for the |
Sorry @joshlf I forgot to add, do you have any more debugging advice? Thank you for all your help so far, it's been very helpful! |
Oh hahaha I totally missed the crucial piece of information in your original message:
Unless I'm missing something, the call in question is to |
@joshlf no usage of I tried upgrading to v0.8.3 without adding At this point all I can guess is there is some strange interaction with the libfuzzer setup. All other targets can compile, including the alternative "AFL" fuzzer build. Feel free to close this, I don't have any more leads to chase but I might try to pick this up again later. Once again, thank you for your help! 😄 |
You wouldn't need to explicitly add
|
Well that's extremely confusing! 😆 Are you guys just vendoring from our |
I am migrating us from 0.6.6 to 0.8.5! On a whim I pointed to I was happily surprised to see things start to work! So far this has only impacted our fuzzing build, but I am glad to see we can move to a future release to turn it back on. |
Awesome! Unfortunately we probably won't backport 49749b7 to 0.8. Does having it help to debug what's going on? If not backporting it to 0.8 causes serious problems for you, let me know. Maybe we can figure out something else that will unblock you. |
I don't think so. Since the error get's emitted when compiling the zerocopy crate it's hard to trace the offender.
I will check with my team and follow up with. |
FromBytes::ref_from_bytes
in client code
Reflecting on this more, this sounds impossible. Consider this error:
In 0.8.3, line 4555 is in If your code was previously failing because of this error, that means that
This is very confusing 🤔 |
I've encountered what appears to be the same issue starting yesterday using When I build my local project on Windows using |
Is your code open source so we could try to reproduce? |
Unfortunately it's closed-source, but I've found what seems to be a minimal reproduceable example.
On Windows (I've tested using both cargo/rustc versions 1.78 and 1.81),
|
This happens for me when building zerocopy in a cargo-fuzz test, without any actual usage of version 0.8.5.
|
Okay, thanks for everyone's help on this! We've root-caused it. We'll start thinking about how to work around this issue. |
These are causing PMEs in the presence of `-C link-dead-code`, which casues them to be monomorphized for `Self = ()`, thus producing the problematic ZSTy DST `[()]`. Ref rust-lang/rust#131793 Fixes #1867
These are causing PMEs in the presence of `-C link-dead-code`, which casues them to be monomorphized for `Self = ()`, thus producing the problematic ZSTy DST `[()]`. Also bumps version to 0.8.6. Ref rust-lang/rust#131793 Fixes #1867
These are causing PMEs in the presence of `-C link-dead-code`, which casues them to be monomorphized for `Self = ()`, thus producing the problematic ZSTy DST `[()]`. Also bumps version to 0.8.6. Ref rust-lang/rust#131793 Fixes #1867
These are causing PMEs in the presence of `-C link-dead-code`, which casues them to be monomorphized for `Self = ()`, thus producing the problematic ZSTy DST `[()]`. Also bumps version to 0.8.6. Ref rust-lang/rust#131793 Fixes #1867
Hello,
I am migrating from v0.6.6 to v0.8.3 but I am facing a compilation error in zerocode. The library code happily compiles on it's own but when I try to build a fuzz target it fails to compile zerocopy.
This makes me think that I have made a configuration or environmental mistake for the fuzz harness.
However I am having issues tracing the root cause, as the error occurs when compiling the zerocopy crate. It looks like a static assert is being hit, but I'm not entirely sure what it's purpose is and how to trace it back to my code change.
Can you help me identify how to trouble shoot further?
Here is the error I am seeing:
For context, here is my change: chipsalliance/caliptra-dpe#360
And finally here are some steps to repro locally:
I tweaked the $DATE variable to try and match the pinned zerocopy nightly toolchain, but the error remained unchanged.
The text was updated successfully, but these errors were encountered: