-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
libgcc_13: SIGABORT inside UnwindRegistration::drop
, __deregister_frame
.
#7997
Comments
UnwindRegistration::drop
, __deregister_frame
.UnwindRegistration::drop
, __deregister_frame
.
Thanks for the report! Would you be able to upload the wasm file here directly? Also would you be able to share a copy/paste of the stack trace you're seeing? I can't reproduce locally with a "hello-world" style module loaded into |
@alexcrichton Yea, this bug appears with this specific WASM component. Give me some time I will try to make a separate simple project reproducing this thing. |
Ok thanks for the component! Looks like just compiling the component, dropping it, and doing that a few times is not sufficient to trigger any bugs. A more minimal repro would be much appreciated, even if it's just a high-level description of how the component is instantiated and worked with. A runnable repro would be perfect! Otherwise though I'll try to dig in later this week and see if I can't see anything that's awry. |
Ok I'm able to reproduce this with: use wasmtime::*;
fn main() {
for i in 0.. {
println!("{i}");
let mut config = Config::new();
config.parallel_compilation(false);
let e = Engine::new(&config).unwrap();
let m = component::Component::from_file(&e, "/src/bench_component.wasm").unwrap();
}
} when specifically compiling with Still trying to figure out what's going on here, but in the meantime setting this config to |
When native unwinding information is enabled Wasmtime will use the `__register_frame` API on Unix platforms to inform the runtime of the unwinding information generated for wasm modules. This function, however, has a different interface in libgcc vs libunwind. This means that we need to detect which is being used and adapt our calls to it appropriately. Previously this decision was static. FreeBSD and Linux glibc would assume libgcc and everything else was assumed to be libunwind. It's possible to use libgcc on other platforms, however, such as with musl. The goal of this PR is to make the detection here more robust. Specifically this PR now probes for a symbol at runtime rather than relying on a compile-time decision. That way we can see what we got at runtime and make the decision then. Closes bytecodealliance#7997
Ok and I think that #8028 should completely fix this |
@alexcrichton BTW don't you think it could be a bug inside the libgcc as well ? |
Perhaps! I wouldn't be able to conclude that with any certainty though. The libgcc code is pretty opaque to me. I think it's probably lucky that this worked before because libgcc's interface is clearly different than libunwind's and we were using the wrong one on musl. With the above PR we should correctly use the libgcc-desired interface on musl by seeing that libunwind isn't available. |
I see, thanks a lot for your so quick response ! |
When native unwinding information is enabled Wasmtime will use the `__register_frame` API on Unix platforms to inform the runtime of the unwinding information generated for wasm modules. This function, however, has a different interface in libgcc vs libunwind. This means that we need to detect which is being used and adapt our calls to it appropriately. Previously this decision was static. FreeBSD and Linux glibc would assume libgcc and everything else was assumed to be libunwind. It's possible to use libgcc on other platforms, however, such as with musl. The goal of this PR is to make the detection here more robust. Specifically this PR now probes for a symbol at runtime rather than relying on a compile-time decision. That way we can see what we got at runtime and make the decision then. Closes #7997
We have faced a
SIGABORT
failure during executing simple benchmark which you can find here https://github.com/input-output-hk/hermes/blob/f4d20fc06f0b558be4805a106db32480bcef649d/hermes/bin/src/wasm/module.rs#L118.Stack trace:
Steps to Reproduce
You can fully reproduce it in already prepared environment and code but cloning our repo and specifically this branch
libgcc-wasmtime-unwinding-bug
. (repo: https://github.com/input-output-hk/hermes)Before start you will need to install earthly tool.
To run it you will need to execute the following in the root of the repo
This will prepare an
alpine:3.19
environment withrust:1.75
version and all our project configuration that we have an all source code and run a benchmarks.Earthfile code https://github.com/input-output-hk/hermes/blob/libgcc-wasmtime-unwinding-bug/hermes/Earthfile#L18
After the failure it will run an interacting mode
-i
flag (similar to docker interactive mode).So you will be able to collect a dump file inside this container.
Then inspect it and using
gdb
gdb ./target/release/deps/module-<> core -- --bench
Actual Results
SIGABORT
Versions and Environment
Wasmtime version or commit: 17.0.0
Operating system: alpine:3.19
Extra Info
This is totally works on
alpine:3.18
version with thelibgcc:12
version.We have found that most probable it is an issue with
libgcc
because, there is a huge difference with the libgcc unwinding implementation between these two versions.libgcc_12 - https://github.com/gcc-mirror/gcc/blob/8cbb2cade4c724760c868c9f493b169d6ec4168a/libgcc/unwind-dw2-fde.c#L201
libgcc_13 - https://github.com/gcc-mirror/gcc/blob/0e7bc3eaa36b81004b799124d2fe00137401a43b/libgcc/unwind-dw2-fde.c#L225
You can try it running already prepared earthly target https://github.com/input-output-hk/hermes/blob/libgcc-wasmtime-unwinding-bug/hermes/Earthfile#L38
The text was updated successfully, but these errors were encountered: