aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/linux
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2009-11-13 10:08:51 -0800
committerAdam Langley <agl@golang.org>2009-11-13 10:08:51 -0800
commit3f7a32405d3a28416d97adc812ac87a0719d6bca (patch)
tree4ba8ca5d4da12665c34eacf2d8e760574fa7a9ec /src/pkg/runtime/linux
parent593ccd1d447aa20aae4699efba782a70631cfae4 (diff)
downloadgo-3f7a32405d3a28416d97adc812ac87a0719d6bca.tar.xz
runtime: warn about SELinux based mmap failures on Linux.
SELinux will cause mmap to fail when we request w+x memory unless the user has configured their policies. We have a warning in make.bash, but it's quite likely that the policy will be reset at some point and then all their binaries start failing. This patch prints a warning on Linux when mmap fails with EACCES. R=rsc CC=golang-dev https://golang.org/cl/152086
Diffstat (limited to 'src/pkg/runtime/linux')
-rwxr-xr-xsrc/pkg/runtime/linux/386/sys.s5
-rw-r--r--src/pkg/runtime/linux/amd64/sys.s5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/pkg/runtime/linux/386/sys.s b/src/pkg/runtime/linux/386/sys.s
index cc793b4208..097dfe9155 100755
--- a/src/pkg/runtime/linux/386/sys.s
+++ b/src/pkg/runtime/linux/386/sys.s
@@ -69,8 +69,9 @@ TEXT runtime·mmap(SB),7,$0
SHRL $12, BP
INT $0x80
CMPL AX, $0xfffff001
- JLS 2(PC)
- INT $3
+ JLS 3(PC)
+ NOTL AX
+ INCL AX
RET
// int32 futex(int32 *uaddr, int32 op, int32 val,
diff --git a/src/pkg/runtime/linux/amd64/sys.s b/src/pkg/runtime/linux/amd64/sys.s
index a78357fdbd..238a423b13 100644
--- a/src/pkg/runtime/linux/amd64/sys.s
+++ b/src/pkg/runtime/linux/amd64/sys.s
@@ -81,8 +81,9 @@ TEXT runtime·mmap(SB),7,$0-32
MOVL $9, AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
- JLS 2(PC)
- CALL notok(SB)
+ JLS 3(PC)
+ NOTQ AX
+ INCQ AX
RET
TEXT notok(SB),7,$0