mirror of
https://github.com/golang/go
synced 2024-11-20 04:14:49 -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:
parent
a0368180a7
commit
68b0a87966
@ -453,11 +453,13 @@ sigpanic(void)
|
|||||||
case SIGBUS:
|
case SIGBUS:
|
||||||
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
|
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
|
||||||
panicstring("invalid memory address or nil pointer dereference");
|
panicstring("invalid memory address or nil pointer dereference");
|
||||||
break;
|
printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
|
throw("fault");
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
|
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
|
||||||
panicstring("invalid memory address or nil pointer dereference");
|
panicstring("invalid memory address or nil pointer dereference");
|
||||||
break;
|
printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
|
throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
switch(g->sigcode0) {
|
switch(g->sigcode0) {
|
||||||
case FPE_INTDIV:
|
case FPE_INTDIV:
|
||||||
|
@ -179,11 +179,13 @@ sigpanic(void)
|
|||||||
case SIGBUS:
|
case SIGBUS:
|
||||||
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
|
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
|
||||||
panicstring("invalid memory address or nil pointer dereference");
|
panicstring("invalid memory address or nil pointer dereference");
|
||||||
break;
|
printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
|
throw("fault");
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
|
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
|
||||||
panicstring("invalid memory address or nil pointer dereference");
|
panicstring("invalid memory address or nil pointer dereference");
|
||||||
break;
|
printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
|
throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
switch(g->sigcode0) {
|
switch(g->sigcode0) {
|
||||||
case FPE_INTDIV:
|
case FPE_INTDIV:
|
||||||
|
@ -279,11 +279,13 @@ sigpanic(void)
|
|||||||
case SIGBUS:
|
case SIGBUS:
|
||||||
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
|
if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
|
||||||
panicstring("invalid memory address or nil pointer dereference");
|
panicstring("invalid memory address or nil pointer dereference");
|
||||||
break;
|
printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
|
throw("fault");
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
|
if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000)
|
||||||
panicstring("invalid memory address or nil pointer dereference");
|
panicstring("invalid memory address or nil pointer dereference");
|
||||||
break;
|
printf("unexpected fault address %p\n", g->sigcode1);
|
||||||
|
throw("fault");
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
switch(g->sigcode0) {
|
switch(g->sigcode0) {
|
||||||
case FPE_INTDIV:
|
case FPE_INTDIV:
|
||||||
|
Loading…
Reference in New Issue
Block a user