Skip to content

Commit

Permalink
Bug 1569370 - add mozconfig fragments for declaring wasm sandboxing b…
Browse files Browse the repository at this point in the history
…its; r=firefox-build-system-reviewers,rstewart

This patch is not ideal: if would be better to do the defaulting in
`toolkit/moz.configure`, but doing it there runs into problems with base
toolchain configurations, as the clang there is not new enough.  So we
have this, doing everything with environment variables, which is easily
turned on or off, depending on the needs of the specific configuration.

The `mozconfig.no-compile` change is not really needed, as the wasm
sandboxing detection bits are not conditional on
`--enable-compile-environment`.  Those bits should be, and I will tackle
doing that after the holidays.

Differential Revision: https://phabricator.services.mozilla.com/D58102

--HG--
extra : moz-landing-system : lando
  • Loading branch information
froydnj committed Jan 7, 2020
1 parent e026e88 commit 92e5beb
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/asan-fuzzing-ccov
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ MOZ_REQUIRE_SIGNING=0
ac_add_options "MOZ_ALLOW_LEGACY_EXTENSIONS=1"

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

# ASan specific options on Linux
ac_add_options --enable-valgrind
Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/common-opt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is sourced by the nightly, beta, and release mozconfigs.

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --with-google-location-service-api-keyfile=/builds/gls-gapi.data
Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/debug
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ac_add_options --enable-debug

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

MOZ_AUTOMATION_L10N_CHECK=0

Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/debug-asan
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ac_add_options --enable-debug
ac_add_options --enable-optimize="-O1"

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

# ASan specific options on Linux
ac_add_options --enable-valgrind
Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/debug-fuzzing
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ac_add_options --enable-debug

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

MOZ_AUTOMATION_L10N_CHECK=0

Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/debug-searchfox-clang
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MOZ_AUTOMATION_CHECK=0
ac_add_options --enable-debug

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

# Use Clang as specified in manifest
export CC="$MOZ_FETCHES_DIR/clang/bin/clang"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ MOZ_AUTOMATION_L10N_CHECK=0
ac_add_options --enable-debug

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

# Use Clang as specified in manifest
export CC="$MOZ_FETCHES_DIR/clang/bin/clang"
Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/nightly-asan
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ac_add_options --disable-debug
ac_add_options --enable-optimize="-O2 -gline-tables-only"

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

# ASan specific options on Linux
ac_add_options --enable-valgrind
Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/nightly-fuzzing-asan
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MOZ_REQUIRE_SIGNING=0
ac_add_options "MOZ_ALLOW_LEGACY_EXTENSIONS=1"

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

# ASan specific options on Linux
ac_add_options --enable-valgrind
Expand Down
6 changes: 6 additions & 0 deletions browser/config/mozconfigs/linux64/plain-opt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
export TOOLTOOL_DIR="$topsrcdir"
export LLVM_CONFIG="${MOZ_FETCHES_DIR}/clang/bin/llvm-config"

export WASM_SANDBOXED_LIBRARIES=graphite
export LUCETC="${MOZ_FETCHES_DIR}/lucetc/lucetc"
export WASI_SYSROOT="${MOZ_FETCHES_DIR}/wasi-sysroot/share/wasi-sysroot"
export WASM_CC="${MOZ_FETCHES_DIR}/clang/bin/clang --target=wasm32-wasi"
export WASM_CXX="${MOZ_FETCHES_DIR}/clang/bin/clang++ --target=wasm32-wasi"

CARGO="${MOZ_FETCHES_DIR}/rustc/bin/cargo"
RUSTC="${MOZ_FETCHES_DIR}/rustc/bin/rustc"
RUSTDOC="${MOZ_FETCHES_DIR}/rustc/bin/rustdoc"
Expand Down
1 change: 1 addition & 0 deletions browser/config/mozconfigs/linux64/tsan
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ac_add_options --disable-debug
ac_add_options --enable-optimize="-O2 -gline-tables-only"

. $topsrcdir/build/mozconfig.stylo
. $topsrcdir/build/mozconfig.wasm-sandboxing

. $topsrcdir/build/unix/mozconfig.tsan
ac_add_options --disable-elf-hack
Expand Down
6 changes: 6 additions & 0 deletions build/mozconfig.no-compile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ unset AR
unset NM
unset RANLIB
unset NASM

unset WASM_SANDBOXED_LIBRARIES
unset WASM_CC
unset WASM_CXX
unset LUCETC
unset WASI_SYSROOT
13 changes: 13 additions & 0 deletions build/mozconfig.wasm-sandboxing
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Tell the build system about bits to build sandboxed wasm libraries.
case "$PERFHERDER_EXTRA_OPTIONS" in
base-toolchains*)
# Clang versions < 8.0 don't support wasm.
;;
*)
export WASM_SANDBOXED_LIBRARIES=graphite
export WASM_CC="${MOZ_FETCHES_DIR}/clang/bin/clang --target=wasm32-wasi"
export WASM_CXX="${MOZ_FETCHES_DIR}/clang/bin/clang++ --target=wasm32-wasi"
export LUCETC="${MOZ_FETCHES_DIR}/lucetc/lucetc"
export WASI_SYSROOT="${MOZ_FETCHES_DIR}/wasi-sysroot/share/wasi-sysroot"
;;
esac
1 change: 1 addition & 0 deletions toolkit/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,7 @@ def wasm_sandboxing_libraries():
return ('graphite',)

option('--with-wasm-sandboxed-libraries',
env='WASM_SANDBOXED_LIBRARIES',
help='Enable wasm sandboxing for the selected libraries',
nargs='+',
choices=dependable(wasm_sandboxing_libraries))
Expand Down

0 comments on commit 92e5beb

Please sign in to comment.