bytecodealliance / bytecodealliance/wasmtime

pointer authentication failed on arm64 android

Open
#11,295 1 comment 0 reactions 0 assignees View on GitHub
bug cranelift:area:aarch64 wasmtime:platform-support
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

### Test Case

```rs
use wasmtime::*;

#[tokio::main]
async fn main() -> Result<(), Box> {
let mut tasks = tokio::task::JoinSet::>::new();
let engine = Engine::new(Config::new().async_support(true))?;
let wasm_bytes = &wat::parse_str(
r#"
(module
(func $hello (import "host" "hello"))
(func (export "run") (call $hello))
)
"#,
)?;
for i in 0..2 {
let mut store = Store::new(&engine, ());
let module = Module::new(&engine, wasm_bytes)?;
let hello_func = Func::wrap_async(&mut store, move |_caller: Caller<'_, ()>, _args: ()| {
Box::new(async move {
println!("Instance {i}: Hello from async WASM!");
tokio::time::sleep(tokio::time::Duration::from_millis(10)).await;
println!("Instance {i}: After 1 ms sleep");
Ok(())
})
});
let instance = Instance::new_async(&mut store, &module, &[hello_func.into()]).await?;
let run = instance.get_typed_func::<(), ()>(&mut store, "run")?;

tasks.spawn(async move {
for _i in 0..5 {
run.call_async(&mut store, ()).await?;
}
Ok(())
});
}

while let Some(result) = tasks.join_next().await {
result??;
}
Ok(())
}
```

### Steps to Reproduce

```
cargo build --target aarch64-linux-android
# run on android device
```

### Expected Results

```
Instance 0: Hello from async WASM!
Instance 1: Hello from async WASM!
Instance 0: After 1 ms sleep
Instance 0: Hello from async WASM!
Instance 1: After 1 ms sleep
...
```

### Actual Results

```
Instance 0: Hello from async WASM!
Instance 1: Hello from async WASM!
Illegal instruction
```

with lldb
```
Instance 0: Hello from async WASM!
Instance 1: Hello from async WASM!
Process 14726 stopped
* thread #2, name = 'tokio-runtime-w', stop reason = signal SIGILL: illegal operand
frame #0: 0x00000055567db894 fiber-test`wasmtime_fiber_switch_34_0_2 + 100
fiber-test`wasmtime_fiber_switch_34_0_2:
-> 0x55567db894 <+100>: autiasp
0x55567db898 <+104>: ret

fiber-test`_$LT$core..result..Result$LT$T$C$F$GT$$u20$as$u20$core..ops..try_trait..FromResidual$LT$core..result..Result$LT$core..convert..Infallible$C$E$GT$$GT$$GT$::from_residual::h0eebfda855441d32:
0x55567db89c <+0>: sub sp, sp, #0x20
0x55567db8a0 <+4>: mov x9, x8
```

### Versions and Environment

Wasmtime version or commit: 34.0.2

Operating system: Android 14

Architecture: aarch64

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.