From 81041369b29b5f8910b559819512c57d3d86e034 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 28 Sep 2010 20:50:00 -0400 Subject: [PATCH] runtime: fix build On systems where the mmap succeeds (e.g., sysctl -w vm.mmap_min_addr=0) it changes the signal code delivered for a nil fault from ``page not mapped'' to ``invalid permissions for page.'' TBR=r CC=golang-dev https://golang.org/cl/2294041 --- src/pkg/runtime/darwin/thread.c | 2 +- src/pkg/runtime/freebsd/thread.c | 2 +- src/pkg/runtime/linux/thread.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkg/runtime/darwin/thread.c b/src/pkg/runtime/darwin/thread.c index 6f64c087386..f4dd180122d 100644 --- a/src/pkg/runtime/darwin/thread.c +++ b/src/pkg/runtime/darwin/thread.c @@ -456,7 +456,7 @@ sigpanic(void) printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000) + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) panicstring("invalid memory address or nil pointer dereference"); printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); diff --git a/src/pkg/runtime/freebsd/thread.c b/src/pkg/runtime/freebsd/thread.c index c9c058c5aef..27f8aa5ff5f 100644 --- a/src/pkg/runtime/freebsd/thread.c +++ b/src/pkg/runtime/freebsd/thread.c @@ -182,7 +182,7 @@ sigpanic(void) printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000) + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) panicstring("invalid memory address or nil pointer dereference"); printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); diff --git a/src/pkg/runtime/linux/thread.c b/src/pkg/runtime/linux/thread.c index 47bf3428f7f..f31838ea50d 100644 --- a/src/pkg/runtime/linux/thread.c +++ b/src/pkg/runtime/linux/thread.c @@ -168,7 +168,7 @@ unlock(Lock *l) } void -destroylock(Lock *l) +destroylock(Lock*) { } @@ -282,7 +282,7 @@ sigpanic(void) printf("unexpected fault address %p\n", g->sigcode1); throw("fault"); case SIGSEGV: - if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcode1 < 0x1000) + if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode0 == SEGV_ACCERR) && g->sigcode1 < 0x1000) panicstring("invalid memory address or nil pointer dereference"); printf("unexpected fault address %p\n", g->sigcode1); throw("fault");