This is an archive of the discontinued LLVM Phabricator instance.

[sanitizers] include build ids in stacks on linux.
ClosedPublic

Authored by fmayer on Nov 19 2021, 3:30 PM.

Diff Detail

Event Timeline

fmayer created this revision.Nov 19 2021, 3:30 PM
fmayer requested review of this revision.Nov 19 2021, 3:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 3:30 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
fmayer planned changes to this revision.Nov 19 2021, 5:17 PM
fmayer removed a reviewer: eugenis.

This is in sanitizer_common, so we need a test, TEST(SanitizerStacktracePrinter, ...)

fmayer updated this revision to Diff 390536.Nov 29 2021, 5:47 PM

fix errors on x86

PTAL. As hwasan_symbolize only matches a prefix of the line. it doesn't need to be changed.

eugenis added inline comments.Dec 9 2021, 2:30 PM
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
599 ↗(On Diff #390536)

This already exists as RoundUpTo

628 ↗(On Diff #390536)

Technically, kGnuNamesz should be rounded up, too - but it's already 4. Do it anyway, for clarity?

633 ↗(On Diff #390536)

It would be good to do more checks here - first that the entire nhdr fits in p_memsz, then the name/value data, too.

compiler-rt/test/hwasan/TestCases/build-ids.c
3

Could you use symbolize=0 in %env_hwasan_opts instead?

compiler-rt/test/sanitizer_common/android_commands/android_run.py
16

is this for HWASAN_SYMBOLIZER_PATH?

fmayer updated this revision to Diff 393300.Dec 9 2021, 3:22 PM
fmayer marked 4 inline comments as done.

address comments.

fmayer marked an inline comment as done.Dec 9 2021, 3:23 PM
fmayer added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
628 ↗(On Diff #390536)

Added a static_assert.

633 ↗(On Diff #390536)

We do check that the nhdr fits into p_memsz in the condition of the loop.

Added a check before doing the memcmp and memcpy as an extra precaution.

compiler-rt/test/sanitizer_common/android_commands/android_run.py
16

Yes, it was. But it's now unneeded.

This revision is now accepted and ready to land.Dec 10 2021, 11:11 AM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Dec 10 2021, 11:51 AM

Looks like the new test doesn't pass: http://45.33.8.238/linux/62840/step_10.txt

This revision is now accepted and ready to land.Dec 10 2021, 11:53 AM
fmayer updated this revision to Diff 393596.Dec 10 2021, 2:22 PM

fix tests.

on some buildbots __hwasan_store shows up above the frame we assert,
so the frame number is wrong

This revision was landed with ongoing or failed builds.Dec 10 2021, 2:24 PM
This revision was automatically updated to reflect the committed changes.