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

Q: how to correctly apply repr attr for backward compat? #291

Closed
kwonoj opened this issue Aug 6, 2022 · 3 comments
Closed

Q: how to correctly apply repr attr for backward compat? #291

kwonoj opened this issue Aug 6, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@kwonoj
Copy link

kwonoj commented Aug 6, 2022

I feel bit lost and probably this is very dumb q, please bear with me if that's the case.

After suggestion from #164 (comment), I tried to apply this practices for the codebase I'm working. It causes some unexpected runtime error only on certain machines (so far I observed aarch64 appl silicon - notably M1 mac), while other machines working properly like local Windows machine / Linux based CI machines.

The symptoms are when guest try to deserialize given struct, its runtime throws like below:

sers/ojkwon/github/swc-coverage-instrument/target/wasm32-wasi/debug/swc_plugin_coverage.wasm

Caused by:
    0: RuntimeError: out of bounds memory access
    1: heap_get_oob

Sadly, no more detailed stacks / whereabout where it exactly try to do.

Couple of bisecting leads me specific change (https://github.com/swc-project/swc/pull/5062/files) caused this. More specifically, adding archive_attr(repr(C | u32), derive(bytecheck::CheckBytes)) makes this happen.

I'm not sure where to dig further / and what to specifically fix at this point and bit stuck. Is there any incorrect practices I did in the offending PR can cause machine-specific runtime error? if that's the case, what's the recommended way to fix it?

Sorry question is bit blur to not able to include suffecient detail. These are only I got so far.

@djkoloski
Copy link
Collaborator

Hey, sorry for the long delay in responding. I'd like to dive deeper into this to understand what's going on better. How can I test to get the same error as described in the issue? If I could pull something down and cargo test that would be ideal, but any repro would work. I also noticed that the example given is running in wasm; does this repro on a host I could debug like an M1 mac? I have hardware to test on M1, I just want to be able to attach a debugger and root around.

Linking #288 since it's also related to swc. I'd like to get this resolved soon.

@kwonoj
Copy link
Author

kwonoj commented Sep 7, 2022

Hi, I'd like to present some simple isolation, but so far failed. Given swc is somewhat large codebase and involves two different binaries (for the host runtime, and the plugin to exchange binary) it may not be easy to do single cargo test right away.

I'm trying to create some set of features to create a specific host & binary test against to see if it can reproduce issues.

@djkoloski
Copy link
Collaborator

Merging this issue into #288

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants