1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:17:58 -07:00

runtime: do not fall through in SIGBUS/SIGSEGV

Faults beyond the first page are not expected
and should fail loudly.  They are not subject to recover.

R=r
CC=golang-dev
https://golang.org/cl/1915042
This commit is contained in:
Russ Cox 2010-07-30 11:32:55 -07:00
parent a0368180a7
commit 68b0a87966
3 changed files with 12 additions and 6 deletions

View File

@ -453,11 +453,13 @@ sigpanic(void)
case SIGBUS:
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
panicstring("invalid memory address or nil pointer dereference");
break;
printf("unexpected fault address %p\n", g->sigcode1);
throw("fault");
case SIGSEGV:
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
panicstring("invalid memory address or nil pointer dereference");
break;
printf("unexpected fault address %p\n", g->sigcode1);
throw("fault");
case SIGFPE:
switch(g->sigcode0) {
case FPE_INTDIV:

View File

@ -179,11 +179,13 @@ sigpanic(void)
case SIGBUS:
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
panicstring("invalid memory address or nil pointer dereference");
break;
printf("unexpected fault address %p\n", g->sigcode1);
throw("fault");
case SIGSEGV:
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
panicstring("invalid memory address or nil pointer dereference");
break;
printf("unexpected fault address %p\n", g->sigcode1);
throw("fault");
case SIGFPE:
switch(g->sigcode0) {
case FPE_INTDIV:

View File

@ -279,11 +279,13 @@ sigpanic(void)
case SIGBUS:
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
panicstring("invalid memory address or nil pointer dereference");
break;
printf("unexpected fault address %p\n", g->sigcode1);
throw("fault");
case SIGSEGV:
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
panicstring("invalid memory address or nil pointer dereference");
break;
printf("unexpected fault address %p\n", g->sigcode1);
throw("fault");
case SIGFPE:
switch(g->sigcode0) {
case FPE_INTDIV: