aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@basename.se>2020-08-05 09:49:13 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-08-05 15:05:15 +0200
commit2cea8f1f899dbf123a523dd273b842df430d4893 (patch)
tree46d8d8b846777113fb420d57eb9e3311a925addf /sys
parentb712935571355df44e126c5b27c98ccd53d1d18b (diff)
sys/openbsd: neutralize clock_settime
One of "no output from test machine" report causes[1]. [1] https://syzkaller.appspot.com/text?tag=ReproSyz&x=10b0c7d8900000
Diffstat (limited to 'sys')
-rw-r--r--sys/openbsd/init.go15
-rw-r--r--sys/openbsd/init_test.go4
2 files changed, 19 insertions, 0 deletions
diff --git a/sys/openbsd/init.go b/sys/openbsd/init.go
index 67fa06f59..9b6e68ed1 100644
--- a/sys/openbsd/init.go
+++ b/sys/openbsd/init.go
@@ -14,6 +14,7 @@ import (
func InitTarget(target *prog.Target) {
arch := &arch{
unix: targets.MakeUnixNeutralizer(target),
+ CLOCK_REALTIME: target.GetConst("CLOCK_REALTIME"),
CTL_KERN: target.GetConst("CTL_KERN"),
DIOCCLRSTATES: target.GetConst("DIOCCLRSTATES"),
DIOCKILLSTATES: target.GetConst("DIOCKILLSTATES"),
@@ -32,6 +33,7 @@ func InitTarget(target *prog.Target) {
type arch struct {
unix *targets.UnixNeutralizer
+ CLOCK_REALTIME uint64
CTL_KERN uint64
DIOCCLRSTATES uint64
DIOCKILLSTATES uint64
@@ -98,6 +100,8 @@ func (arch *arch) neutralize(c *prog.Call) {
for _, f := range badflags {
flags.Val &= ^f
}
+ case "clock_settime":
+ arch.neutralizeClockSettime(c)
case "ioctl":
// Performing the following ioctl commands on a /dev/pf file
// descriptor causes the ssh VM connection to die. For now, just
@@ -145,6 +149,17 @@ func (arch *arch) neutralize(c *prog.Call) {
}
}
+func (arch *arch) neutralizeClockSettime(c *prog.Call) {
+ switch v := c.Args[0].(type) {
+ case *prog.ConstArg:
+ // Do not fiddle with the wall clock, one of the causes of "no
+ // output from test machine" reports.
+ if v.Val == arch.CLOCK_REALTIME {
+ v.Val = ^uint64(0)
+ }
+ }
+}
+
func (arch *arch) neutralizeRlimit(c *prog.Call) {
rlimitMin := uint64(0)
rlimitMax := uint64(math.MaxUint64)
diff --git a/sys/openbsd/init_test.go b/sys/openbsd/init_test.go
index 7635d2159..d749acc09 100644
--- a/sys/openbsd/init_test.go
+++ b/sys/openbsd/init_test.go
@@ -87,5 +87,9 @@ func TestNeutralize(t *testing.T) {
In: `sysctl$kern(&(0x7f0000cc0ff0)={0x1, 0x43}, 0x0, 0x0, 0x0, &(0x7f0000000180), 0x0)`,
Out: `sysctl$kern(&(0x7f0000cc0ff0)={0x0}, 0x0, 0x0, 0x0, &(0x7f0000000180), 0x0)`,
},
+ {
+ In: `clock_settime(0x0, &(0x7f0000cc0ff0)={0x0, 0x0})`,
+ Out: `clock_settime(0xffffffffffffffff, &(0x7f0000cc0ff0))`,
+ },
})
}