From b655d91b8cb3b60be16c940d7bf4b192c2624a7b Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Wed, 4 Mar 2020 16:46:46 +0100 Subject: sys/openbsd: prevent killing the ssh VM connection This is one of the root causes of the 'no output from test machine' panic. Issuing a DIOCKILLSTATES ioctl on a /dev/pf file descriptor will cause state associated with ongoing connections to be purged; effectively killing the ssh connection to the VM. Including net/pfvar.h is necessary in order to make use of the DIOCKILLSTATES define. --- sys/openbsd/init.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'sys/openbsd/init.go') diff --git a/sys/openbsd/init.go b/sys/openbsd/init.go index 404536dfa..e7c5d08f6 100644 --- a/sys/openbsd/init.go +++ b/sys/openbsd/init.go @@ -13,9 +13,10 @@ import ( func InitTarget(target *prog.Target) { arch := &arch{ - unix: targets.MakeUnixSanitizer(target), - S_IFMT: target.GetConst("S_IFMT"), - S_IFCHR: target.GetConst("S_IFCHR"), + unix: targets.MakeUnixSanitizer(target), + DIOCKILLSTATES: target.GetConst("DIOCKILLSTATES"), + S_IFMT: target.GetConst("S_IFMT"), + S_IFCHR: target.GetConst("S_IFCHR"), } target.MakeMmap = targets.MakePosixMmap(target) @@ -24,9 +25,10 @@ func InitTarget(target *prog.Target) { } type arch struct { - unix *targets.UnixSanitizer - S_IFMT uint64 - S_IFCHR uint64 + unix *targets.UnixSanitizer + DIOCKILLSTATES uint64 + S_IFMT uint64 + S_IFCHR uint64 } const ( @@ -91,6 +93,14 @@ func (arch *arch) SanitizeCall(c *prog.Call) { for _, f := range badflags { flags.Val &= ^f } + case "ioctl": + // Performing the following ioctl on a /dev/pf file descriptor + // causes the ssh VM connection to die. For now, just rewire it + // to an invalid command. + request := c.Args[1].(*prog.ConstArg) + if request.Val == arch.DIOCKILLSTATES { + request.Val = 0 + } case "mknodat": argStart = 2 fallthrough -- cgit mrf-deployment