Commit Graph

1432 Commits

Author SHA1 Message Date
Abhishek Arya d45336243a
Simplify changed files logic. (#5056) 2021-01-27 17:43:15 -08:00
Abhishek Arya aeb1be4b6e
Fix get_changed_files in infra/ci. (#5055)
Fixes https://github.com/google/oss-fuzz/issues/5022
2021-01-28 11:06:04 +11:00
Abhishek Arya 23e24a4bac
Get list of changed files from branch head, instead of master. (#5048)
* Get list of changed files from branch head, instead of master.

Fixes https://github.com/google/oss-fuzz/issues/5022

* Add debug with subprocess.call.

* Try again debugginig.

* Try again

* Fix works!
2021-01-27 14:28:27 -08:00
Abhishek Arya 89603f367a
Use afl++ in docs. (#5049) 2021-01-26 15:28:08 -08:00
jonathanmetzman d6ff0bfcdc
[CIFuzz] Seperate code for running fuzzers into own module: run_fuzzers.py (#5031)
TODO: Rename cifuzz.py to build_fuzzers.py
2021-01-26 08:32:41 -08:00
jonathanmetzman 665e489821
[afl++] Use AFL++ instead of AFL for fuzzing. (#5046) 2021-01-25 09:14:11 -08:00
jonathanmetzman 0ac841a1a4
Replace terms that are uninclusive. (#5045) 2021-01-25 08:41:34 -08:00
Oliver Chang 20b7246eae
Use more inclusive "blocklist" in code we control. (#5044) 2021-01-25 15:22:50 +11:00
Oliver Chang 8fcb4659e3
Add a missing requirement for CI. (#5036) 2021-01-22 12:45:11 +11:00
jonathanmetzman 648242fdb4
[pylint] Enable no-member check (#5034) 2021-01-21 16:21:17 -08:00
Oliver Chang 5b51cfb00f
Fix build functions tests when invoked from unittest.TestSuite. (#5027) 2021-01-21 07:43:42 -08:00
Abhishek Arya 0dc7c358d8
Remove unneeded ADD layers in base-builder. (#5028)
See https://github.com/google/oss-fuzz/issues/5012#issue-789981845
2021-01-20 22:18:03 -08:00
jonathanmetzman 492a4f2a1d
Run all tests when infra-tests is run from presubmit (#5026)
The previous approach of only running tests in changed directories is broken.
Tests can fail even when files outside of their directory are modified.
Also blocklist failing tests (see https://github.com/google/oss-fuzz/issues/5025) for why build tests are blocklisted.
2021-01-20 18:17:33 -08:00
Jonathan Metzman c5397ce3df fix nits 2021-01-20 18:00:33 -08:00
Jonathan Metzman e4195808a8 Explain why blacklisting base-sanitizer-libs-builder 2021-01-20 17:58:06 -08:00
jonathanmetzman f913f61129
[CIFuzz][coverage] Fix bug where unaffected fuzzers not removed + refactor
Previously region count was used instead of region covered.
This means that unaffected fuzzers only worked when a file wasn't linked 
into a fuzzer build (i.e. it was mostly broken).
Add tests to ensure this doesn't happen again.

Fixes: #5013

Also refactor.
1. Create a coverage module and move coverage functionality there.
2. Remove some overly-defensive programming. We probably aren't going to be given an invalid repo dir in coverage module.
3. Convert integration test to unittest.
4. Add helpers for: normalizing paths, getting coverage per file, determining if file is covered (which was done incorrectly before), and getting fuzzer stats dir url to make code easier to understand.
5. Add a class for getting coverage info.
6. Create an affected_fuzz_targets module and move functionality dealing with affected_fuzz_targets there.
7. Add is_fuzz_target_affected helper and log more.
8. Refer to fuzz targets as fuzz targets instead of fuzzers.
9. Move `url_join` to `utils`.
10. Move `GSUTIL_BASE_URL` to `utils`.
11. Add a util function for converting gs:// URLs into https:// urls.
12. Add a util function for removing prefixes (instead of using `.replace` which operates on the whole string not just the prefix).
13. Use more common style of mocking in unittests.
14. Delete unnecessary tests like '' when an invalid fuzzer is already tested.
15. Make constants capitalized in tests.
16. Better variable naming and consistency also reuse variables in tests.
17. Leave TODOs around code that looks suspicious.
18. Cleanup pylint directives.
19. Use single instead of double quotes.
2021-01-20 16:00:35 -08:00
Jonathan Metzman 0dbdeae5d2 fmt/lnt 2021-01-20 15:55:25 -08:00
Jonathan Metzman adebf8ece3 implement blocklist 2021-01-20 15:52:20 -08:00
Jonathan Metzman 9ce539763f fix 2021-01-20 15:18:18 -08:00
Jonathan Metzman 1193e419a3 Disable linting on dataflow_tracer 2021-01-20 13:40:50 -08:00
Jonathan Metzman 4184718c61 undo changes 2021-01-20 13:34:26 -08:00
Jonathan Metzman 05dc963d03 add license 2021-01-20 13:31:16 -08:00
Jonathan Metzman b3e30e5170 Fix lint function and add pylint directive 2021-01-20 13:29:47 -08:00
Jonathan Metzman a5ad91c7f5 Fix docstring 2021-01-20 13:25:56 -08:00
Jonathan Metzman 2b26c5446f Lint everything (and test everything too? 2021-01-20 13:25:56 -08:00
jonathanmetzman b998058ef3
Move entrypoints for CIFuzz to cifuzz folder. (#5020)
Move entrypoints for CIFuzz to cifuzz.
This allows us to reduce some complexity by getting rid of
an unnecessary copy in docker and a hack to making importing work.
2021-01-20 13:23:55 -08:00
Abhishek Arya 9d7f4f3100
Bump up llvm version to fix compile failure regression (old gcc) 2021-01-20 13:06:56 -08:00
Jonathan Metzman 5a48e9109a Merge branch 'master' of github.com:google/oss-fuzz into cifuzz-cov 2021-01-20 13:05:35 -08:00
Jonathan Metzman 63925e0e0d match behavior of removeprefix 2021-01-20 12:59:11 -08:00
Jonathan Metzman 64aeebf94f json.load -> json.loads 2021-01-20 12:53:47 -08:00
Jonathan Metzman 3a9668edd0 remove newline 2021-01-20 12:52:44 -08:00
Andrew Lytvynov 687187f07e
compile_go_fuzzer: pass build tags to `go list` (#5008)
`go list` will fail if all files in the fuzzed package use a build tag
restriction (like the common `gofuzz` tag).

Also, pass the `gofuzz` tag in the teleport build to plumb it through.
2021-01-20 11:44:15 -08:00
Jonathan Metzman d7049a82f2 fmt/lnt 2021-01-20 11:40:55 -08:00
Abhishek Arya 26dd144e52
Build modified projects as well when infra is modified. (#5019) 2021-01-20 11:37:37 -08:00
Jonathan Metzman cf0c702ee8 fix 2021-01-20 11:33:16 -08:00
Jonathan Metzman a5a1504477 add tests back 2021-01-20 11:24:25 -08:00
Jonathan Metzman aa815fc33b Fix unittests and make sure functionality stays same 2021-01-20 11:19:15 -08:00
Jonathan Metzman 0c26e0e2c8 fmt 2021-01-20 10:31:18 -08:00
Jonathan Metzman 2800e4eefa Add test 2021-01-20 10:31:03 -08:00
Jonathan Metzman 1647e41bef fmt 2021-01-20 10:18:39 -08:00
Jonathan Metzman 453253c427 fmt/lnt 2021-01-20 10:16:02 -08:00
Jonathan Metzman c136dd660b Fix bug where region count was used to determine if file was covered
instead of region coverage.
Add a test for this.
Add a remove_prefix util function.
2021-01-20 10:13:42 -08:00
Abhishek Arya c3087b7018
Install rust in base-builder with minimal profile. (#5015)
Remove docs and other unneeded stuff.
https://blog.rust-lang.org/2019/10/15/Rustup-1.20.0.html
2021-01-20 08:59:05 -08:00
Jonathan Metzman fe7b56af48 fmt/lnt 2021-01-20 08:48:29 -08:00
Jonathan Metzman 95f1089d7a fmt 2021-01-20 08:48:02 -08:00
Jonathan Metzman a00890cb73 more tests 2021-01-20 08:46:38 -08:00
Jonathan Metzman dafddab431 move more tests 2021-01-20 08:22:24 -08:00
Jonathan Metzman 8cda07fb9f move over test 2021-01-20 07:59:32 -08:00
Jonathan Metzman 913962ba54 Add coverage_test module and fmt/lnt 2021-01-20 07:38:27 -08:00
Jonathan Metzman 9935321c0d fmt/lnt 2021-01-20 07:26:02 -08:00
Jonathan Metzman ddb0add036 fuzzers->fuzz targets and finish affected_fuzz_targets module 2021-01-20 07:25:08 -08:00
Jonathan Metzman 0be9a235b8 merge 2021-01-20 07:02:39 -08:00
Jonathan Metzman 50109305cb New module for affected fuzz targets 2021-01-20 06:56:13 -08:00
Jonathan Metzman cb262dfbcb fmt/lnt 2021-01-20 06:51:30 -08:00
Jonathan Metzman 2ce7db4d47 Refactor coverage and move to own module 2021-01-20 06:47:48 -08:00
jonathanmetzman b9094ea003
[CIFuzz][NFC] Refactor affected fuzzers and improve logging (#5006)
1. Add a get_affected_fuzzers function.
2. Add comments explaining rationales.
3. Fix logging so that each affected fuzzer is only logged once.
4. Don't put each file affecting each fuzzer on its own line, this makes logs unreadable.
5. Improve logging wording.
2021-01-20 06:41:39 -08:00
Abhishek Arya 24d1b4e01e
Remove unneeded honggfuzz examples from base-builder. (#5011)
Save 177Mb.

root@eca2ea09a598:/src/honggfuzz/examples# du -h
16K	./glibc
8.0K	./libxml2
2.4M	./openssl/corpus_privkey
5.1M	./openssl/corpus_x509
18M	./openssl/corpus_client
27M	./openssl/corpus_server
52M	./openssl
16K	./externalfuzzers
12K	./libpng
25M	./bind/corpus
25M	./bind
29M	./linux_kernel_ip/corpus
30M	./linux_kernel_ip
16K	./libjpeg
20K	./terminal-emulators
33M	./apache-httpd/corpus_http1
39M	./apache-httpd/corpus_http2
72M	./apache-httpd
12K	./file
16K	./badcode/targets
8.0K	./badcode/inputfiles
36K	./badcode
177M	.
2021-01-20 05:51:08 -08:00
Stefan Bucur 54232af56f
Add the Bazel dependencies to the base builder image. (#4976)
* Add the Bazel dependencies to the base builder image.

* Removing Python 2 from the base image.

* Fix the Bazelisk fetching script.
2021-01-20 05:33:01 -08:00
Oliver Chang 6e41513dbb
build_specified_commit: Remove an exception. (#5009)
Return None rather than exceptioning out when a suitable base-builder
cannot be found to allow more graceful error handling.
2021-01-20 16:52:49 +11:00
Catena cyber 433ddc2337
Sets language env variable when running shell (#5007)
* Sets language env variable when running shell

* Always sets FUZZING_LANGUAGE
2021-01-19 14:20:39 -08:00
Abhishek Arya a252dc2d3a
Use python3 in checkout_build_install_llvm.sh, revert python move patches. (#4974)
* Revert "Update Dockerfile"

This reverts commit 5eae19fb57.

* Revert "Move python 3 install to base-clang, needed for clang build. (#4967)"

This reverts commit 018314eefa.

* Use python3 in checkout_build_install_llvm.sh
2021-01-14 15:11:59 -08:00
Abhishek Arya 5eae19fb57
Update Dockerfile 2021-01-14 14:41:34 -08:00
Abhishek Arya 018314eefa
Move python 3 install to base-clang, needed for clang build. (#4967)
```
-- Looking for os_signpost_interval_begin - not found
CMake Error at /usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find Python3 (missing: Python3_EXECUTABLE Interpreter)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.19/Modules/FindPython/Support.cmake:3148 (find_package_handle_standard_args)
  /usr/local/share/cmake-3.19/Modules/FindPython3.cmake:398 (include)
  CMakeLists.txt:711 (find_package)

-- Configuring incomplete, errors occurred!
See also "/work/llvm-stage1/CMakeFiles/CMakeOutput.log".
See also "/work/llvm-stage1/CMakeFiles/CMakeError.log".
The command '/bin/sh -c /root/checkout_build_install_llvm.sh' returned a non-zero code: 1
```
2021-01-14 11:15:13 -08:00
Oliver Chang 0612668e8c
build_specified_commit: Return failure rather than raise exception when rebuild fails. (#4964) 2021-01-14 15:49:15 +11:00
Oliver Chang 0a7813d978
repo_manager: Allow unshallow to return non-zero. (#4963)
Unshallow can fail in a submodule, even if the unshallow succeeded for
the main repo.
2021-01-14 14:16:20 +11:00
Robert Löhning b8262ba955
Upgrade cmake to latest release (3.19.2) (#4930) 2021-01-07 07:42:38 -08:00
Catena cyber 60b3a3d5dd
Golang coverage improvements (#4920)
* Uses idiomatic way for golang package in coverage

* Extends go coverage report to the whole repository
2021-01-07 07:41:26 -08:00
Abhishek Arya 01ebe8e15f
Don't run test_all on llvm-symbolizer for black box fuzzer projects. (#4873) 2020-12-19 08:20:29 -08:00
jonathanmetzman e01883df1e
[CIFuzz] Fix typo in disabled test (#4871) 2020-12-18 19:29:52 -08:00
jonathanmetzman d8546a88b3
[infra] Mark more tests as integration (#4869) 2020-12-18 10:44:12 -08:00
jonathanmetzman c2165341d2
[presubmit] Support option to run on all files (#4870) 2020-12-18 10:43:22 -08:00
jonathanmetzman 2a1194c939
Improve CIFuzz tests (#4868)
1. Fix problem where permissions were being changed to root by non-root test (test was doing this by invoking test_all.py within docker).
2. Mark tests as integration tests so that cifuzz_test.py can be run in a reasonable amount of time.
3. Prevent some unittests from polluting source repo.
4. Add .venv to .gitignore
5. Rename test_test_all.py to the correctly formatted name "test_all_test.py"
2020-12-18 10:37:56 -08:00
Abhishek Arya f359fd010f Allow none in engine for infra/helper.py 2020-12-17 19:47:03 -08:00
Abhishek Arya 6718fb8bd6
Fix broken blackbox fuzzer projects. (#4865)
* Fix broken blackbox fuzzer projects.

Regression from
https://github.com/google/oss-fuzz/pull/4769/files

* Fix indent.
2020-12-17 16:29:11 -08:00
Abhishek Arya e06d7f0412
Fix incorrect calculation with gcs path for backup corpus. (#4863)
Fixes https://github.com/google/oss-fuzz/issues/4857
2020-12-17 10:57:32 -08:00
Abhishek Arya fba71c70ca
Copy llvm-symbolizer in $OUT, needed for python targets. (#4832) 2020-12-12 18:58:59 -08:00
Abhishek Arya 64b223a8e9
Fix pillow with new atheris changes. (#4826)
* Fix pillow with new atheris changes.

* Fix pillow in ubsan.
2020-12-11 14:35:43 -08:00
Abhishek Arya 0dd7aaca32
Fix atheris integration. (#4824) 2020-12-11 11:38:43 -08:00
jonathanmetzman 96b8aad56a
[CIFuzz] Fix MSAN (#4812)
Use msan libs when building fuzzers with MSAN.
2020-12-10 06:24:48 -08:00
Oliver Chang 84faf55729
Populate a bunch of main_repo values. (#4815)
Also enforce this for future integrations.
2020-12-10 09:49:27 +11:00
Jonathan Metzman ed633664ec fix 2020-12-09 11:47:18 -08:00
jonathanmetzman 265ae85302
[CIFuzz] Fix issue where copied repo is named incorrectly. (#4813)
[CIFuzz] Fix issue where copied repo is named incorrectly.

Make sure the cloned repo is copied correctly to the docker container
E.g. https://github.com/OpenSC/OpenSC should be coiped to $SRC/opensc.

Fixes https://github.com/google/oss-fuzz/issues/4810

Add unittest
2020-12-09 09:55:54 -08:00
jonathanmetzman 301ed831be
Use print for printing stacktrace instead of using log. (#4799)
Use print for printing stacktrace instead of using log.
This makes stacktrace more legible.
Fixes https://github.com/google/oss-fuzz/issues/4649
2020-12-08 09:05:48 -08:00
Oliver Chang a23d9bc6fb
Rename BaseRepoManager -> RepoManager. (#4800)
This was renamed in b0b99d5ccd
2020-12-08 10:01:38 +11:00
Jonathan Metzman e193d59148 Revert "Use print for printing stacktrace instead of using log."
This reverts commit ecffb3f662.

Commit should not have been committed to master.
2020-12-07 14:45:47 -08:00
Jonathan Metzman ecffb3f662 Use print for printing stacktrace instead of using log.
This makes stacktrace more legible.

Fixes https://github.com/google/oss-fuzz/issues/4649
2020-12-07 14:42:49 -08:00
jonathanmetzman b0b99d5ccd
Cifuzz external build (#4656)
* Support building fuzzers for projects outside of OSS-Fuzz
* Use retry wrapper
* Fix some tests.
2020-12-07 10:50:11 -08:00
jonathanmetzman a24cebec02
Make test_all.py return nonzero when there are no fuzzers. (#4796)
Make test_all.py return nonzero when there are no fuzzers.

This matches the previous behavior.
Fixes https://github.com/google/oss-fuzz/issues/4795
2020-12-07 10:16:31 -08:00
jonathanmetzman aecdd9c4e0
Fix helper.py (#4793)
Recently some python3-only code was added. Make code compatible with
Python2. Fixes https://github.com/google/oss-fuzz/issues/4792
2020-12-07 08:05:03 -08:00
Abhishek Arya b9e6a5fc74
Revert msan patch (#4788)
* Revert "Fix msan build breakage. (#4787)"

This reverts commit 8f4d1b237d.

* Revert "Clean up MemorySanitizer library warnings (#4694)"

This reverts commit 6fc050ec9e.
2020-12-04 19:44:46 -08:00
Abhishek Arya 8f4d1b237d
Fix msan build breakage. (#4787)
Regression from
https://github.com/google/oss-fuzz/pull/4694
2020-12-04 19:21:35 -08:00
Abhishek Arya 588336d665
s/test_all/test_all.py for google cloud build. (#4783)
Fixes https://github.com/google/oss-fuzz/issues/4781
2020-12-04 08:26:34 -08:00
Oliver Chang 8bd567697d
build_specified_commit: fallback to oldest integration commit. (#4779)
When we fail a build, we attempt to identify the first OSS-Fuzz commit
prior to the upstream commit date.

If this does not exist, we bailed out. This commit changes it such that
we at least try on the oldest integration commit.
2020-12-04 17:51:31 +11:00
jonathanmetzman b1c77d1fa2
[test_all] Fix issue where CIFuzz may use an empty string for ALLOWED_BROKEN_TARGETS_PERCENTAGE (#4778) 2020-12-03 13:30:03 -08:00
jonathanmetzman c8d2319aa8
[test_all] Rewrite in Python (#4769)
Rewrite test_all in python.
Bash is quite annoying to write and test.
One issue with bash is it is even worse than Python for parallelism (which may be causing #4707).
Rewrite test_all in python and optimize base-runner/Dockerfile for fast development.
Also, combine some docker layers.
2020-12-03 12:52:34 -08:00
David Cook 6fc050ec9e
Clean up MemorySanitizer library warnings (#4694)
* Update infra/base-images/all.sh

Add build of base-sanitizer-libs-builder and msan-libs-builder to this
shell script.

* msan: Don't warn on un-instrumented standard libs

These libraries do not need to be built with instrumentation, because
MemorySanitizer includes interceptors for them.

* Fix indentation

* Add missing docstrings

* Fix unused variable

* Fix invalid names

* Install python-apt on CI

* Revert "Install python-apt on CI"

This reverts commit d3da49cf90.

* Install and use python-apt in system directory

* Revert "Install and use python-apt in system directory"

This reverts commit e0ede101fb.

* Build python-apt from source

* Check out correct version of python-apt

* Fix octal literals

* More indentation fixes

* Add more missing docstrings

* Change variable names of opened files

* Remove unused import

* Ignore lints about package.Package API

* Fix or ignore remaining invalid names

* Fix apparent typo in compiler_wrapper_test.py

-z should precede a keyword, not a long option

* Fix use of xrange

* Style fixes, compiler_wrapper

* Fix apparent error in compiler_wrapper_test.py

Similar to the previous error, the test case would pass "-z
--no-undefined" to the linker. "-z" only has an effect when it is
followed by a keyword, otherwise ld ignores it and prints a warning
message. In this test case, "-z" and "--no-undefined" were passed in two
separate "-Wl," compiler arguments, but they reflect a common issue.

* Add missing license header

* Rename more functions

* Better name for global variable

* Rename methods of Package

* Rename functions in msan_builder.py

* Fix invalid variable names

* Fix useless-object-inheritance

* pylint: Fixes for Package and its subclasses

* Remove unused imports

* Indentation fixes

* Fix too-may-locals error in msan_build.py

* Add missing docstrings
2020-12-03 07:52:36 +11:00
Jakub Jelen f533434871
[helper] Make sure directories are created before they are passed to container engine (podman) (#4763) 2020-12-01 09:12:30 -08:00
Abhishek Arya b4dd4b91de
Enable UBSan for python projects. (#4757)
* Enable UBSan for python projects.

* Update docs.
2020-11-30 13:26:33 -08:00
jonathanmetzman c63ba21574
[helper] Change generate command to use "LLC" instead of "Inc." (#4753)
This reflects the current style:
https://opensource.google/docs/copyright/#the-year
2020-11-30 11:02:31 -08:00
Oliver Chang cf0e9f0b44
Increase threshold for msan calls check in bad_build_check. (#4747)
Honggfuzz calls msan now:
e067013753

Should address #4743.
2020-11-30 18:10:36 +11:00
Abhishek Arya 84616ae4ce
Fix "exec format error" due to incorrect shebang in python target. (#4746) 2020-11-29 18:49:47 -08:00
Abhishek Arya cd9477213a
Fix ujson project and infra/ for python atheris. (#4706) 2020-11-24 11:36:42 -08:00
jonathanmetzman ec5491853d
[infra] Add retry decorator and use it. (#4702) 2020-11-24 09:51:56 -08:00
jonathanmetzman a43c85a54c [CIFuzz] Set CIFUZZ env var when building/checking/running CIFuzz fuzzers. (#4699)
Fixes https://github.com/google/oss-fuzz/issues/4604
2020-11-24 08:10:05 -08:00
jonathanmetzman 4b9b56783d
[cifuzz] disable failing test (#4700) 2020-11-24 08:03:59 -08:00
Catena cyber 181c036c5b
Self-hosts golang scripts for golang coverage (#4698)
* Self-hosts golang scripts for golang coverage

* fixup remove useless readmes

* Update Dockerfile

Co-authored-by: Abhishek Arya <inferno@chromium.org>
2020-11-24 07:37:56 -08:00
jonathanmetzman a85de2b3a7
Make CIFuzz more debuggable by allowing one to run off a branch (#4666)
Make it possible to run CIFuzz from a non-master branch
2020-11-24 06:32:23 -08:00
Catena cyber 831e4cd96a
Golang coverage reports for projects with modules (#4690)
such as coredns
cloning into GOPATH
2020-11-24 05:08:57 -08:00
Catena cyber 91a6a12dbe
Go json coverage (#4689)
* Good fuzz target for golang coverage with modules

* Place target in right directory for go-json-iterator

So that coverage gets access to the right package
2020-11-22 11:05:32 -08:00
Abhishek Arya 57ebc0c76a
Workaround for unbound var GO111MODULE 2020-11-21 09:09:01 -08:00
Catena cyber 2db56c4174
Golang project uses compile_go_fuzzer script (#4685)
* Golang project uses compile_go_fuzzer script

* Kubernetes project uses compile_go_fuzzer script

* Adds golang to ci covergae builds

* fixup

* Golang coverage with go modules

cf coredns project
2020-11-21 07:11:43 -08:00
Max Moroz e534f4fecc
[infra] Save logs when generating code coverage for Go projects (#2817, #2714). (#4683) 2020-11-20 14:02:36 -08:00
Abhishek Arya e7921e7795
Python fuzzing fixes - disable leak checking, remove flags in atheris. (#4681)
* Python fuzzing fixes - disable leak checking, remove flags in atheris.

* Fix flags printing.

* Dont export, use directly.

* Try unset.

* Unset flags when python was built.
2020-11-20 11:10:51 -08:00
Catena cyber c031d50ec9
[infra] Golang coverage summary for each fuzz target (#2817, #2714). (#4671)
* Golang coverage summary for each fuzz target

* Document usage of compile_go_fuzzer

* update the documentation change

Co-authored-by: Max Moroz <mmoroz@chromium.org>
2020-11-20 10:55:33 -08:00
jonathanmetzman ee7031c4a5
Fix permission denied errors on CI in unittests (#4664)
Also remove usrstcp from the repos we do tests since they no longer work with usrstcp (repo history seems to have been rewritten).
2020-11-20 10:39:19 -08:00
jonathanmetzman a28d03be6e
Build base-images before building projects in CI (#4679)
This will help us catch breaking changes to the base-images.
Unfortunately caching seems to fail here when I expect it to help. 
For example, base-builder doesn't build from cache when I do it locally.
This means that every other image I try to build doesn't use the cache. 
That means that base-clang would take forever to rebuild. 
So to compromise, I don't rebuild base-clang here.
This means that this PR won't catch breaking changes to base-image or base-clang that break in base-builder.
But it will catch breaking changes to base-image that break in base-runner and it will catch breaking changes to base-runner and base-builder.
2020-11-20 10:09:17 -08:00
jonathanmetzman 486c1c3e9d
[CI] Build a canary project on infra/ changes. (#4675)
[CI] Build a canary project on infra/ changes.

Build a specific project, sckms, that does msan, ubsan, asan, i386
builds quickly, when infra/ code is changed. This can let us know
when infra/ changes break proper functioning of OSS-Fuzz.
For this to work more thoroughly we also need to rebuild images.
2020-11-20 08:40:47 -08:00
jonathanmetzman 640a9c2bcf
Fix test_all breakage (#4673)
Specify fuzzing language.
Intended to fix https://github.com/google/oss-fuzz/issues/4672
2020-11-20 07:24:06 -08:00
Abhishek Arya 5e3f47dba6
Fix ujson python fuzzing. (#4667)
* Fix ujson python fuzzing.

* Fix.

* Improve integration.

* Remove preload, stick with wrapper with /bin/sh.

* Update build.sh
2020-11-19 22:41:12 -08:00
Oliver Chang 5da57c9128
Fix requirements.txt for GCB functions. (#4670) 2020-11-20 12:07:09 +11:00
Max Moroz b97f6e296a
[infra] Allow coverage for Go project on GCB (#2817, #2714). (#4668) 2020-11-19 16:07:35 -08:00
Catena cyber 217175212b
[infra] Use generic compile_go_fuzzer for golang projects (#4659)
* Use generic compile_go_fuzzer for golang projects

* fix the copyright in the new script

Co-authored-by: Max Moroz <mmoroz@chromium.org>
2020-11-19 14:18:25 -08:00
Abhishek Arya 772d0efef5
Add missing ldconfig for shared lib path of python libs (#4663) 2020-11-19 10:43:21 -08:00
Abhishek Arya 38b7c5e162
Enable shared build for python deps, needed for pyinstaller (#4661) 2020-11-19 09:54:21 -08:00
mbarbella-chromium e36bb8f7c6
Initial support for ujson (as a Python fuzzing sample). (#4657)
* Initial support for ujson (as a Python fuzzing sample).

* Add python to supported languages.

* Fix TODO.

* Update presubmit to ignore python in projects.

* Format

* Remove explicit addition of -fsanitize=fuzzer-no-link

* Only fuzz using libFuzzer.

Co-authored-by: Martin Barbella <mbarbella@google.com>
2020-11-19 07:40:10 -08:00
Catena cyber 07ea81ba3e
[infra] Add code coverage report generation for Go projects (#3142)
* Golang coverage report

* Enables golang coverage report for gonids and go-dns

* Generates summary for golang coverage reports

* Performance profile for golang projects
2020-11-19 00:14:30 -08:00
Abhishek Arya 43f768df01
Add pyinstaller to experiment with python fuzzer packaging (#4658) 2020-11-18 16:42:26 -08:00
Max Moroz 3f782ade9a
[infra] Unfreeze LLVM updating that was stopped due to #4608. (#4655) 2020-11-18 15:00:19 -08:00
jonathanmetzman f3c0204d10
[NFC][CIFuzz] Fix coding issues. (#4550)
Fix some coding and style issues.
1. Treat "testcase" as one word. This is consistent with ClusterFuzz.
2. Treat "stacktrace" as one word. This is consistent with ClusterFuzz.
3. Fix spelling of comments and words in code.
4. Use descriptive style docstrings and remove unnecessary clutter
(e.g. "Test the functionality of foo_function function in bar module"
becomes "Tests foo_function."
5. Use JSON for a list needed in testing instead of pickle.
2020-11-17 13:39:57 -08:00
Abhishek Arya 93214a5535
Move atheris install base builder where python3 is installed. (#4650) 2020-11-17 12:23:29 -08:00
Abhishek Arya a3356cbb7c
Fix CLANG_BIN path for atheris 2020-11-17 08:39:30 -08:00
mbarbella-chromium e3487bc8e2
Install Atheris in base-clang. (#4647)
Co-authored-by: Martin Barbella <mbarbella@google.com>
2020-11-16 16:34:05 -08:00
Oliver Chang 8b10d4b705
Fix incorrect OSS-Fuzz build project deletion. (#4623) 2020-11-10 11:10:43 +11:00
Abhishek Arya 400e898705
Freeze llvm version due to #4608 2020-11-06 08:12:02 -08:00
Abhishek Arya c960b50e0f
Revert "Use symlink instead of broken -path-equivalence (#4610)" (#4611)
This reverts commit 65cd35731f.
2020-11-06 08:09:24 -08:00
Abhishek Arya 65cd35731f
Use symlink instead of broken -path-equivalence (#4610) 2020-11-05 23:18:21 -08:00
jonathanmetzman 8daba1a1a1
[CIFuzz] Don't assume fuzzer output is ASCII (#4537)
[CIFuzz] Don't assume fuzzer output is ascii

This is wrong because the output can be arbitrary. Instead change
code that deals with the output to deal with bytes. The testcase,
which is derived from the output can be decoded as UTF-8 since it
will be a unix path.
2020-10-19 10:10:22 -07:00
mbarbella-chromium 0deeef6e31
Revert "Python SyntaxError: leading zeros in decimal integer literals (#4523)" (#4525)
This reverts commit fa0c1b4c6d.
2020-10-12 08:52:37 -07:00
mbarbella-chromium 2b2f5c504f
Revert "nettle.py: SyntaxError leading zeros in decimal integer literals (#4522)" (#4524)
This reverts commit 6fe03eafb5.
2020-10-12 08:50:38 -07:00
Christian Clauss 6fe03eafb5
nettle.py: SyntaxError leading zeros in decimal integer literals (#4522)
* SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

* Placate pylint
2020-10-12 08:44:44 -07:00
Christian Clauss fa0c1b4c6d
Python SyntaxError: leading zeros in decimal integer literals (#4523)
Python SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
2020-10-12 08:41:52 -07:00
jonathanmetzman 449ef28a87
[CIFuzz] Retry HTTP requests on certain errors (#4516)
Skia has seen some unhandled connection reset errors.
When we see these errors when downloading old OSS-Fuzz build, retry downloading it, since the error is likely transient.
2020-10-12 07:50:38 -07:00
Catena cyber f9f99a9604
Enables MSAN for Suricata (#4455)
* Enables MSAN for Suricata

* Move rustup std lib download to base-builder
2020-09-30 07:04:22 -07:00
Oliver Chang 97136f87e4
Set main repo for clamav. (#4466) 2020-09-23 10:41:20 +10:00
Oliver Chang 34751cf016
bisector: early exit when old_commit == new_commit. (#4458)
But do this after computing repo_url as that's still useful information.
2020-09-18 14:10:10 +10:00
Oliver Chang 460a10836b
Update Dockerfile
Fixes #4400
2020-09-09 11:53:44 +10:00
Max Moroz e2cd61f00a
[infra] Re-enable clang/LLVM auto-updating (#4348). (#4426) 2020-09-08 17:56:33 -07:00
Oliver Chang a8263735f5
Add a blackbox field to project.yaml (#4405)
This is needed for CF to determine whether or not to allocate the
project on a higher end bot to run the blackbox fuzzer.

Previously this was keyed on the "none" entry under fuzzing_engines,
which wasn't very descriptive. This change also lets us do both blackbox
and greybox fuzzing in the same project, which will be done for quickjs.
2020-09-03 11:08:09 +10:00
jonathanmetzman db8467bf30
[CI] Don't do coverage builds for engineless fuzzers. (#4374)
Coverage builds need to be special cased since they aren't specified
in sanitizers. Instead they are done for all C/C++ projects that
use libFuzzer.

Move all of this special casing to `should_build_coverage` and call that from
`should_build` so we have one place where we decide this.
Add tests as well.

Fixes: https://github.com/google/oss-fuzz/issues/4371
2020-08-26 11:59:56 -07:00
jonathanmetzman 13f7ba0f63
[presubmit] Allow 'none' as a fuzzing engine (#4370)
'none' is used by projects like spidermonkey that use the JS fuzzer.
2020-08-25 16:31:29 -07:00
Max Moroz eabcccf848
[infra] Fix reproduce command invoking run_fuzzer for a single testcase (#4338). (#4367)
* [infra] Fix reproduce command invoking run_fuzzer for a single testcase (#4338).

* review feedback

* do not introduce new variable, rely on SKIP_SEED_CORPUS only
2020-08-25 11:38:50 -07:00
Abhishek Arya a02946e8f4
Revert chromium clang roll to fix mismatched coverage data error (#4353)
Temporarily fixes #4348
2020-08-21 22:18:24 -07:00
Abhishek Arya 4628ee31a9
Revert "Revert "Compile + install LLVMgold.so so -flto works (#4332)" (#4351)" (#4352)
This reverts commit 7f8f5e0182.
2020-08-21 22:12:46 -07:00
Abhishek Arya 7f8f5e0182
Revert "Compile + install LLVMgold.so so -flto works (#4332)" (#4351)
This reverts commit d1ddd25937.
2020-08-21 16:52:23 -07:00
van Hauser d1ddd25937
Compile + install LLVMgold.so so -flto works (#4332) 2020-08-18 09:55:08 -07:00
Max Moroz d250f4ffbb
[infra] Upgrade reproduce command to re-use run_fuzzer functionality. (#4324)
* [infra] Upgrade reproduce command to re-use run_fuzzer functionality.

* fix a typo

* add missing quotes
2020-08-17 11:34:21 -07:00
Max Moroz a986d76ef4
[infra] Use 16 threads when building LLVM (#4270). (#4315)
* [infra] Use 16 threads when building LLVM (#4270).

* update the comment
2020-08-13 12:58:02 -07:00
Max Moroz cec66e9662
[infra] base-clang: limit the number of build threads to 4 (#4270). (#4311) 2020-08-12 16:44:29 -07:00
Max Moroz 8712207990
[infra] Make bad_build_check to use run_fuzzer when testing startup crash. (#4301)
* [infra] Make bad_build_check to use run_fuzzer when testing startup crash.

* use SKIP_SEED_CORPUS=1
2020-08-12 09:57:15 -07:00
Max Moroz e4d3fb0f8c
[infra][docs] Be more explicit about code coverage being supported for C/C++ only (#4284). (#4303)
* [infra][docs] Be more explicit about code coverage being supported for C/C++ only (#4284).

* fix typos and pass env variable
2020-08-12 09:32:05 -07:00
Oliver Chang 0987ddf994
even more fixes. (#4297) 2020-08-11 18:27:18 +10:00
Oliver Chang ade417ba20
Fix typo in project_sync.py (#4296)
* Fix typo in project_sync.py

* line length

* format
2020-08-11 16:25:08 +10:00
Abhishek Arya 103aca2e27
Add |builds_per_day| to supported section in project.yaml. (#4291) 2020-08-10 08:08:25 -07:00
Max Moroz 941ada694b
[infra] Add support for custom sanitizer options in run_fuzzer. (#4274)
* [infra] Add support for custom sanitizer options in run_fuzzer.

* address review feedback

* fix presubmit warnings
2020-08-07 12:48:23 -07:00
Abhishek Arya 751aa78373
Fix LLVM_REVISION parse regex (#4275)
Fix parse regex as per format change in
e6863f8783%5E%21/#F1
2020-08-06 20:12:58 -07:00
jonathanmetzman 571dbfb39f
Reland 55d9a81. (#4269)
The issue with 55d9a81 that caused it to be reverted by 3370f8f
was probably due to the build trigger on GCB being stale. I've
updated it so this commit should stick.
2020-08-06 14:33:08 -07:00
Evgeny Vereshchagin 3370f8f7e5
Revert "[CIFuzz] Allow supplying a manual source checkout (#4250)" (#4263)
This reverts commit 55d9a81cd7.

Closes https://github.com/google/oss-fuzz/issues/4262
2020-08-06 06:11:59 -07:00
Oliver Chang 65a83e2125
Split up builds status function. (#4261)
- Split into separate invocations for fuzzing, coverage, and badges.
- Also use threads to speed things up.
2020-08-06 13:59:08 +10:00
jonathanmetzman 55d9a81cd7
[CIFuzz] Allow supplying a manual source checkout (#4250)
Make CIFuzz building accept an env var `MANUAL_SRC_PATH` that points to a manually prepared checkout of the project-under-tests's source code. This allows projects like Skia which are not on OSS-Fuzz and/or need to make changes to the repo after checking out the right commit to use CIFuzz.
Note that for now we aren't supporting this in GitHub, so projects that need to modify the source after checkout can't use it until
we do support it.

Also, use the local copy of OSS-Fuzz when building cifuzz-base instead of cloning it from GitHub. This makes local debugging/development much easier since it allows one to use CIFuzz with local changes.
2020-08-05 18:45:12 -07:00
Oliver Chang 909db51a15
More build infra cleanup. (#4252)
- Deleted unused code.
- Consolidate some modules.
2020-08-06 09:36:47 +10:00
Oliver Chang 3f1d43115f
Clean up build infra. (#4251)
- Remove gcb folder. Move the files that we still need into the
  build/functions dir.
- Remove badge_images. They are now stored on GCS.
- Remove jenins configs.
2020-08-05 11:20:48 +10:00
kabeer27 21cd8de8dc
Skipping fuzzing build when project is disabled (#4239)
* Skipping fuzzing build when project is disabled

* Removing skip build and making it better
2020-07-31 17:20:09 +10:00
Oliver Chang 47b57ca1dd
Fix a typo from previous MSan function addition. (#4241) 2020-07-31 16:58:28 +10:00
Oliver Chang 95e66c619e
Move cmake install to base-clang. (#4240)
Clang now needs a newer cmake to build.
2020-07-31 16:55:30 +10:00
kabeer27 8e4c7b92fd
Adding msan builder to gcp (#4234)
* Adding msan builder to gcp

* Formatting changes

* Refactoring and reducing redundancy

* Moving msan builder entry point into base_images
2020-07-31 14:42:09 +10:00
Oliver Chang 5e3348cdb9
Create individual schedulers for requesting coverage builds. (#4237)
The single function for requesting all coverage builds was timing out.
2020-07-31 10:56:18 +10:00
kabeer27 a622daf7f5
better fix for template (#4226) 2020-07-30 18:01:07 +10:00
kabeer27 341b3d836a
Display historical logs ui change (#4197)
* Initial UI Change to display historical logs

* Minor changes

* More formatting changes

* Adding license header

* Changes, take a look Oliver

* Changes for handling empty build history/ no last successful build

* Reverting the logs folder path from /logs/log to /log

* Merged to latest master and other chnages to template

* Changing backend to reflect build history

* Fixing order of query

* Removed last build status

* More changes

* Adding unit tests and fixes found by unit testing

* Fixing lint errors

* Added more unit tests and fixed typos and formatting

* Fixing comment caps

* Minor formatting issue

Co-authored-by: Oliver Chang <oliverchang@users.noreply.github.com>
2020-07-30 16:20:22 +10:00
Oliver Chang ccb5821f51
Fix build status update. (#4224)
Check for valid statuses rather than only excluding the WORKING status.
There are other failure statuses that need to be accounted for (e.g.
EXPIRED).
2020-07-30 15:10:52 +10:00
Oliver Chang 689f3500a2
Add missing dash to build tag. (#4221) 2020-07-30 08:31:01 +10:00
Oliver Chang ac4af2436f
build: Add queueTtl argument to one more place. (#4219) 2020-07-30 08:21:49 +10:00
Tom Ritter 284dad011e
[rnp] Add afl engine (#4212)
* [rnp] Add afl engine

* Add fuzz_dump and fuzz_keyring to the exception list

These binaries - from https://github.com/rnpgp/rnp/tree/master/src/fuzzing -
are very tiny and just call into the library with a single API,
and are not staticly compiled - so they have very few UBSAN calls.
2020-07-29 09:56:23 -07:00
kabeer27 5893c61c77
Fixing missing dash in datastore query (#4213) 2020-07-29 17:32:54 +10:00
Oliver Chang eb19f16419
Add queueTtl argument to cloud build request. (#4211)
To prevent expiry of queued builds.
2020-07-29 14:50:46 +10:00
Oliver Chang 7bb74407dc
Fix an Python 3 exception in build_project.py. (#4210) 2020-07-29 13:04:59 +10:00
Oliver Chang 4e2a7c07e5
Many build infra fixes. (#4209)
- Remove base image project argument from deploy.sh. Deploy all
  functions to the main oss-fuzz image.
- Reduce max instances of functions to 1 to avoid rate limiting issues.
- Fix missing ndb context initialization in request_build.py
- Fix incorrect tags in BuildHistory entities. "-" was doubled.
- Fix base build deployment with incorrect schedule variable.
- Add scripts for requesting builds locally.
2020-07-29 12:39:49 +10:00
Oliver Chang 24b4bb32cb
Fix builds status requirements.txt (#4203) 2020-07-28 10:13:46 +10:00
Oliver Chang cf1ce595ba
Disable coverage job sync. (#4195)
Migrating to new infratructure for requesting coverage jobs.
2020-07-27 16:50:45 +10:00
Oliver Chang bc7d478d4a
build: Project sync fixes. (#4194)
- Add some more logging.
- Use GitHub client ID/secret rather than personal access token.
- Fix function deploy wrt "--project" argument.
2020-07-27 13:19:44 +10:00
Abhishek Arya dbeab81f5d
Add corpus-dir to run_fuzzer, for later use in coverage cmd. (#4191)
* Add corpus-dir to run_fuzzer, for later use in coverage cmd.

* Update as per comment.
2020-07-24 16:41:45 -07:00
Max Moroz 70d278bb53
[infra] Rename msan-builder to msan-libs-builder (#3388). (#4190)
* [infra] Rename msan-builder to msan-libs-builder and add (broken) dfsan-libs-builder (#3388).

* remove dfsan-libs-builder for now

* presubmit format
2020-07-24 12:38:00 -07:00
Max Moroz a9d0062a55
[infra] Rename base-msan-builder image to base-sanitizer-libs-builder (#3388). (#4187)
* [infra] Rename base-msan-builder image to base-sanitizer-builder (#3388).

* rename to base-sanitizer-libs-builder
2020-07-23 16:36:58 -07:00
kabeer27 9d2381a621
Initial integration of builds_status (#4175) 2020-07-23 16:23:31 +10:00
kabeer27 769c6e80f2
Adding build coverage cloud function, and refactoring test_utils.py (#4151)
* Adding build coverage cloud function, and refactoring test_utils.py

* Multiple changes will add a comment.

* Catching sys.exit() exception and removing useless wrapper build_steps function

* Comment update

* Comment update

* Comment formatting
2020-07-20 16:30:48 +10:00
Max Moroz 05bafd4fcf
[infra] Build libc++ and libc++abi with DFSan (#3388, #1632). (#4153)
* [infra] Build libc++ and libc++abi with DFSan (#3388, #1632).

* create a common function to reduce code duplication
2020-07-17 13:54:36 -07:00
kabeer27 f0d54c33cb
Refactoring and request build cloud function (#4120)
Co-authored-by: Kabeer Seth <kabeerseth@google.com>
2020-07-16 11:11:18 +10:00
Abhishek Arya 21ea9d6e3d
Remove sanitizer validation checks in CIFuzz, (#4131)
Sanitizer validation is not needed and it is hacky code with
no proper yaml parsing. sanitizer attribute is properly
documented.
Fixes #3996.
2020-07-15 13:00:57 -07:00
Abhishek Arya cfb18fbea7
CI fix. (#4139) 2020-07-15 09:46:24 -07:00
Max Moroz 820e252dfa
[infra] Fix a typo in collect_dft bash script. 2020-07-13 10:19:57 -07:00
Max Moroz 2fe0d878ae
Revert "Refactoring gcb libraries for external use by Cloud functions (#4103)" (#4117)
This reverts commit 9ed73c1cd7.
2020-07-13 09:47:11 -07:00