]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make the wasm crash function abort
authorCherry Mui <cherryyz@google.com>
Fri, 9 Aug 2024 16:50:24 +0000 (12:50 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 12 Aug 2024 16:17:59 +0000 (16:17 +0000)
Currently the crash function on Wasm is implemented as a nil
pointer dereference, which turns into a sigpanic, which turns into
"panic during runtime execution" as we're already in runtime when
crash is called. Instead, just abort, which crashes hard and
terminates the Wasm module execution, and the execution engine
often dumps a stack trace.

Change-Id: I3c57f8ff7a0c0015e4abcd7bf262bf9001624b85
Reviewed-on: https://go-review.googlesource.com/c/go/+/604515
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/runtime/os_wasm.go

index fbafc319b988e6ac068783ba33fa57dda39d5a55..fbf58439b9c4786c554e3bf0a925129f680b3a90 100644 (file)
@@ -96,7 +96,7 @@ func signame(sig uint32) string {
 }
 
 func crash() {
-       *(*int32)(nil) = 0
+       abort()
 }
 
 func initsig(preinit bool) {