]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: crash on netbsd-arm64 when setcontext fails
authorBenny Siegert <bsiegert@gmail.com>
Thu, 6 Jan 2022 11:27:57 +0000 (11:27 +0000)
committerBenny Siegert <bsiegert@gmail.com>
Thu, 6 Jan 2022 14:02:44 +0000 (14:02 +0000)
Instead of exiting with status 16962 when we fail to call SYS_setcontext
in sigreturn, reference a null pointer and crash. Hopefully, this will
enable grabbing a core dump to debug.

Updates #42422

Change-Id: If02c14a0a37084351f3f00db3dc9766cb68ae4b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/375834
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>

src/runtime/sys_netbsd_arm64.s

index 2d0b894d47f6f2037057d6357c853f4ee8acc507..8a0496e80722e349bfc59ffe405be2419b99cc02 100644 (file)
@@ -279,8 +279,8 @@ fail:
 TEXT sigreturn_tramp<>(SB),NOSPLIT,$-8
        MOVD    g, R0
        SVC     $SYS_setcontext
-       MOVD    $0x4242, R0             // Something failed, return magic number
-       SVC     $SYS_exit
+       MOVD    $0, R0
+       MOVD    R0, (R0)                // crash
 
 TEXT runtime·sigaction(SB),NOSPLIT,$-8
        MOVW    sig+0(FP), R0           // arg 1 - signum