1 // Copyright 2017 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package akaros 5 6 import ( 7 "github.com/google/syzkaller/prog" 8 "github.com/google/syzkaller/sys/targets" 9 ) 10 11 type arch struct { 12 unix *targets.UnixSanitizer 13 } 14 15 func InitTarget(target *prog.Target) { 16 arch := &arch{ 17 unix: targets.MakeUnixSanitizer(target), 18 } 19 target.MakeMmap = targets.MakePosixMmap(target) 20 target.SanitizeCall = arch.sanitizeCall 21 } 22 23 func (arch *arch) sanitizeCall(c *prog.Call) { 24 arch.unix.SanitizeCall(c) 25 switch c.Meta.CallName { 26 case "provision": 27 if pid, ok := c.Args[0].(*prog.ConstArg); ok && uint32(pid.Val) == ^uint32(0) { 28 // pid -1 causes some debugging splat on console. 29 pid.Val = 0 30 } 31 } 32 } 33