This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] New attempt at using runtime checks for Android logging
ClosedPublic

Authored by cryptoad on Nov 16 2017, 3:11 PM.

Details

Summary

This is a second attempt after D40100 induced racey crashes with ASan
(due to __android_log_write and the strncpy interceptor on API >= 21).

This new version checks the runtime API level to be <= ANDROID_KITKAT for
the use of __android_log_write, otherwise we use syslog, which should
conform with the previous behavior.

Unfortunately despite numerous efforts I couldn't reproduce the original
crashes in my environments so I couldn't test that the fix was actually
preventing crashes.

Event Timeline

cryptoad created this revision.Nov 16 2017, 3:11 PM
cryptoad added a subscriber: llvm-commits.
eugenis added inline comments.Nov 16 2017, 3:19 PM
lib/sanitizer_common/sanitizer_linux_libcdep.cc
566

I'd replace this with CHECK(&android_log_write) and move this case below syslog() so that things are sorted in the order of preference:
async_safe_write_log
(L+) syslog
android_log_write

cryptoad updated this revision to Diff 123251.Nov 16 2017, 3:26 PM

Shuffling around the APIs order as requested.

cryptoad marked an inline comment as done.Nov 16 2017, 3:27 PM
eugenis accepted this revision.Nov 16 2017, 3:28 PM
This revision is now accepted and ready to land.Nov 16 2017, 3:28 PM
cryptoad closed this revision.Nov 20 2017, 8:39 AM