From 0d0fbbe73f5b02bfeac0aedd0b6b9e8417ab0b0f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 26 Aug 2016 07:09:25 +0200 Subject: overhaul syscall description generation process This splits generation process into two phases: 1. Extract values of constants from linux kernel sources. 2. Generate Go code. Constant values are checked in. The advantage is that the second phase is now completely independent from linux source files, kernel version, presence of headers for particular drivers, etc. This allows to change what Go code we generate any time without access to all kernel headers (which in future won't be limited to only upstream headers). Constant extraction process does require proper kernel sources, but this can be done only once by the person who added the driver and has access to the required sources. Then the constant values are checked in for others to use. Consant extraction process is per-file/per-arch. That is, if I am adding a driver that is not present upstream and that works only on a single arch, I will check in constants only for that driver and for that arch. --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 46851d1ed..310c589c4 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ ifeq ($(NOSTATIC), 0) STATIC_FLAG=-static endif -.PHONY: all format clean manager fuzzer executor execprog mutate prog2c stress generate +.PHONY: all format clean manager fuzzer executor execprog mutate prog2c stress extract generate all: manager fuzzer executor @@ -39,14 +39,15 @@ stress: upgrade: go build -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade -SYSCALL_FILES=sys/sys.txt sys/socket.txt sys/tty.txt sys/perf.txt \ - sys/key.txt sys/bpf.txt sys/fuse.txt sys/dri.txt sys/kdbus.txt sys/sctp.txt \ - sys/kvm.txt sys/sndseq.txt sys/sndtimer.txt sys/sndcontrol.txt sys/input.txt \ - sys/netlink.txt sys/tun.txt sys/random.txt sys/kcm.txt sys/netrom.txt -generate: bin/syz-sysgen $(SYSCALL_FILES) - bin/syz-sysgen -linux=$(LINUX) -linuxbld=$(LINUXBLD) $(SYSCALL_FILES) +extract: bin/syz-extract + LINUX=$(LINUX) LINUXBLD=$(LINUXBLD) ./extract.sh +bin/syz-extract: ./syz-extract + go build -o $@ ./syz-extract + +generate: bin/syz-sysgen + bin/syz-sysgen bin/syz-sysgen: sysgen/*.go - go build -o $@ sysgen/*.go + go build -o $@ ./sysgen format: go fmt ./... -- cgit mrf-deployment