aboutsummaryrefslogtreecommitdiffstats
path: root/sys/openbsd/init.go
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@basename.se>2019-06-14 17:59:10 +0200
committerAnton Lindqvist <anton@basename.se>2019-06-14 18:34:50 +0200
commit442206d76b974cca2d83ec763d4cf5ee829eb7d6 (patch)
treec5d8bb747bc40b68a37ef6c8ddd1821540e5cb0d /sys/openbsd/init.go
parent1dcdf7ef377b92b265bd3ae687913fdb8a1e031e (diff)
sys/openbsd: sanitize mlockall syscalls
Locking down future mappings will most likely cause syz-executor to run out of memory. This is one of the root causes of the high amount of reported "lost connection to test machine".
Diffstat (limited to 'sys/openbsd/init.go')
-rw-r--r--sys/openbsd/init.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/openbsd/init.go b/sys/openbsd/init.go
index 8d5e8b0dd..01450ee3c 100644
--- a/sys/openbsd/init.go
+++ b/sys/openbsd/init.go
@@ -42,6 +42,9 @@ const (
// kOutPipeFd in executor/executor.cc
kcovFdMinorMax = 248
+ // MCL_FUTURE from openbsd:src/sys/sys/mman.h
+ mclFuture uint64 = 0x2
+
// RLIMIT_DATA from openbsd:src/sys/sys/resource.h
rlimitData = 2
// RLIMIT_STACK from openbsd:src/sys/sys/resource.h
@@ -112,6 +115,9 @@ func (arch *arch) SanitizeCall(c *prog.Call) {
if devmajor(dev.Val) == 4 && devminor(dev.Val) == 2 {
dev.Val = devNullDevT
}
+ case "mlockall":
+ flags := c.Args[0].(*prog.ConstArg)
+ flags.Val &= ^mclFuture
case "setrlimit":
var rlimitMin uint64
var rlimitMax uint64 = math.MaxUint64