Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Continuous Fuzzing Integration to Fuzzit #3093

Merged
merged 1 commit into from
Aug 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist: xenial

services:
- docker
language: go
go:
- "1.12.x"
Expand All @@ -18,10 +19,16 @@ branches:
- master

env:
- TEST_TYPE=coverage
- TEST_TYPE=integration
- TEST_TYPE=core
- TEST_TYPE=plugin
global:
# This is FUZZIT_API_KEY
- secure: "IGpZAyt1e5BZ1C4LeJG+GrgFZzaBQkJ3BX/+MwWN85aJSDk5gwThS53OCr/7RFgBKBgP9xBv9i9hAv0PxVaRE0ETIzjc0rQzceJIWiYKfFYQyscFahKfSiGsWP32rMlU3K67tA7yITS+Z8mMyVH9Ndr1Fg9AmLL+WfATdrd6dP8hzsUpaghKlnJee9TycrfamDpISzecdOY9xzxcwRyphZxuCc/n236Nt7f7Ccz0zx/Qa5igX6mjKZpUyBpS2u02GmNJTfc3W5SbTRP5bSJ+ozSkZZyG3tTpYmeN87AQJ/oG7rUEzqGLt78i7jSYAXghJZT06H/fHFsOKssCj1m0hYiarnGoGzXScLDqp2fpkyzilsUT+W0VgXTy2Nq+88Sideiy6UwDwpqHr5ktyoYFeSVB/aCTJl5oxDxBqs9dfeJSEAy7/AYy8kJoIE/yPYsBnGw10CAED4Rf5mfDgstkZRBdAO0xLBihkPsgza2975DVf27YSjJZ4eKrnR+G/aNCKycLQvWD/5c2bcLCJqyz0uMLQC/4LspS9b5bAKurzqFRdrD5q78NDcbodHelc7zBlFrRwGFCUjXTbQoU6r+1FA8y2Z+n1bd7mIF1JBVHurYAygyYXOcry870hyucGojonvdgBvHp6txeYyPU14VvTNwkF2mddpBCvoSTSPZ5X64="
matrix:
- TEST_TYPE=coverage
- TEST_TYPE=integration
- TEST_TYPE=core
- TEST_TYPE=plugin
- TEST_TYPE=fuzzit FUZZIT_TYPE=local-regression
- TEST_TYPE=fuzzit FUZZIT_TYPE=fuzzing

# In the Travis VM-based build environment, IPv6 networking is not
# enabled by default. The sysctl operations below enable IPv6.
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ ifeq ($(TEST_TYPE),coverage)
fi; \
done
endif
ifeq ($(TEST_TYPE),fuzzit)
# skip fuzzing for PR
if [ "$(TRAVIS_PULL_REQUEST)" = "false" ] || [ "$(FUZZIT_TYPE)" = "local-regression" ] ; then \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comes out as if [ "3093" = "false" ] || [ "fuzzing" = "local-regression" ] ; then \ is that correct?

export GO111MODULE=off; \
go get -u github.com/dvyukov/go-fuzz/go-fuzz-build; \
go get -u -v .; \
cd ../../go-acme/lego; \
git checkout v2.5.0; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow, this is pretty horrible :/

I think it make sense to make this into Makefile.fuzz under some phony install target, so we can call make -f Makefile.fuzz install here. or $(MAKE) or somethign

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the workaround for the strange glitch with go-acme v3. How do you suggest working around that? (not sure I got it regarding the make install)

cd ../../coredns/coredns; \
LIBFUZZER=YES make -f Makefile.fuzz cache chaos file rewrite whoami corefile; \
wget -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.27/fuzzit_Linux_x86_64; \
chmod a+x fuzzit; \
./fuzzit create job --type $(FUZZIT_TYPE) coredns/cache ./cache; \
./fuzzit create job --type $(FUZZIT_TYPE) coredns/chaos ./chaos; \
./fuzzit create job --type $(FUZZIT_TYPE) coredns/file ./file; \
./fuzzit create job --type $(FUZZIT_TYPE) coredns/rewrite ./rewrite; \
./fuzzit create job --type $(FUZZIT_TYPE) coredns/whoami ./whoami; \
./fuzzit create job --type $(FUZZIT_TYPE) coredns/corefile ./corefile; \
fi;
endif

core/plugin/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg
GO111MODULE=on go generate coredns.go
Expand Down
13 changes: 13 additions & 0 deletions Makefile.fuzz
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#$ go get github.com/dvyukov/go-fuzz/go-fuzz-build

REPO:="github.com/coredns/coredns"
# set LIBFUZZER=YES to build libfuzzer compatible targets

FUZZ:=$(dir $(wildcard plugin/*/fuzz.go)) # plugin/cache/
PLUGINS:=$(foreach f,$(FUZZ),$(subst plugin, ,$(f:/=))) # > /cache
Expand All @@ -25,13 +26,25 @@ echo:

.PHONY: $(PLUGINS)
$(PLUGINS): echo
ifeq ($(LIBFUZZER), YES)
go-fuzz-build -tags fuzz -libfuzzer -o $(@).a ./plugin/$(@)
clang -fsanitize=fuzzer $(@).a -o $(@)
else
go-fuzz-build -tags fuzz $(REPO)/plugin/$(@)
go-fuzz -bin=./$(@)-fuzz.zip -workdir=fuzz/$(@)
endif


.PHONY: corefile
corefile:
ifeq ($(LIBFUZZER), YES)
go-fuzz-build -tags fuzz -libfuzzer -o $(@).a ./test
clang -fsanitize=fuzzer $(@).a -o $(@)
else
go-fuzz-build -tags fuzz $(REPO)/test
go-fuzz -bin=./test-fuzz.zip -workdir=fuzz/$(@)
endif



.PHONY: clean
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/coredns/coredns)
[![Build Status](https://img.shields.io/travis/coredns/coredns/master.svg?label=build)](https://travis-ci.org/coredns/coredns)
[![fuzzit](https://app.fuzzit.dev/badge?org_id=coredns&branch=master)](https://fuzzit.dev)
[![Code Coverage](https://img.shields.io/codecov/c/github/coredns/coredns/master.svg)](https://codecov.io/github/coredns/coredns?branch=master)
[![Docker Pulls](https://img.shields.io/docker/pulls/coredns/coredns.svg)](https://hub.docker.com/r/coredns/coredns)
[![Go Report Card](https://goreportcard.com/badge/github.com/coredns/coredns)](https://goreportcard.com/report/coredns/coredns)
Expand Down