summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/os_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/os_linux.c')
-rw-r--r--src/pkg/runtime/os_linux.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pkg/runtime/os_linux.c b/src/pkg/runtime/os_linux.c
index cb45fe8ce..8a945242b 100644
--- a/src/pkg/runtime/os_linux.c
+++ b/src/pkg/runtime/os_linux.c
@@ -218,9 +218,12 @@ runtime·unminit(void)
void
runtime·sigpanic(void)
{
+ if(!runtime·canpanic(g))
+ runtime·throw("unexpected signal during runtime execution");
+
switch(g->sig) {
case SIGBUS:
- if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) {
+ if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000 || g->paniconfault) {
if(g->sigpc == 0)
runtime·panicstring("call of nil func value");
runtime·panicstring("invalid memory address or nil pointer dereference");
@@ -228,7 +231,7 @@ runtime·sigpanic(void)
runtime·printf("unexpected fault address %p\n", g->sigcode1);
runtime·throw("fault");
case SIGSEGV:
- if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) {
+ if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000 || g->paniconfault) {
if(g->sigpc == 0)
runtime·panicstring("call of nil func value");
runtime·panicstring("invalid memory address or nil pointer dereference");
@@ -331,3 +334,9 @@ runtime·signalstack(byte *p, int32 n)
st.ss_flags = SS_DISABLE;
runtime·sigaltstack(&st, nil);
}
+
+void
+runtime·unblocksignals(void)
+{
+ runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof sigset_none);
+}