Bug 259441 - WASM module memory errors
Summary: WASM module memory errors
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-07-24 03:21 PDT by jrx
Modified: 2023-12-29 04:07 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jrx 2023-07-24 03:21:03 PDT
We had a weird bug using Tauri + Leptos (Rust/WASM) framework.
Those are using the system webview in order to run a UI (Electron style ... but without chrome)

On our linux machines (Ubuntu or Fedora), it randomly crashes.
more details here : https://github.com/rustwasm/wasm-bindgen/issues/3470

Narrowed it with this very light example : https://github.com/jrouaix/wasm_pbm
- this is 100% sure NOT related to Tauri
- we also reproduced it without Leptos

Do you folks have an idea where I should dig more or ask for help in order to resolve the issue ?
(i'm very surprise to be the first to step into something so easy to reproduce)
Comment 1 Justin Michaud 2023-07-24 13:39:15 PDT
This issue can be caused by a wide variety of problems.

Does your example work correctly in Chrome or Firefox? Does it reproduce on the latest version of epiphany?

If you increase the amount of memory that rust asks for up front, does the issue go away? If you lower it, does the issue reproduce in the other browsers? What about stack size?

This could be a:
1) random bug in rust or any linked frameworks
2) we run out of memory, but don't signal this to memory.grow successfully
3) we run out of memory, produce the correct status code in memory.grow, but rust doesn't give you a good error
4) the rust sdk goes down a completely different code path for some reason

Cutting down the example further, and perhaps placing some logging around allocations would be super helpful here.
Comment 2 Justin Michaud 2023-07-24 13:41:20 PDT
On the WebKit side, there are some options you can try running with. GTK folks can explain how to pass them in, I only know how to do it on macOS.

useWebAssemblyFastMemory=0

useOMGJIT=0

useOMGJIT=0 useWasmLLInt=0
Comment 3 jrx 2023-07-25 02:43:50 PDT
It's working perfectly on Chrome & Firefox

I was running `Web 42.4` epiphany version that is 11 months old !

Reinstalled with flatpack : epiphany 44.4 / WebKitGTK 2.40.4

reproduced exactly same problem
Comment 4 jrx 2023-07-25 03:19:16 PDT
Tried on another project with `yew` (another Rust wasm framework) => same same, got a wasm crash after about 20 reloads
Comment 5 jrx 2023-07-27 06:29:26 PDT
So perhaps using WASM & Webkit on Linux is so niche nobody spot this bug yet ?
I wonder if there could be an exploit of some kind. I'm not security researcher.
Comment 6 Radar WebKit Bug Importer 2023-07-31 03:21:15 PDT
<rdar://problem/113131117>
Comment 7 dietmar 2023-12-29 04:07:42 PST
Just uploaded another test using Yew:

https://github.com/maurerdietmar/webkit-yew-bug

Wewbkit is currently unable to run WASM code reliable.