summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.cgo
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/malloc.cgo')
-rw-r--r--src/pkg/runtime/malloc.cgo13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pkg/runtime/malloc.cgo b/src/pkg/runtime/malloc.cgo
index 6a769c9e0..3b755fc4e 100644
--- a/src/pkg/runtime/malloc.cgo
+++ b/src/pkg/runtime/malloc.cgo
@@ -208,8 +208,19 @@ mallocinit(void)
void*
SysAlloc(uintptr n)
{
+ void *p;
mstats.sys += n;
- return runtime_mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
+ p = runtime_mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
+ if(p < (void*)4096) {
+ if(p == (void*)EACCES) {
+ printf("mmap: access denied\n");
+ printf("If you're running SELinux, enable execmem for this process.\n");
+ } else {
+ printf("mmap: errno=%p\n", p);
+ }
+ exit(2);
+ }
+ return p;
}
void