Skip to content

run wasm out of memory in mac causes node crash due to SIGBUS#46559

@HerrCai0907

Description

@HerrCai0907

Version

v20.0.0-pre v16.19.0 v18.14.0

Platform

Darwin LSCN1036555 22.3.0 Darwin Kernel Version 22.3.0: Thu Jan 5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000 arm64

Subsystem

wasm

What steps will reproduce the bug?

run these code in mac, and will get SIGBUS ERROR

node tests/index.cjs zsh: bus error node tests/index.cjs
constfs=require("fs");constpath=require("path");WebAssembly.compile(fs.readFileSync(path.join(__dirname,"debug.wasm"))).then((module)=>{returnWebAssembly.instantiate(module);}).then((ins)=>{ins.exports._start();});
(module (type$none_=>_none (func)) (global$~lib/memory/__data_endi32 (i32.const8)) (global$~lib/memory/__stack_pointer (muti32) (i32.const32776)) (global$~lib/memory/__heap_basei32 (i32.const32776)) (memory$00) (table$011funcref) (elem$0 (i32.const1)) (export"_start" (func$assembly/index/_start)) (export"memory" (memory$0)) (func$assembly/index/_startmemory.size$0i32.const64i32.muli32.const1024i32.muli32.const3i32.subi32.load$0drop ) ) 

How often does it reproduce? Is there a required condition?

100% reproduce

What is the expected behavior?

behavior should be like in other arch.

wasm://wasm/5c312dfe:1

RuntimeError: memory access out of bounds
at assembly/index/_start (wasm://wasm/5c312dfe:wasm-function[0]:0x63)
at /Users/q540239/oss/as/tests/index.cjs:9:17

What do you see instead?

NA

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    macosIssues and PRs related to the macOS platform / OSX.wasmIssues and PRs related to WebAssembly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions