diff --git a/browser/config/mozconfigs/linux32/debug-fuzzing b/browser/config/mozconfigs/linux32/debug-fuzzing new file mode 100644 index 000000000000..ca18dea3845d --- /dev/null +++ b/browser/config/mozconfigs/linux32/debug-fuzzing @@ -0,0 +1,31 @@ +ac_add_options --enable-debug + +. $topsrcdir/build/unix/mozconfig.linux32 + +export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/bin/llvm-symbolizer" + +# Package js shell. +export MOZ_PACKAGE_JSSHELL=1 + +ac_add_options --enable-fuzzing +unset MOZ_STDCXX_COMPAT + +# gold or lld is required for libFuzzer to work properly +ac_add_options --enable-linker=lld + +# Even in fuzzing builds without sanitizers, the UBSan runtime is pulled +# in as a dependency to allow libFuzzer to have rudimentary stacks. +# Hence we need to disable jemalloc until bug 1435148 is fully resolved. +ac_add_options --disable-jemalloc + +# Also, for consistency we disable the crash reporter and solely rely +# on libFuzzer to provide stacks both in the browser fuzzing case as +# well as for libFuzzer targets. See also bug 1649062. +ac_add_options --disable-crashreporter +ac_add_options --disable-install-strip +ac_add_options --enable-optimize="-O2 -gline-tables-only" + +# Need this to prevent name conflicts with the normal nightly build packages +export MOZ_PKG_SPECIAL=fuzzing + +. "$topsrcdir/build/mozconfig.common.override" diff --git a/browser/config/mozconfigs/linux32/nightly-fuzzing-asan b/browser/config/mozconfigs/linux32/nightly-fuzzing-asan new file mode 100644 index 000000000000..87084ae9acdd --- /dev/null +++ b/browser/config/mozconfigs/linux32/nightly-fuzzing-asan @@ -0,0 +1,32 @@ +. $topsrcdir/build/unix/mozconfig.linux32 + +# We still need to build with debug symbols +ac_add_options --disable-debug +ac_add_options --enable-optimize="-O2 -gline-tables-only" + +# Add-on signing is checked but not enforced +MOZ_REQUIRE_SIGNING= + +# ASan specific options on Linux +ac_add_options --enable-valgrind + +. $topsrcdir/build/unix/mozconfig.asan +ac_add_options --disable-elf-hack + +ac_add_options --enable-fuzzing +unset MOZ_STDCXX_COMPAT + +# gold or lld is required for libFuzzer to work properly +ac_add_options --enable-linker=lld + +# Piggybacking UBSan for now since only a small subset of checks are enabled. +# A new build can be created when appropriate. +ac_add_options --enable-undefined-sanitizer + +# Package js shell. +export MOZ_PACKAGE_JSSHELL=1 + +# Need this to prevent name conflicts with the normal nightly build packages +export MOZ_PKG_SPECIAL=asan + +. "$topsrcdir/build/mozconfig.common.override" diff --git a/browser/config/mozconfigs/linux64/debug-fuzzing b/browser/config/mozconfigs/linux64/debug-fuzzing index 4a337a892237..e857c7ee7ea8 100644 --- a/browser/config/mozconfigs/linux64/debug-fuzzing +++ b/browser/config/mozconfigs/linux64/debug-fuzzing @@ -8,9 +8,11 @@ export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/bin/llvm-symbolizer" export MOZ_PACKAGE_JSSHELL=1 ac_add_options --enable-fuzzing -ac_add_options --enable-linker=lld unset MOZ_STDCXX_COMPAT +# gold or lld is required for libFuzzer to work properly +ac_add_options --enable-linker=lld + # Even in fuzzing builds without sanitizers, the UBSan runtime is pulled # in as a dependency to allow libFuzzer to have rudimentary stacks. # Hence we need to disable jemalloc until bug 1435148 is fully resolved. diff --git a/taskcluster/ci/build/linux.yml b/taskcluster/ci/build/linux.yml index eafdf447a97e..89b88aca9ace 100644 --- a/taskcluster/ci/build/linux.yml +++ b/taskcluster/ci/build/linux.yml @@ -527,6 +527,53 @@ linux/opt: - sysroot-x86_64-linux-gnu - sysroot-wasm32-wasi +linux-fuzzing/debug: + description: "Linux32 Fuzzing Debug" + index: + product: firefox + job-name: linux-fuzzing-debug + attributes: + # The gtest libxul contains libFuzzer targets + skip-verify-test-packaging: true + treeherder: + platform: linux32/debug + symbol: Bf + worker: + max-run-time: 5400 + env: + PERFHERDER_EXTRA_OPTIONS: fuzzing + MOZ_AUTOMATION_PACKAGE_TESTS: "1" + run: + using: mozharness + actions: [get-secrets, build] + config: + - builds/releng_base_firefox.py + - builds/releng_base_linux_32_builds.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + custom-build-variant-cfg: fuzzing-debug + mozconfig-variant: debug-fuzzing + tooltool-downloads: public + use-sccache: true + fetches: + toolchain: + - linux64-binutils + - linux64-clang + - linux64-cbindgen + - linux64-dump_syms + - linux32-llvm-symbolizer + - linux64-sccache + - linux64-rust + - linux64-rust-size + - linux64-nasm + - linux64-node + - linux64-pkgconf + - sysroot-i686-linux-gnu + - sysroot-x86_64-linux-gnu + - sysroot-wasm32-wasi + optimization: + skip-unless-expanded: null + linux/debug: description: "Linux32 Debug" index: @@ -797,6 +844,53 @@ linux-reproduced/opt: - sysroot-x86_64-linux-gnu - sysroot-wasm32-wasi +linux-asan-fuzzing/opt: + description: "Linux32 Fuzzing Opt ASAN" + index: + product: firefox + job-name: linux-fuzzing-asan-opt + attributes: + # The gtest libxul contains libFuzzer targets + skip-verify-test-packaging: true + treeherder: + platform: linux32/asan + symbol: Bof + worker: + env: + PERFHERDER_EXTRA_OPTIONS: asan-fuzzing + MOZ_AUTOMATION_PACKAGE_TESTS: "1" + max-run-time: 5400 + run: + using: mozharness + actions: [get-secrets, build] + config: + - builds/releng_base_firefox.py + - builds/releng_base_linux_32_builds.py + script: "mozharness/scripts/fx_desktop_build.py" + secrets: true + custom-build-variant-cfg: fuzzing-asan-tc + mozconfig-variant: nightly-fuzzing-asan + tooltool-downloads: public + use-sccache: true + fetches: + toolchain: + - linux64-binutils + - linux64-clang + - linux64-rust + - linux64-rust-size + - linux64-cbindgen + - linux64-dump_syms + - linux32-llvm-symbolizer + - linux64-sccache + - linux64-nasm + - linux64-node + - linux64-pkgconf + - sysroot-i686-linux-gnu + - sysroot-x86_64-linux-gnu + - sysroot-wasm32-wasi + optimization: + skip-unless-expanded: null + linux64-reproduced/opt: description: "Linux64 Reproduced" use-pgo: linux64-shippable/opt diff --git a/taskcluster/ci/toolchain/llvm-symbolizer.yml b/taskcluster/ci/toolchain/llvm-symbolizer.yml index 91289603f5cf..1e38f9429895 100644 --- a/taskcluster/ci/toolchain/llvm-symbolizer.yml +++ b/taskcluster/ci/toolchain/llvm-symbolizer.yml @@ -15,6 +15,21 @@ job-defaults: toolchain: - linux64-clang-15-stage1 +linux32-llvm-symbolizer: + description: "llvm-symbolizer for Linux" + treeherder: + symbol: TL32(llvm-symbolizer) + run: + arguments: + - i686-unknown-linux-gnu + - build/build-clang/clang-15.json + resources: + - build/build-clang/clang-15.json + - taskcluster/scripts/misc/build-llvm-common.sh + fetches: + toolchain: + - linux32-toolchain-sysroot + linux64-llvm-symbolizer: description: "llvm-symbolizer for Linux" treeherder: diff --git a/taskcluster/ci/toolchain/sysroot.yml b/taskcluster/ci/toolchain/sysroot.yml index 50bd80b2d920..73ee5ff7b360 100644 --- a/taskcluster/ci/toolchain/sysroot.yml +++ b/taskcluster/ci/toolchain/sysroot.yml @@ -111,6 +111,28 @@ sysroot-aarch64-linux-gnu: arguments: - arm64 +linux32-toolchain-sysroot: + description: "Sysroot for linux32 toolchain builds" + worker: + env: + PACKAGES_TASKS: {task-reference: ''} + treeherder: + symbol: TL(sysroot32-toolchain) + dependencies: + gcc-7: packages-deb8-32-gcc-7 + run: + arguments: + - i386 + # For clang + - binutils-dev + - libxml2-dev + # For minidump-stackwalk + - libcurl4-openssl-dev + - libssl-dev + - libbz2-dev + # For msix-package + - libicu-dev + linux64-toolchain-sysroot: description: "Sysroot for linux64 toolchain builds" worker: diff --git a/taskcluster/scripts/misc/build-llvm-common.sh b/taskcluster/scripts/misc/build-llvm-common.sh index 251983e7e3e7..3292605335fd 100755 --- a/taskcluster/scripts/misc/build-llvm-common.sh +++ b/taskcluster/scripts/misc/build-llvm-common.sh @@ -111,6 +111,12 @@ case "$target" in else sysroot=$MOZ_FETCHES_DIR/sysroot-${target%-unknown-linux-gnu}-linux-gnu fi + if [ "${target%-unknown-linux-gnu}" = i686 ]; then + EXTRA_CMAKE_FLAGS=" + $EXTRA_CMAKE_FLAGS + -DLLVM_TABLEGEN=$MOZ_FETCHES_DIR/clang/bin/llvm-tblgen + " + fi EXTRA_CMAKE_FLAGS=" $EXTRA_CMAKE_FLAGS -DCMAKE_SYSROOT=$sysroot diff --git a/testing/mozharness/configs/builds/releng_sub_linux_configs/32_fuzzing_asan_tc.py b/testing/mozharness/configs/builds/releng_sub_linux_configs/32_fuzzing_asan_tc.py new file mode 100644 index 000000000000..fd380023a82b --- /dev/null +++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/32_fuzzing_asan_tc.py @@ -0,0 +1,29 @@ +# 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/. + +from __future__ import absolute_import + +import os + +config = { + "stage_platform": "linux32-fuzzing-asan", + #### 32 bit build specific ##### + "env": { + "MOZBUILD_STATE_PATH": os.path.join(os.getcwd(), ".mozbuild"), + "MOZ_AUTOMATION": "1", + "DISPLAY": ":2", + "HG_SHARE_BASE_DIR": "/builds/hg-shared", + "MOZ_OBJDIR": "%(abs_obj_dir)s", + "TINDERBOX_OUTPUT": "1", + "TOOLTOOL_CACHE": "/builds/tooltool_cache", + "TOOLTOOL_HOME": "/builds", + "MOZ_CRASHREPORTER_NO_REPORT": "1", + "LC_ALL": "C", + "ASAN_OPTIONS": "detect_leaks=0", + ## 32 bit specific + "PATH": "/usr/local/bin:/bin:\ +/usr/bin:/usr/local/sbin:/usr/sbin:/sbin", + }, + ####################### +} diff --git a/testing/mozharness/configs/builds/releng_sub_linux_configs/32_fuzzing_debug.py b/testing/mozharness/configs/builds/releng_sub_linux_configs/32_fuzzing_debug.py new file mode 100644 index 000000000000..5aa54349c0b2 --- /dev/null +++ b/testing/mozharness/configs/builds/releng_sub_linux_configs/32_fuzzing_debug.py @@ -0,0 +1,28 @@ +# 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/. + +from __future__ import absolute_import + +import os + +config = { + "stage_platform": "linux-fuzzing-debug", + "debug_build": True, + #### 32 bit build specific ##### + "env": { + "MOZBUILD_STATE_PATH": os.path.join(os.getcwd(), ".mozbuild"), + "DISPLAY": ":2", + "HG_SHARE_BASE_DIR": "/builds/hg-shared", + "MOZ_OBJDIR": "%(abs_obj_dir)s", + "MOZ_CRASHREPORTER_NO_REPORT": "1", + "LC_ALL": "C", + "XPCOM_DEBUG_BREAK": "stack-and-abort", + # 32 bit specific + "PATH": "/usr/local/bin:/bin:\ +/usr/bin:/usr/local/sbin:/usr/sbin:/sbin", + "LD_LIBRARY_PATH": "%(abs_obj_dir)s/dist/bin", + "TINDERBOX_OUTPUT": "1", + }, + ####################### +}