From 64a8e20124dd47151b9e6db38f759b2c549f1cfb Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Wed, 26 Jan 2022 07:20:52 +0100 Subject: sys/openbsd: sync fd range The executor uses more file descriptors by now. --- sys/openbsd/init.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'sys') 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 } -- cgit mrf-deployment