diff --git a/Makefile b/Makefile index bdfe3693..f23eb321 100644 --- a/Makefile +++ b/Makefile @@ -49,11 +49,6 @@ ifeq ("$(TARGETOS)", "fuchsia") GO = "$(SOURCEDIR)/scripts/devshell/go" endif -ifeq ("$(TARGETOS)", "akaros") - TARGETGOOS := $(HOSTOS) - TARGETGOARCH := $(HOSTARCH) -endif - GITREV=$(shell git rev-parse HEAD) ifeq ("$(shell git diff --shortstat)", "") REV=$(GITREV) @@ -66,8 +61,16 @@ endif # That's only needed if you use gdb or nm. # If you need that, build manually without these flags. GOFLAGS := "-ldflags=-s -w -X github.com/google/syzkaller/sys.GitRevision=$(REV)" +GOHOSTFLAGS := $(GOFLAGS) +GOTARGETFLAGS := $(GOFLAGS) ifneq ("$(GOTAGS)", "") - GOFLAGS += "-tags=$(GOTAGS)" + GOHOSTFLAGS += "-tags=$(GOTAGS)" +endif +GOTARGETFLAGS += "-tags=syz_target syz_os_$(TARGETOS) syz_arch_$(TARGETVMARCH) $(GOTAGS)" + +ifeq ("$(TARGETOS)", "akaros") + TARGETGOOS := $(HOSTOS) + TARGETGOARCH := $(HOSTARCH) endif .PHONY: all host target \ @@ -103,42 +106,42 @@ executor: -DGOOS_$(TARGETOS)=1 -DGOARCH_$(TARGETARCH)=1 -DGIT_REVISION=\"$(REV)\" manager: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-manager github.com/google/syzkaller/syz-manager + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-manager github.com/google/syzkaller/syz-manager fuzzer: - GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-fuzzer$(EXE) github.com/google/syzkaller/syz-fuzzer + GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-fuzzer$(EXE) github.com/google/syzkaller/syz-fuzzer execprog: - GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-execprog$(EXE) github.com/google/syzkaller/tools/syz-execprog + GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-execprog$(EXE) github.com/google/syzkaller/tools/syz-execprog ci: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-ci github.com/google/syzkaller/syz-ci + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-ci github.com/google/syzkaller/syz-ci hub: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-hub github.com/google/syzkaller/syz-hub + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-hub github.com/google/syzkaller/syz-hub repro: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-repro github.com/google/syzkaller/tools/syz-repro + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-repro github.com/google/syzkaller/tools/syz-repro mutate: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-mutate github.com/google/syzkaller/tools/syz-mutate + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-mutate github.com/google/syzkaller/tools/syz-mutate prog2c: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-prog2c github.com/google/syzkaller/tools/syz-prog2c + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-prog2c github.com/google/syzkaller/tools/syz-prog2c stress: - GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-stress$(EXE) github.com/google/syzkaller/tools/syz-stress + GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-stress$(EXE) github.com/google/syzkaller/tools/syz-stress db: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-db github.com/google/syzkaller/tools/syz-db + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-db github.com/google/syzkaller/tools/syz-db upgrade: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade extract: bin/syz-extract bin/syz-extract -build -os=$(TARGETOS) -sourcedir=$(SOURCEDIR) $(FILES) bin/syz-extract: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOFLAGS) -o $@ ./sys/syz-extract + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o $@ ./sys/syz-extract generate: generate_go generate_sys $(MAKE) format @@ -150,7 +153,7 @@ generate_sys: bin/syz-sysgen bin/syz-sysgen bin/syz-sysgen: - $(GO) build $(GOFLAGS) -o $@ ./sys/syz-sysgen + $(GO) build $(GOHOSTFLAGS) -o $@ ./sys/syz-sysgen format: format_go format_cpp format_sys @@ -170,7 +173,7 @@ format_sys: bin/syz-fmt bin/syz-fmt sys/windows bin/syz-fmt: - $(GO) build $(GOFLAGS) -o $@ ./tools/syz-fmt + $(GO) build $(GOHOSTFLAGS) -o $@ ./tools/syz-fmt tidy: # A single check is enabled for now. But it's always fixable and proved to be useful. diff --git a/executor/defs.h b/executor/defs.h index b834970e..a60c68b3 100644 --- a/executor/defs.h +++ b/executor/defs.h @@ -5,7 +5,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "36f0e5da1becfe451b2936a2b8b1739deb53c609" +#define SYZ_REVISION "0dd50d0ed02c0d84fb296a804d96c2f758c18e11" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 @@ -20,7 +20,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "fd7de83a3ebf8e454b041bbfe7513ed4a139d44d" +#define SYZ_REVISION "89eac40a68a14ffc0af9fc9b181147236b82d00b" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -35,7 +35,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "9540132f74bbe9bfb7e8f215844bdb3a88b9a665" +#define SYZ_REVISION "4cc56cb437136b65655dd3e0d9389be66131c7d1" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 @@ -45,7 +45,7 @@ #if GOARCH_arm64 #define GOARCH "arm64" -#define SYZ_REVISION "ebb425942f2bbfd2db293e4a2a0a417f6aaafb1c" +#define SYZ_REVISION "42ba25aa193b27b48c8f8ade1c9186cb89c7ca61" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 @@ -60,7 +60,7 @@ #if GOARCH_386 #define GOARCH "386" -#define SYZ_REVISION "d16df4bd3b5d63c53207d8d48f0e7aa8375ae471" +#define SYZ_REVISION "c026c82f557e0fb27209b060f233071e8ba38eab" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -70,7 +70,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "22bac64bd4f91440dd851726a290b9eb1f1ae092" +#define SYZ_REVISION "c06fc3bdc53ae8ee708128ddd51d14a679aa12f0" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -80,7 +80,7 @@ #if GOARCH_arm #define GOARCH "arm" -#define SYZ_REVISION "c46361b24a9d8c4d25f99c6a74ed373b73b0cdd1" +#define SYZ_REVISION "b4f6cbe7c414a45bfaf3dcccf7f1040502de3980" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -90,7 +90,7 @@ #if GOARCH_arm64 #define GOARCH "arm64" -#define SYZ_REVISION "e1ce203bf0cb9e092e65fc6ca9cd1cde96e19316" +#define SYZ_REVISION "70ff2aa900dc3911170ab814adc6a362bb014580" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -100,7 +100,7 @@ #if GOARCH_ppc64le #define GOARCH "ppc64le" -#define SYZ_REVISION "1ccba534d5c6adaffc5ebfbea33c22833f5cb846" +#define SYZ_REVISION "be0af9fd447e9ac157423f3260f414d60066f653" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -115,7 +115,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "cea6c87ab1f9e36df1927913a619e71cd29abcbf" +#define SYZ_REVISION "c05720ceb16e651f6ae9addd1f5be83497d861e3" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -130,7 +130,7 @@ #if GOARCH_32_fork_shmem #define GOARCH "32_fork_shmem" -#define SYZ_REVISION "f3f80dea03f2b372f892da4a49e6af7f47106120" +#define SYZ_REVISION "18f983f4760ca5ac41eaf7c18bd9f487f6dde42b" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -140,7 +140,7 @@ #if GOARCH_32_shmem #define GOARCH "32_shmem" -#define SYZ_REVISION "9819b8a5a8ea14bf3a71d86bb2012bafd6ab25b6" +#define SYZ_REVISION "9d4e8ff9d9c38d5fe7cdc046adcde8be29782e6b" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 8192 @@ -150,7 +150,7 @@ #if GOARCH_64 #define GOARCH "64" -#define SYZ_REVISION "96964f599c9870f5d27e4d6054b0d16011652c81" +#define SYZ_REVISION "981444b6842c8896801fdf67dc75c454cad9e594" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 @@ -160,7 +160,7 @@ #if GOARCH_64_fork #define GOARCH "64_fork" -#define SYZ_REVISION "96f1f19d85a4d091cba7b036633c3b48ccfe4439" +#define SYZ_REVISION "1c9fe1f1a1f6f871fc5c088ca80174655322aca4" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 8192 @@ -175,7 +175,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "e9562f6b9973e9e9a9522fd8ec12b4e913f13b4c" +#define SYZ_REVISION "f2b48fb82a68b0cb24b2ab9638add66deb9542dd" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 diff --git a/sys/akaros/gen/amd64.go b/sys/akaros/gen/amd64.go index 252c1087..2ea6c588 100644 --- a/sys/akaros/gen/amd64.go +++ b/sys/akaros/gen/amd64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_akaros,syz_arch_amd64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/akaros" -var Target_amd64 = &Target{OS: "akaros", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64} +func init() { + RegisterTarget(&Target{OS: "akaros", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64}, InitTarget) +} var resources_amd64 = []*ResourceDesc{ {Name: "fd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd"}, Values: []uint64{18446744073709551615, 18446744073709551516}}, @@ -1536,4 +1540,4 @@ var consts_amd64 = []ConstValue{ {Name: "WUNTRACED", Value: 2}, } -const revision_amd64 = "36f0e5da1becfe451b2936a2b8b1739deb53c609" +const revision_amd64 = "0dd50d0ed02c0d84fb296a804d96c2f758c18e11" diff --git a/sys/akaros/gen/empty.go b/sys/akaros/gen/empty.go new file mode 100644 index 00000000..5baff07b --- /dev/null +++ b/sys/akaros/gen/empty.go @@ -0,0 +1,3 @@ +// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen diff --git a/sys/akaros/init.go b/sys/akaros/init.go index c3b9e521..91e1345a 100644 --- a/sys/akaros/init.go +++ b/sys/akaros/init.go @@ -5,19 +5,14 @@ package akaros import ( "github.com/google/syzkaller/prog" - "github.com/google/syzkaller/sys/akaros/gen" "github.com/google/syzkaller/sys/targets" ) -func init() { - prog.RegisterTarget(gen.Target_amd64, initTarget) -} - type arch struct { unix *targets.UnixSanitizer } -func initTarget(target *prog.Target) { +func InitTarget(target *prog.Target) { arch := &arch{ unix: targets.MakeUnixSanitizer(target), } diff --git a/sys/freebsd/gen/amd64.go b/sys/freebsd/gen/amd64.go index ebfce072..192053c7 100644 --- a/sys/freebsd/gen/amd64.go +++ b/sys/freebsd/gen/amd64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_freebsd,syz_arch_amd64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/freebsd" -var Target_amd64 = &Target{OS: "freebsd", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64} +func init() { + RegisterTarget(&Target{OS: "freebsd", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64}, InitTarget) +} var resources_amd64 = []*ResourceDesc{ {Name: "fd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd"}, Values: []uint64{18446744073709551615, 18446744073709551516}}, @@ -2439,4 +2443,4 @@ var consts_amd64 = []ConstValue{ {Name: "WUNTRACED", Value: 2}, } -const revision_amd64 = "fd7de83a3ebf8e454b041bbfe7513ed4a139d44d" +const revision_amd64 = "89eac40a68a14ffc0af9fc9b181147236b82d00b" diff --git a/sys/freebsd/gen/empty.go b/sys/freebsd/gen/empty.go new file mode 100644 index 00000000..5baff07b --- /dev/null +++ b/sys/freebsd/gen/empty.go @@ -0,0 +1,3 @@ +// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen diff --git a/sys/freebsd/init.go b/sys/freebsd/init.go index f75fb5d9..ab222471 100644 --- a/sys/freebsd/init.go +++ b/sys/freebsd/init.go @@ -5,15 +5,10 @@ package freebsd import ( "github.com/google/syzkaller/prog" - "github.com/google/syzkaller/sys/freebsd/gen" "github.com/google/syzkaller/sys/targets" ) -func init() { - prog.RegisterTarget(gen.Target_amd64, initTarget) -} - -func initTarget(target *prog.Target) { +func InitTarget(target *prog.Target) { arch := &arch{ unix: targets.MakeUnixSanitizer(target), } diff --git a/sys/fuchsia/gen/amd64.go b/sys/fuchsia/gen/amd64.go index 63d7a8ff..8e91dd58 100644 --- a/sys/fuchsia/gen/amd64.go +++ b/sys/fuchsia/gen/amd64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_fuchsia,syz_arch_amd64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/fuchsia" -var Target_amd64 = &Target{OS: "fuchsia", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64} +func init() { + RegisterTarget(&Target{OS: "fuchsia", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64}, InitTarget) +} var resources_amd64 = []*ResourceDesc{ {Name: "fd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd"}, Values: []uint64{18446744073709551615, 18446744073709551516}}, @@ -1317,4 +1321,4 @@ var consts_amd64 = []ConstValue{ {Name: "ZX_WAIT_ASYNC_REPEATING", Value: 1}, } -const revision_amd64 = "9540132f74bbe9bfb7e8f215844bdb3a88b9a665" +const revision_amd64 = "4cc56cb437136b65655dd3e0d9389be66131c7d1" diff --git a/sys/fuchsia/gen/arm64.go b/sys/fuchsia/gen/arm64.go index 326d5307..69bc1465 100644 --- a/sys/fuchsia/gen/arm64.go +++ b/sys/fuchsia/gen/arm64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_fuchsia,syz_arch_arm64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/fuchsia" -var Target_arm64 = &Target{OS: "fuchsia", Arch: "arm64", Revision: revision_arm64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_arm64, Resources: resources_arm64, Structs: structDescs_arm64, Consts: consts_arm64} +func init() { + RegisterTarget(&Target{OS: "fuchsia", Arch: "arm64", Revision: revision_arm64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_arm64, Resources: resources_arm64, Structs: structDescs_arm64, Consts: consts_arm64}, InitTarget) +} var resources_arm64 = []*ResourceDesc{ {Name: "fd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd"}, Values: []uint64{18446744073709551615, 18446744073709551516}}, @@ -1317,4 +1321,4 @@ var consts_arm64 = []ConstValue{ {Name: "ZX_WAIT_ASYNC_REPEATING", Value: 1}, } -const revision_arm64 = "ebb425942f2bbfd2db293e4a2a0a417f6aaafb1c" +const revision_arm64 = "42ba25aa193b27b48c8f8ade1c9186cb89c7ca61" diff --git a/sys/fuchsia/gen/empty.go b/sys/fuchsia/gen/empty.go new file mode 100644 index 00000000..5baff07b --- /dev/null +++ b/sys/fuchsia/gen/empty.go @@ -0,0 +1,3 @@ +// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen diff --git a/sys/fuchsia/init.go b/sys/fuchsia/init.go index 3f02e151..eefba395 100644 --- a/sys/fuchsia/init.go +++ b/sys/fuchsia/init.go @@ -5,15 +5,9 @@ package fuchsia import ( "github.com/google/syzkaller/prog" - "github.com/google/syzkaller/sys/fuchsia/gen" "github.com/google/syzkaller/sys/targets" ) -func init() { - prog.RegisterTarget(gen.Target_amd64, initTarget) - prog.RegisterTarget(gen.Target_arm64, initTarget) -} - -func initTarget(target *prog.Target) { +func InitTarget(target *prog.Target) { target.MakeMmap = targets.MakeSyzMmap(target) } diff --git a/sys/linux/gen/386.go b/sys/linux/gen/386.go index 97219381..82bb7aa8 100644 --- a/sys/linux/gen/386.go +++ b/sys/linux/gen/386.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_linux,syz_arch_386 syz_target,syz_os_linux,syz_arch_amd64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/linux" -var Target_386 = &Target{OS: "linux", Arch: "386", Revision: revision_386, PtrSize: 4, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_386, Resources: resources_386, Structs: structDescs_386, Consts: consts_386} +func init() { + RegisterTarget(&Target{OS: "linux", Arch: "386", Revision: revision_386, PtrSize: 4, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_386, Resources: resources_386, Structs: structDescs_386, Consts: consts_386}, InitTarget) +} var resources_386 = []*ResourceDesc{ {Name: "assoc_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"assoc_id"}, Values: []uint64{0}}, @@ -39509,4 +39513,4 @@ var consts_386 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_386 = "d16df4bd3b5d63c53207d8d48f0e7aa8375ae471" +const revision_386 = "c026c82f557e0fb27209b060f233071e8ba38eab" diff --git a/sys/linux/gen/amd64.go b/sys/linux/gen/amd64.go index 6fffdec6..c2747f26 100644 --- a/sys/linux/gen/amd64.go +++ b/sys/linux/gen/amd64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_linux,syz_arch_amd64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/linux" -var Target_amd64 = &Target{OS: "linux", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64} +func init() { + RegisterTarget(&Target{OS: "linux", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64}, InitTarget) +} var resources_amd64 = []*ResourceDesc{ {Name: "assoc_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"assoc_id"}, Values: []uint64{0}}, @@ -40196,4 +40200,4 @@ var consts_amd64 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_amd64 = "22bac64bd4f91440dd851726a290b9eb1f1ae092" +const revision_amd64 = "c06fc3bdc53ae8ee708128ddd51d14a679aa12f0" diff --git a/sys/linux/gen/arm.go b/sys/linux/gen/arm.go index 160738af..8192e252 100644 --- a/sys/linux/gen/arm.go +++ b/sys/linux/gen/arm.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_linux,syz_arch_arm syz_target,syz_os_linux,syz_arch_arm64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/linux" -var Target_arm = &Target{OS: "linux", Arch: "arm", Revision: revision_arm, PtrSize: 4, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_arm, Resources: resources_arm, Structs: structDescs_arm, Consts: consts_arm} +func init() { + RegisterTarget(&Target{OS: "linux", Arch: "arm", Revision: revision_arm, PtrSize: 4, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_arm, Resources: resources_arm, Structs: structDescs_arm, Consts: consts_arm}, InitTarget) +} var resources_arm = []*ResourceDesc{ {Name: "assoc_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"assoc_id"}, Values: []uint64{0}}, @@ -39367,4 +39371,4 @@ var consts_arm = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_arm = "c46361b24a9d8c4d25f99c6a74ed373b73b0cdd1" +const revision_arm = "b4f6cbe7c414a45bfaf3dcccf7f1040502de3980" diff --git a/sys/linux/gen/arm64.go b/sys/linux/gen/arm64.go index 8bf0d11d..d783efc8 100644 --- a/sys/linux/gen/arm64.go +++ b/sys/linux/gen/arm64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_linux,syz_arch_arm64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/linux" -var Target_arm64 = &Target{OS: "linux", Arch: "arm64", Revision: revision_arm64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_arm64, Resources: resources_arm64, Structs: structDescs_arm64, Consts: consts_arm64} +func init() { + RegisterTarget(&Target{OS: "linux", Arch: "arm64", Revision: revision_arm64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_arm64, Resources: resources_arm64, Structs: structDescs_arm64, Consts: consts_arm64}, InitTarget) +} var resources_arm64 = []*ResourceDesc{ {Name: "assoc_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"assoc_id"}, Values: []uint64{0}}, @@ -39561,4 +39565,4 @@ var consts_arm64 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_arm64 = "e1ce203bf0cb9e092e65fc6ca9cd1cde96e19316" +const revision_arm64 = "70ff2aa900dc3911170ab814adc6a362bb014580" diff --git a/sys/linux/gen/empty.go b/sys/linux/gen/empty.go new file mode 100644 index 00000000..5baff07b --- /dev/null +++ b/sys/linux/gen/empty.go @@ -0,0 +1,3 @@ +// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen diff --git a/sys/linux/gen/ppc64le.go b/sys/linux/gen/ppc64le.go index d8f08841..8ffa0b43 100644 --- a/sys/linux/gen/ppc64le.go +++ b/sys/linux/gen/ppc64le.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_linux,syz_arch_ppc64le package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/linux" -var Target_ppc64le = &Target{OS: "linux", Arch: "ppc64le", Revision: revision_ppc64le, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_ppc64le, Resources: resources_ppc64le, Structs: structDescs_ppc64le, Consts: consts_ppc64le} +func init() { + RegisterTarget(&Target{OS: "linux", Arch: "ppc64le", Revision: revision_ppc64le, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_ppc64le, Resources: resources_ppc64le, Structs: structDescs_ppc64le, Consts: consts_ppc64le}, InitTarget) +} var resources_ppc64le = []*ResourceDesc{ {Name: "assoc_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"assoc_id"}, Values: []uint64{0}}, @@ -36992,4 +36996,4 @@ var consts_ppc64le = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_ppc64le = "1ccba534d5c6adaffc5ebfbea33c22833f5cb846" +const revision_ppc64le = "be0af9fd447e9ac157423f3260f414d60066f653" diff --git a/sys/linux/init.go b/sys/linux/init.go index 8d7231fc..035ffee2 100644 --- a/sys/linux/init.go +++ b/sys/linux/init.go @@ -7,10 +7,10 @@ import ( "runtime" "github.com/google/syzkaller/prog" - "github.com/google/syzkaller/sys/linux/gen" "github.com/google/syzkaller/sys/targets" ) +/* func init() { prog.RegisterTarget(gen.Target_amd64, initTarget) prog.RegisterTarget(gen.Target_386, initTarget) @@ -18,8 +18,9 @@ func init() { prog.RegisterTarget(gen.Target_arm, initTarget) prog.RegisterTarget(gen.Target_ppc64le, initTarget) } +*/ -func initTarget(target *prog.Target) { +func InitTarget(target *prog.Target) { arch := &arch{ unix: targets.MakeUnixSanitizer(target), clockGettimeSyscall: target.SyscallMap["clock_gettime"], diff --git a/sys/netbsd/gen/amd64.go b/sys/netbsd/gen/amd64.go index be9bbb99..cd7cdcd0 100644 --- a/sys/netbsd/gen/amd64.go +++ b/sys/netbsd/gen/amd64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_netbsd,syz_arch_amd64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/netbsd" -var Target_amd64 = &Target{OS: "netbsd", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64} +func init() { + RegisterTarget(&Target{OS: "netbsd", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64}, InitTarget) +} var resources_amd64 = []*ResourceDesc{ {Name: "fd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd"}, Values: []uint64{18446744073709551615, 18446744073709551516}}, @@ -1673,4 +1677,4 @@ var consts_amd64 = []ConstValue{ {Name: "WUNTRACED", Value: 2}, } -const revision_amd64 = "cea6c87ab1f9e36df1927913a619e71cd29abcbf" +const revision_amd64 = "c05720ceb16e651f6ae9addd1f5be83497d861e3" diff --git a/sys/netbsd/gen/empty.go b/sys/netbsd/gen/empty.go new file mode 100644 index 00000000..5baff07b --- /dev/null +++ b/sys/netbsd/gen/empty.go @@ -0,0 +1,3 @@ +// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen diff --git a/sys/netbsd/init.go b/sys/netbsd/init.go index 908cbe65..7b6b1250 100644 --- a/sys/netbsd/init.go +++ b/sys/netbsd/init.go @@ -5,15 +5,10 @@ package netbsd import ( "github.com/google/syzkaller/prog" - "github.com/google/syzkaller/sys/netbsd/gen" "github.com/google/syzkaller/sys/targets" ) -func init() { - prog.RegisterTarget(gen.Target_amd64, initTarget) -} - -func initTarget(target *prog.Target) { +func InitTarget(target *prog.Target) { arch := &arch{ MAP_FIXED: target.ConstMap["MAP_FIXED"], } diff --git a/sys/sys.go b/sys/sys.go index e67093e1..51c04b44 100644 --- a/sys/sys.go +++ b/sys/sys.go @@ -5,13 +5,13 @@ package sys import ( // Import all targets, so that users only need to import sys. - _ "github.com/google/syzkaller/sys/akaros" - _ "github.com/google/syzkaller/sys/freebsd" - _ "github.com/google/syzkaller/sys/fuchsia" - _ "github.com/google/syzkaller/sys/linux" - _ "github.com/google/syzkaller/sys/netbsd" - _ "github.com/google/syzkaller/sys/test" - _ "github.com/google/syzkaller/sys/windows" + _ "github.com/google/syzkaller/sys/akaros/gen" + _ "github.com/google/syzkaller/sys/freebsd/gen" + _ "github.com/google/syzkaller/sys/fuchsia/gen" + _ "github.com/google/syzkaller/sys/linux/gen" + _ "github.com/google/syzkaller/sys/netbsd/gen" + _ "github.com/google/syzkaller/sys/test/gen" + _ "github.com/google/syzkaller/sys/windows/gen" ) // Emitted by Makefile. diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go index 65242910..467987c4 100644 --- a/sys/syz-sysgen/sysgen.go +++ b/sys/syz-sysgen/sysgen.go @@ -114,6 +114,7 @@ func main() { job.OK = true }() } + writeEmpty(OS) wg.Wait() var syscallArchs []ArchData @@ -160,15 +161,23 @@ func main() { } func generate(target *targets.Target, prg *compiler.Prog, consts map[string]uint64, out io.Writer) { - fmt.Fprintf(out, "// AUTOGENERATED FILE\n\n") + tag := fmt.Sprintf("syz_target,syz_os_%v,syz_arch_%v", target.OS, target.Arch) + if target.VMArch != "" { + tag += fmt.Sprintf(" syz_target,syz_os_%v,syz_arch_%v", target.OS, target.VMArch) + } + fmt.Fprintf(out, "// AUTOGENERATED FILE\n") + fmt.Fprintf(out, "// +build !syz_target %v\n\n", tag) fmt.Fprintf(out, "package gen\n\n") - fmt.Fprintf(out, "import . \"github.com/google/syzkaller/prog\"\n\n") + fmt.Fprintf(out, "import . \"github.com/google/syzkaller/prog\"\n") + fmt.Fprintf(out, "import . \"github.com/google/syzkaller/sys/%v\"\n\n", target.OS) - fmt.Fprintf(out, "var Target_%v = &Target{"+ + fmt.Fprintf(out, "func init() {\n") + fmt.Fprintf(out, "\tRegisterTarget(&Target{"+ "OS: %q, Arch: %q, Revision: revision_%v, PtrSize: %v, "+ "PageSize: %v, NumPages: %v, DataOffset: %v, Syscalls: syscalls_%v, "+ - "Resources: resources_%v, Structs: structDescs_%v, Consts: consts_%v}\n\n", - target.Arch, target.OS, target.Arch, target.Arch, target.PtrSize, + "Resources: resources_%v, Structs: structDescs_%v, Consts: consts_%v}, "+ + "InitTarget)\n}\n\n", + target.OS, target.Arch, target.Arch, target.PtrSize, target.PageSize, target.NumPages, target.DataOffset, target.Arch, target.Arch, target.Arch, target.Arch) @@ -196,6 +205,14 @@ func generate(target *targets.Target, prg *compiler.Prog, consts map[string]uint fmt.Fprintf(out, "\n\n") } +func writeEmpty(OS string) { + const data = `// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen +` + writeSource(filepath.Join("sys", OS, "gen", "empty.go"), []byte(data)) +} + func generateExecutorSyscalls(target *targets.Target, syscalls []*prog.Syscall, rev string) ArchData { data := ArchData{ Revision: rev, diff --git a/sys/targets/targets.go b/sys/targets/targets.go index 59220625..ea742f14 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -16,6 +16,7 @@ type Target struct { osCommon OS string Arch string + VMArch string // e.g. amd64 for 386, or arm64 for arm PtrSize uint64 PageSize uint64 NumPages uint64 @@ -123,6 +124,7 @@ var List = map[string]map[string]*Target{ }, }, "386": { + VMArch: "amd64", PtrSize: 4, PageSize: 4 << 10, CFlags: []string{"-m32"}, @@ -140,6 +142,7 @@ var List = map[string]map[string]*Target{ KernelHeaderArch: "arm64", }, "arm": { + VMArch: "arm64", PtrSize: 4, PageSize: 4 << 10, CFlags: []string{"-D__LINUX_ARM_ARCH__=6", "-m32", "-D__ARM_EABI__"}, diff --git a/sys/test/gen/32_fork_shmem.go b/sys/test/gen/32_fork_shmem.go index e9c5d42e..b61c234c 100644 --- a/sys/test/gen/32_fork_shmem.go +++ b/sys/test/gen/32_fork_shmem.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_test,syz_arch_32_fork_shmem package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/test" -var Target_32_fork_shmem = &Target{OS: "test", Arch: "32_fork_shmem", Revision: revision_32_fork_shmem, PtrSize: 4, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_32_fork_shmem, Resources: resources_32_fork_shmem, Structs: structDescs_32_fork_shmem, Consts: consts_32_fork_shmem} +func init() { + RegisterTarget(&Target{OS: "test", Arch: "32_fork_shmem", Revision: revision_32_fork_shmem, PtrSize: 4, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_32_fork_shmem, Resources: resources_32_fork_shmem, Structs: structDescs_32_fork_shmem, Consts: consts_32_fork_shmem}, InitTarget) +} var resources_32_fork_shmem = []*ResourceDesc(nil) @@ -24,4 +28,4 @@ var consts_32_fork_shmem = []ConstValue{ {Name: "ONLY_32BITS_CONST", Value: 1}, } -const revision_32_fork_shmem = "f3f80dea03f2b372f892da4a49e6af7f47106120" +const revision_32_fork_shmem = "18f983f4760ca5ac41eaf7c18bd9f487f6dde42b" diff --git a/sys/test/gen/32_shmem.go b/sys/test/gen/32_shmem.go index 39e2b940..02db6010 100644 --- a/sys/test/gen/32_shmem.go +++ b/sys/test/gen/32_shmem.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_test,syz_arch_32_shmem package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/test" -var Target_32_shmem = &Target{OS: "test", Arch: "32_shmem", Revision: revision_32_shmem, PtrSize: 4, PageSize: 8192, NumPages: 2048, DataOffset: 536870912, Syscalls: syscalls_32_shmem, Resources: resources_32_shmem, Structs: structDescs_32_shmem, Consts: consts_32_shmem} +func init() { + RegisterTarget(&Target{OS: "test", Arch: "32_shmem", Revision: revision_32_shmem, PtrSize: 4, PageSize: 8192, NumPages: 2048, DataOffset: 536870912, Syscalls: syscalls_32_shmem, Resources: resources_32_shmem, Structs: structDescs_32_shmem, Consts: consts_32_shmem}, InitTarget) +} var resources_32_shmem = []*ResourceDesc(nil) @@ -24,4 +28,4 @@ var consts_32_shmem = []ConstValue{ {Name: "ONLY_32BITS_CONST", Value: 1}, } -const revision_32_shmem = "9819b8a5a8ea14bf3a71d86bb2012bafd6ab25b6" +const revision_32_shmem = "9d4e8ff9d9c38d5fe7cdc046adcde8be29782e6b" diff --git a/sys/test/gen/64.go b/sys/test/gen/64.go index d1057117..b594499c 100644 --- a/sys/test/gen/64.go +++ b/sys/test/gen/64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_test,syz_arch_64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/test" -var Target_64 = &Target{OS: "test", Arch: "64", Revision: revision_64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_64, Resources: resources_64, Structs: structDescs_64, Consts: consts_64} +func init() { + RegisterTarget(&Target{OS: "test", Arch: "64", Revision: revision_64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_64, Resources: resources_64, Structs: structDescs_64, Consts: consts_64}, InitTarget) +} var resources_64 = []*ResourceDesc{ {Name: "anyres32", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"anyres32"}, Values: []uint64{0}}, @@ -875,4 +879,4 @@ var consts_64 = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_64 = "96964f599c9870f5d27e4d6054b0d16011652c81" +const revision_64 = "981444b6842c8896801fdf67dc75c454cad9e594" diff --git a/sys/test/gen/64_fork.go b/sys/test/gen/64_fork.go index 53371505..ca62e9ce 100644 --- a/sys/test/gen/64_fork.go +++ b/sys/test/gen/64_fork.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_test,syz_arch_64_fork package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/test" -var Target_64_fork = &Target{OS: "test", Arch: "64_fork", Revision: revision_64_fork, PtrSize: 8, PageSize: 8192, NumPages: 2048, DataOffset: 536870912, Syscalls: syscalls_64_fork, Resources: resources_64_fork, Structs: structDescs_64_fork, Consts: consts_64_fork} +func init() { + RegisterTarget(&Target{OS: "test", Arch: "64_fork", Revision: revision_64_fork, PtrSize: 8, PageSize: 8192, NumPages: 2048, DataOffset: 536870912, Syscalls: syscalls_64_fork, Resources: resources_64_fork, Structs: structDescs_64_fork, Consts: consts_64_fork}, InitTarget) +} var resources_64_fork = []*ResourceDesc(nil) @@ -23,4 +27,4 @@ var consts_64_fork = []ConstValue{ {Name: "IPPROTO_UDP", Value: 17}, } -const revision_64_fork = "96f1f19d85a4d091cba7b036633c3b48ccfe4439" +const revision_64_fork = "1c9fe1f1a1f6f871fc5c088ca80174655322aca4" diff --git a/sys/test/gen/empty.go b/sys/test/gen/empty.go new file mode 100644 index 00000000..5baff07b --- /dev/null +++ b/sys/test/gen/empty.go @@ -0,0 +1,3 @@ +// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen diff --git a/sys/test/init.go b/sys/test/init.go index 8e67fd75..815c99a9 100644 --- a/sys/test/init.go +++ b/sys/test/init.go @@ -6,16 +6,8 @@ package test import ( "github.com/google/syzkaller/prog" "github.com/google/syzkaller/sys/targets" - "github.com/google/syzkaller/sys/test/gen" ) -func init() { - prog.RegisterTarget(gen.Target_64, initTarget) - prog.RegisterTarget(gen.Target_64_fork, initTarget) - prog.RegisterTarget(gen.Target_32_shmem, initTarget) - prog.RegisterTarget(gen.Target_32_fork_shmem, initTarget) -} - -func initTarget(target *prog.Target) { +func InitTarget(target *prog.Target) { target.MakeMmap = targets.MakeSyzMmap(target) } diff --git a/sys/windows/gen/amd64.go b/sys/windows/gen/amd64.go index 47cf0eae..445fc3d0 100644 --- a/sys/windows/gen/amd64.go +++ b/sys/windows/gen/amd64.go @@ -1,10 +1,14 @@ // AUTOGENERATED FILE +// +build !syz_target syz_target,syz_os_windows,syz_arch_amd64 package gen import . "github.com/google/syzkaller/prog" +import . "github.com/google/syzkaller/sys/windows" -var Target_amd64 = &Target{OS: "windows", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64} +func init() { + RegisterTarget(&Target{OS: "windows", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, PageSize: 4096, NumPages: 4096, DataOffset: 536870912, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64}, InitTarget) +} var resources_amd64 = []*ResourceDesc{ {Name: "HANDLE", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", TypeSize: 8}}}, Kind: []string{"HANDLE"}, Values: []uint64{18446744073709551615}}, @@ -14611,4 +14615,4 @@ var consts_amd64 = []ConstValue{ {Name: "WRITE_OWNER", Value: 524288}, } -const revision_amd64 = "e9562f6b9973e9e9a9522fd8ec12b4e913f13b4c" +const revision_amd64 = "f2b48fb82a68b0cb24b2ab9638add66deb9542dd" diff --git a/sys/windows/gen/empty.go b/sys/windows/gen/empty.go new file mode 100644 index 00000000..5baff07b --- /dev/null +++ b/sys/windows/gen/empty.go @@ -0,0 +1,3 @@ +// AUTOGENERATED FILE +// This file is needed if OS is completely excluded by build tags. +package gen diff --git a/sys/windows/init.go b/sys/windows/init.go index f27f89cb..2c165cea 100644 --- a/sys/windows/init.go +++ b/sys/windows/init.go @@ -5,14 +5,9 @@ package windows import ( "github.com/google/syzkaller/prog" - "github.com/google/syzkaller/sys/windows/gen" ) -func init() { - prog.RegisterTarget(gen.Target_amd64, initTarget) -} - -func initTarget(target *prog.Target) { +func InitTarget(target *prog.Target) { arch := &arch{ virtualAllocSyscall: target.SyscallMap["VirtualAlloc"], MEM_COMMIT: target.ConstMap["MEM_COMMIT"],