aboutsummaryrefslogtreecommitdiffstats
path: root/sys/openbsd
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@basename.se>2022-01-26 07:20:52 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2022-01-27 16:52:10 +0100
commit64a8e20124dd47151b9e6db38f759b2c549f1cfb (patch)
treecf41ae3a1279994e51aefc7a3c056289fc8378c3 /sys/openbsd
parentcdc495da6ff15d590df13dd5bf927893e33f9e3a (diff)
sys/openbsd: sync fd range
The executor uses more file descriptors by now.
Diffstat (limited to 'sys/openbsd')
-rw-r--r--sys/openbsd/init.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/openbsd/init.go b/sys/openbsd/init.go
index 80e8d5527..497291244 100644
--- a/sys/openbsd/init.go
+++ b/sys/openbsd/init.go
@@ -61,11 +61,6 @@ const (
devFdMajor = 22
devNullDevT = 0x0202
- // kCoverFd in executor/executor.cc.
- kcovFdMinorMin = 232
- // kOutPipeFd in executor/executor.cc.
- kcovFdMinorMax = 248
-
// Mask covering all valid rlimit resources.
rlimitMask = 0xf
)
@@ -80,11 +75,11 @@ func devminor(dev uint64) uint64 {
return (dev & 0xff) | ((dev & 0xffff0000) >> 8)
}
-func isKcovFd(dev uint64) bool {
+func isExecutorFd(dev uint64) bool {
major := devmajor(dev)
minor := devminor(dev)
- return major == devFdMajor && minor >= kcovFdMinorMin && minor < kcovFdMinorMax
+ return major == devFdMajor && minor >= 200
}
func (arch *arch) neutralize(c *prog.Call) {
@@ -130,12 +125,14 @@ func (arch *arch) neutralize(c *prog.Call) {
mode.Val |= arch.S_IFCHR
}
- // Prevent /dev/fd/X devices from getting created where X maps
- // to an open kcov fd. They interfere with kcov data collection
- // and cause corpus explosion.
+ // Prevent certain /dev/fd/X devices from getting created since
+ // they belong to the executor. It's especially dangerous to let
+ // the executor interact with kcov file descriptors since it can
+ // interfere with the coverage collection and cause corpus
+ // explosion.
// https://groups.google.com/d/msg/syzkaller/_IRWeAjVoy4/Akl2XMZTDAAJ
dev := c.Args[argStart+mknodDev].(*prog.ConstArg)
- if isKcovFd(dev.Val) {
+ if isExecutorFd(dev.Val) {
dev.Val = devNullDevT
}