Page MenuHomePhabricator

[GWP-ASan] Add names to anonymous mappings.
ClosedPublic

Authored by hctim on Fri, Jan 24, 11:07 AM.

Details

Summary

Adds names to anonymous GWP-ASan mappings. This helps Android with debugging
via. /proc/maps, as GWP-ASan-allocated mappings are now easily identifyable.

Diff Detail

Event Timeline

hctim created this revision.Fri, Jan 24, 11:07 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFri, Jan 24, 11:07 AM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript

Could you add a test?

Unit tests: fail. 62146 tests passed, 5 failed and 811 were skipped.

failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

clang-tidy: fail. clang-tidy found 3 errors and 5 warnings. 0 of them are added as review comments below (why?).

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

Could you add a test?

How would you prefer I go about testing this? I can read from /proc/maps but only on Android (which IIRC GWP-ASan doesn't actually test on upstream, only downstream). FWIW - Scudo doesn't have tests for this either.

AFAIK we do test on android.
See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/27148/steps/run%20lit%20tests%20%5Baarch64%2Faosp_marlin-userdebug%2FPI%5D/logs/stdio - it lists a few scudo tests as unsupported, which means the rest of them have passed.

You can do something like test/sanitizer_common/TestCases/Linux/decorate_proc_maps.cpp

hctim added a comment.Fri, Jan 24, 1:17 PM

AFAIK we do test on android.

compiler-rt/cmake/config-ix.cmake:739

# Note: Fuchsia and Windows are not currently supported by GWP-ASan. Support
# is planned for these platforms. Darwin is also not supported due to TLS
# calling malloc on first use.
# TODO(hctim): Enable this on Android again. Looks like it's causing a SIGSEGV
# for Scudo and GWP-ASan, further testing needed.
if (COMPILER_RT_HAS_SANITIZER_COMMON AND GWP_ASAN_SUPPORTED_ARCH AND
    OS_NAME MATCHES "Linux") # <----------------------------------------------------------------------------[here]
  set(COMPILER_RT_HAS_GWP_ASAN TRUE)
else()
  set(COMPILER_RT_HAS_GWP_ASAN FALSE)
endif()
pythonize_bool(COMPILER_RT_HAS_GWP_ASAN)

I should probably address this TODO as well... It may actually be resolved with the fork() changes, but I can't remember what the exact problem is.

eugenis accepted this revision.Fri, Jan 24, 1:39 PM

Hm, we should really fix that sometime soon.

In the mean time, I'm OK with this going in w/o tests, after all it's mainly a decorative change.
But please leave a TODO somewhere.

This revision is now accepted and ready to land.Fri, Jan 24, 1:39 PM
hctim updated this revision to Diff 240302.Fri, Jan 24, 2:59 PM
  • Merged from master (after enable/disable + fork support by @eugenis).
This revision was automatically updated to reflect the committed changes.

Unit tests: fail. 62191 tests passed, 1 failed and 815 were skipped.

failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_timedmutex_requirements/thread_timedmutex_class/lock.pass.cpp

clang-tidy: fail. clang-tidy found 3 errors and 5 warnings. 0 of them are added as review comments below (why?).

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.