commit 13fe20de0088216a1f71a669050199447c5b3217 Author: Georg Koppen gk@torproject.org Date: Sun Aug 30 05:31:59 2020 +0000
Bug 40002: Fix Linux ASan builds for ESR 78
We make the ASan build a first-class tor-browser-build citizen as well. Additionally, we clean the .mozconfig file up so that we have a ASan build without the `--enable-debug` and `--enable-test` options. This makes it more usable for hunting memory corruption bugs. We can think about separate debug builds that have all the assertions etc. enabled if we find that part useful. --- projects/firefox/build | 1 - projects/firefox/config | 2 +- projects/firefox/mozconfig-linux-x86_64-asan | 45 ++++++++++++++++++++++++++++ rbm.conf | 4 +++ 4 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/projects/firefox/build b/projects/firefox/build index ea03088..7b57387 100644 --- a/projects/firefox/build +++ b/projects/firefox/build @@ -62,7 +62,6 @@ tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz cd /var/tmp/build/[% project %]-[% c("version") %] mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig [% IF c("var/asan") -%] - mv -f .mozconfig-asan .mozconfig # Without disabling LSan our build is blowing up: # https://bugs.torproject.org/10599#comment:52 export ASAN_OPTIONS="detect_leaks=0" diff --git a/projects/firefox/config b/projects/firefox/config index aa34b7e..7e48c6d 100644 --- a/projects/firefox/config +++ b/projects/firefox/config @@ -117,7 +117,7 @@ input_files: - name: '[% c("var/compiler") %]' project: '[% c("var/compiler") %]' - filename: get-moz-build-date - - filename: 'mozconfig-[% c("var/osname") %]' + - filename: 'mozconfig-[% c("var/osname") %][% IF c("var/asan") %]-asan[% END %]' name: mozconfig - project: binutils name: binutils diff --git a/projects/firefox/mozconfig-linux-x86_64-asan b/projects/firefox/mozconfig-linux-x86_64-asan new file mode 100644 index 0000000..a1c4e46 --- /dev/null +++ b/projects/firefox/mozconfig-linux-x86_64-asan @@ -0,0 +1,45 @@ +. $topsrcdir/browser/config/mozconfig + +export CFLAGS="-fsanitize=address -Dxmalloc=myxmalloc" +export CXXFLAGS="-fsanitize=address -Dxmalloc=myxmalloc" +# We need to add -ldl explicitely due to bug 1213698 +export LDFLAGS="-fsanitize=address -ldl" + +# Define HOST_CFLAGS, etc. to avoid compiling programs such as mbsdiff +# (which is part of mar-tools and is not distributed to end-users) with +# ASan. See bug 17858. +export HOST_CFLAGS="" +export HOST_CXXFLAGS="" +export HOST_LDFLAGS="-ldl" + +mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@ +mk_add_options MOZ_APP_DISPLAYNAME="Tor Browser" +export MOZILLA_OFFICIAL=1 +export BINDGEN_CFLAGS='--gcc-toolchain=/var/tmp/dist/gcc' + +ac_add_options --enable-address-sanitizer +ac_add_options --disable-jemalloc +ac_add_options --disable-elf-hack +ac_add_options --with-clang-path=/var/tmp/dist/clang/bin/clang + +ac_add_options --enable-optimize +ac_add_options --enable-official-branding + +# Let's support GTK3 for ESR60 +ac_add_options --enable-default-toolkit=cairo-gtk3 + +ac_add_options --enable-tor-browser-update +ac_add_options --enable-verify-mar + +ac_add_options --disable-strip +ac_add_options --disable-install-strip +ac_add_options --disable-tests +ac_add_options --disable-debug +ac_add_options --disable-crashreporter +ac_add_options --disable-webrtc +ac_add_options --disable-parental-controls +ac_add_options --disable-eme +ac_add_options --enable-proxy-bypass-protection + +# Disable telemetry +ac_add_options MOZ_TELEMETRY_REPORTING= diff --git a/rbm.conf b/rbm.conf index e59613a..3efbe0c 100644 --- a/rbm.conf +++ b/rbm.conf @@ -383,6 +383,10 @@ targets: linux-debug: var: asan: 1 + # RLBox needs clang to create .wasm files but we use mostly GCC for our + # ASan builds. Thus, the compilation currently breaks with RLBox enabled. + # See: tor-browser-build#40063. + rlbox: 0
torbrowser-windows-i686: - windows-i686