Closed Bug 1665081 Opened 5 years ago Closed 5 years ago

Windows ASAN instructions don't appear to create a working build

Categories

(Developer Infrastructure :: Source Documentation, defect)

defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: bryce, Assigned: bryce)

Details

The mozconfig at https://searchfox.org/mozilla-central/rev/0c97a6410ff018c22e65a0cbe4e5f2ca4581b22e/tools/sanitizer/docs/asan.rst#97-109 did not result in a build the produces an ASAN stack as I would expect on crash. I'm not 100% sure as to why, though I suspect it's related to the crash reporter, as I've run into issue before where crashes are intercepted prior to being reported by ASAN.

I tired MOZ_CRASHREPORTER_DISABLE=1 with no luck. I'm going to try rebuilding using some different combinations based on the mozconfigs we have in tree to figure out what's needed and will look at updating the docs following that.

did not result in a build the produces an ASAN stack as I would expect on crash.

Could you elaborate on what piece didn't meet expectations? Is it that you don't get an ASan complaint at all? Or is it that you crash in a debugger but not standalone? Or do you crash where expected but get the wrong/missing stack? Something else?

(In reply to :dmajor from comment #1)

did not result in a build the produces an ASAN stack as I would expect on crash.

Could you elaborate on what piece didn't meet expectations? Is it that you don't get an ASan complaint at all? Or is it that you crash in a debugger but not standalone? Or do you crash where expected but get the wrong/missing stack? Something else?

I believe I crashed as expected, but didn't get any ASan output -- no stack to console, just the Fx 'this page crashed' page. I'm not 100% sure the crash was caused by ASan, but I'm trying to repro a bug that expects an ASan crash, so it would make sense that it was ASan related. Postmortem debugger did not offer to attach.

What happens if you launch under a debugger from the start? (You'll need to sxi av to silence the spurious shadow-memory faults in memset etc.)

If I attach to the process with windbgx and issue sxi av, the tab seems to stall at the point I'd expect it to crash, and only after I detach does it crash. windbgx never breaks prior to detaching, and I don't see asan output anywhere. I think this may be me making a mistake somewhere with my windbg fu though -- see below.

I was doing my initial runs via ./mach. My Linux ASan setup works okay when doing this, but I've just tried testing on Windows and see that I get Asan stack when running my generated firefox.exe directly, but do not when running from ./mach. So I could be misattributing my issue to the config, when it's something going on with mach.

Could it be related to the "Windows opt builds don't have a console" problem? Is it any better with --enable-debug?

The unmodified config I used on my current build

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mozilla-builds/obj-ff-asan

# Enable ASan specific code and build workarounds
ac_add_options --enable-address-sanitizer

# Mandatory options required for ASan builds
ac_add_options --enable-debug-symbols
ac_add_options --disable-jemalloc
ac_add_options --disable-crashreporter
ac_add_options --disable-profiling

# if we want a faster build
#ac_add_options --disable-debug
#ac_add_options --enable-optimize="-O2 -gline-tables-only"


CLANG_LIB_DIR="$(cd ${MOZBUILD_STATE_PATH}/clang/lib/clang/*/lib/windows && pwd)" # this can point to home dir if not using MOZBUILD_STATE_PATH

export LIB=$LIB:$CLANG_LIB_DIR
export LDFLAGS="clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"

export MOZ_COPY_PDBS=1
export LLVM_SYMBOLIZER="${MOZBUILD_STATE_PATH}/clang/bin/llvm-symbolizer.exe" # as above comment re MOZBUILD_STATE_PATH
export MOZ_CLANG_RT_ASAN_LIB_PATH="${CLANG_LIB_DIR}/clang_rt.asan_dynamic-x86_64.dll"

Looking more it may not even be mach. If I run c:/projects/mozilla/mozilla-builds/obj-ff-asan/dist/bin/firefox.exe -p temp in different shells I do or don't get ASan stacks on fault.

  • GitBash shows an ASan stack as expected.
  • Everything else I try doesn't: power shell, command prompt, mozilla-build.

Edit: I see the same behaviour if I download an ASan-opt build from try. ASan-debug builds won't start in GitBash with an assertion failure.

I'm going to invalidate this as it seems like the problem is not the docs, but something around our output. If I get a better idea of what exactly isn't playing nice I'll create another bug/piggy back on an existing one.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.