diff options
-rwxr-xr-x | build.sh | 6 | ||||
-rw-r--r-- | fuzz/Makefile | 42 | ||||
-rw-r--r-- | fuzz/cert_target.cc (renamed from fuzz/nssfuzz/cert_target.cc) | 0 | ||||
-rwxr-xr-x | fuzz/clone_libfuzzer.sh | 2 | ||||
-rw-r--r-- | fuzz/common.mk | 10 | ||||
-rw-r--r-- | fuzz/fuzz.gyp | 33 | ||||
-rw-r--r-- | fuzz/libFuzzer/Makefile | 45 | ||||
-rw-r--r-- | fuzz/libFuzzer/config.mk | 14 | ||||
-rw-r--r-- | fuzz/libFuzzer/libFuzzer.gyp | 36 | ||||
-rw-r--r-- | fuzz/libFuzzer/manifest.mn | 26 | ||||
-rw-r--r-- | fuzz/manifest.mn | 8 | ||||
-rw-r--r-- | fuzz/nssfuzz.cc (renamed from fuzz/nssfuzz/nssfuzz.cc) | 0 | ||||
-rw-r--r-- | fuzz/nssfuzz/Makefile | 45 | ||||
-rw-r--r-- | fuzz/nssfuzz/manifest.mn | 24 | ||||
-rw-r--r-- | fuzz/pkcs8_target.cc (renamed from fuzz/nssfuzz/pkcs8_target.cc) | 0 | ||||
-rw-r--r-- | fuzz/registry.h (renamed from fuzz/nssfuzz/registry.h) | 0 | ||||
-rw-r--r-- | fuzz/shared.h (renamed from fuzz/nssfuzz/shared.h) | 0 | ||||
-rw-r--r-- | fuzz/spki_target.cc (renamed from fuzz/nssfuzz/spki_target.cc) | 0 | ||||
-rw-r--r-- | manifest.mn | 4 | ||||
-rw-r--r-- | nss.gyp | 11 |
20 files changed, 84 insertions, 222 deletions
@@ -85,8 +85,12 @@ enable_fuzz() gyp_params+=(-Duse_asan=1) gyp_params+=(-Duse_ubsan=1) gyp_params+=(-Duse_sancov=edge) + # Adding debug symbols even for opt builds. nspr_opt+=(--enable-debug-symbols) + + # Clone libFuzzer repository. + $cwd/fuzz/clone_libfuzzer.sh &>/dev/null } # parse command line arguments @@ -97,7 +101,7 @@ while [ $# -gt 0 ]; do -j) ninja_params+=(-j "$2"); shift ;; -v) ninja_params+=(-v) ;; --test) gyp_params+=(-Dtest_build=1) ;; - --fuzz) gyp_params+=(-Dtest_build=1 -Dfuzz=1); check_sanitizer; enable_fuzz ;; + --fuzz) gyp_params+=(-Dtest_build=1 -Dfuzz=1); enable_fuzz ;; --scan-build) scanbuild=(scan-build) ;; --scan-build=?*) scanbuild=(scan-build -o "${1#*=}") ;; --opt|-o) opt_build=1 ;; diff --git a/fuzz/Makefile b/fuzz/Makefile deleted file mode 100644 index ae82276da..000000000 --- a/fuzz/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -#! gmake -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### diff --git a/fuzz/nssfuzz/cert_target.cc b/fuzz/cert_target.cc index 147743129..147743129 100644 --- a/fuzz/nssfuzz/cert_target.cc +++ b/fuzz/cert_target.cc diff --git a/fuzz/clone_libfuzzer.sh b/fuzz/clone_libfuzzer.sh index d58921e6b..d2481692e 100755 --- a/fuzz/clone_libfuzzer.sh +++ b/fuzz/clone_libfuzzer.sh @@ -3,7 +3,7 @@ cd $(dirname $0) mkdir tmp/ git clone -q https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer tmp/ -mv tmp/.git libFuzzer +mv tmp/.git libFuzzer/ rm -fr tmp cd libFuzzer git reset --hard 4333f2ca71eb7951fcafcdcb111012fbe25c5e7e diff --git a/fuzz/common.mk b/fuzz/common.mk deleted file mode 100644 index c12014c65..000000000 --- a/fuzz/common.mk +++ /dev/null @@ -1,10 +0,0 @@ -#! gmake -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -MKPROG = $(CCC) -MKSHLIB = $(CCC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS) - -CXXFLAGS += -std=c++11 diff --git a/fuzz/fuzz.gyp b/fuzz/fuzz.gyp new file mode 100644 index 000000000..df6c9c635 --- /dev/null +++ b/fuzz/fuzz.gyp @@ -0,0 +1,33 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +{ + 'includes': [ + '../coreconf/config.gypi', + '../cmd/platlibs.gypi' + ], + 'targets': [ + { + 'target_name': 'nssfuzz', + 'type': 'executable', + 'sources': [ + 'cert_target.cc', + 'pkcs8_target.cc', + 'spki_target.cc', + 'nssfuzz.cc', + ], + 'dependencies': [ + '<(DEPTH)/exports.gyp:nss_exports', + '<(DEPTH)/fuzz/libFuzzer/libFuzzer.gyp:libFuzzer' + ] + } + ], + 'target_defaults': { + 'include_dirs': [ + 'libFuzzer', + ], + }, + 'variables': { + 'module': 'nss', + } +} diff --git a/fuzz/libFuzzer/Makefile b/fuzz/libFuzzer/Makefile deleted file mode 100644 index 85e8e9ac9..000000000 --- a/fuzz/libFuzzer/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -#! gmake -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - -include config.mk - -include ../common.mk - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### diff --git a/fuzz/libFuzzer/config.mk b/fuzz/libFuzzer/config.mk deleted file mode 100644 index 9ca6cae3a..000000000 --- a/fuzz/libFuzzer/config.mk +++ /dev/null @@ -1,14 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# According to the LLVM docs, LibFuzzer isn't supposed to be built with any -# sanitizer flags and in fact, building it with ASan coverage currently causes -# Clang 3.9+ to crash, so we filter out all sanitizer-related flags here. -CXXFLAGS := $(filter-out -fsanitize%,$(CXXFLAGS)) -CFLAGS := $(filter-out -fsanitize%,$(CFLAGS)) -LDFLAGS := $(filter-out -fsanitize%,$(LDFLAGS)) -DARWIN_SDK_SHLIBFLAGS := $(filter-out -fsanitize%,$(DARWIN_SDK_SHLIBFLAGS)) - -CXXFLAGS += -g -O2 diff --git a/fuzz/libFuzzer/libFuzzer.gyp b/fuzz/libFuzzer/libFuzzer.gyp new file mode 100644 index 000000000..e56a9f587 --- /dev/null +++ b/fuzz/libFuzzer/libFuzzer.gyp @@ -0,0 +1,36 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +{ + 'includes': [ + '../../coreconf/config.gypi' + ], + 'targets': [ + { + 'target_name': 'libFuzzer', + 'type': 'static_library', + 'sources': [ + 'FuzzerCrossOver.cpp', + 'FuzzerDriver.cpp', + 'FuzzerExtFunctionsDlsym.cpp', + 'FuzzerExtFunctionsWeak.cpp', + 'FuzzerIO.cpp', + 'FuzzerLoop.cpp', + 'FuzzerMutate.cpp', + 'FuzzerSHA1.cpp', + 'FuzzerTracePC.cpp', + 'FuzzerTraceState.cpp', + 'FuzzerUtil.cpp', + 'FuzzerUtilDarwin.cpp', + 'FuzzerUtilLinux.cpp', + ], + 'cflags': [ + '-O2', + ], + 'cflags/': [ + ['exclude', '-fsanitize='], + ['exclude', '-fsanitize-'], + ] + } + ], +} diff --git a/fuzz/libFuzzer/manifest.mn b/fuzz/libFuzzer/manifest.mn deleted file mode 100644 index 54e0dad52..000000000 --- a/fuzz/libFuzzer/manifest.mn +++ /dev/null @@ -1,26 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -CORE_DEPTH = ../.. -DEPTH = ../.. -MODULE = nss - -CPPSRCS = \ - FuzzerCrossOver.cpp \ - FuzzerDriver.cpp \ - FuzzerExtFunctionsDlsym.cpp \ - FuzzerExtFunctionsWeak.cpp \ - FuzzerIO.cpp \ - FuzzerLoop.cpp \ - FuzzerMutate.cpp \ - FuzzerSHA1.cpp \ - FuzzerTracePC.cpp \ - FuzzerTraceState.cpp \ - FuzzerUtil.cpp \ - FuzzerUtilDarwin.cpp \ - FuzzerUtilLinux.cpp \ - $(NULL) - -LIBRARY_NAME = Fuzzer -LIBRARY_VERSION = 1 diff --git a/fuzz/manifest.mn b/fuzz/manifest.mn deleted file mode 100644 index 74d898621..000000000 --- a/fuzz/manifest.mn +++ /dev/null @@ -1,8 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -CORE_DEPTH = .. -DEPTH = .. - -DIRS = libFuzzer nssfuzz diff --git a/fuzz/nssfuzz/nssfuzz.cc b/fuzz/nssfuzz.cc index ebbe7280b..ebbe7280b 100644 --- a/fuzz/nssfuzz/nssfuzz.cc +++ b/fuzz/nssfuzz.cc diff --git a/fuzz/nssfuzz/Makefile b/fuzz/nssfuzz/Makefile deleted file mode 100644 index dafa9f493..000000000 --- a/fuzz/nssfuzz/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -#! gmake -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/cmd/platlibs.mk - -include ../common.mk - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### diff --git a/fuzz/nssfuzz/manifest.mn b/fuzz/nssfuzz/manifest.mn deleted file mode 100644 index ac797c282..000000000 --- a/fuzz/nssfuzz/manifest.mn +++ /dev/null @@ -1,24 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -CORE_DEPTH = ../.. -DEPTH = ../.. -MODULE = nss - -CPPSRCS = \ - cert_target.cc \ - pkcs8_target.cc \ - spki_target.cc \ - nssfuzz.cc \ - $(NULL) - -INCLUDES += -I$(CORE_DEPTH)/fuzz/libFuzzer - -REQUIRES = nspr nss - -PROGRAM = nssfuzz - -EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)Fuzzer.$(LIB_SUFFIX) - -USE_STATIC_LIBS = 1 diff --git a/fuzz/nssfuzz/pkcs8_target.cc b/fuzz/pkcs8_target.cc index 8b6ed7b57..8b6ed7b57 100644 --- a/fuzz/nssfuzz/pkcs8_target.cc +++ b/fuzz/pkcs8_target.cc diff --git a/fuzz/nssfuzz/registry.h b/fuzz/registry.h index 995a81dfa..995a81dfa 100644 --- a/fuzz/nssfuzz/registry.h +++ b/fuzz/registry.h diff --git a/fuzz/nssfuzz/shared.h b/fuzz/shared.h index 09d805ed8..09d805ed8 100644 --- a/fuzz/nssfuzz/shared.h +++ b/fuzz/shared.h diff --git a/fuzz/nssfuzz/spki_target.cc b/fuzz/spki_target.cc index 9b1de587a..9b1de587a 100644 --- a/fuzz/nssfuzz/spki_target.cc +++ b/fuzz/spki_target.cc diff --git a/manifest.mn b/manifest.mn index 92415cde9..32086bf44 100644 --- a/manifest.mn +++ b/manifest.mn @@ -11,7 +11,3 @@ IMPORTS = nspr20/v4.8 \ RELEASE = nss DIRS = coreconf lib cmd gtests - -ifdef FUZZ -DIRS += fuzz -endif @@ -233,11 +233,11 @@ [ 'fuzz==1', { 'targets': [ { - 'target_name': 'fuzz', + 'target_name': 'fuzz_warning', 'type': 'none', 'actions': [ { - 'action_name': 'warn_fuzz', + 'action_name': 'fuzz_warning', 'action': ['cat', 'fuzz/warning.txt'], 'inputs': ['fuzz/warning.txt'], 'ninja_use_console': 1, @@ -245,6 +245,13 @@ } ], }, + { + 'target_name': 'fuzz', + 'type': 'none', + 'dependencies': [ + 'fuzz/fuzz.gyp:nssfuzz', + ] + }, ], }], ], |