mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-11 06:25:17 +00:00
![Dmitry Vyukov](/assets/img/avatar_default.png)
Currently target binaries contain support for all OS/arch combinations. However, obviously a fuchsia target binary won't test windows. For target binaries we need support only for a single target (with the exception of 386/arm target in amd64/arm64 binaries). So compile in only _the_ target into target binaries. This reduces akaros/amd64 fuzzer binary from 33 to 7 MB and execprog from 28 to 2 MB.
33 lines
795 B
Go
33 lines
795 B
Go
// Copyright 2017 syzkaller project authors. All rights reserved.
|
|
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
|
|
|
package akaros
|
|
|
|
import (
|
|
"github.com/google/syzkaller/prog"
|
|
"github.com/google/syzkaller/sys/targets"
|
|
)
|
|
|
|
type arch struct {
|
|
unix *targets.UnixSanitizer
|
|
}
|
|
|
|
func InitTarget(target *prog.Target) {
|
|
arch := &arch{
|
|
unix: targets.MakeUnixSanitizer(target),
|
|
}
|
|
target.MakeMmap = targets.MakePosixMmap(target)
|
|
target.SanitizeCall = arch.sanitizeCall
|
|
}
|
|
|
|
func (arch *arch) sanitizeCall(c *prog.Call) {
|
|
arch.unix.SanitizeCall(c)
|
|
switch c.Meta.CallName {
|
|
case "provision":
|
|
if pid, ok := c.Args[0].(*prog.ConstArg); ok && uint32(pid.Val) == ^uint32(0) {
|
|
// pid -1 causes some debugging splat on console.
|
|
pid.Val = 0
|
|
}
|
|
}
|
|
}
|