This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Fix tests under ASan/UBSan
ClosedPublic

Authored by cryptoad on Sep 23 2020, 10:23 AM.

Details

Summary

Fix a potential UB in appendSignedDecimal (with -INT64_MIN) by making
it a special case.

Fix the terrible test cases for isOwned: I was pretty sloppy on those
and used some stack & static variables, but since isOwned accesses
memory prior to the pointer to check for the validity of the Scudo
header, it ended up being detected as some global and stack buffer out
of bounds accesses. So not I am using buffers with enough room so that
the test will not access memory prior to the variables.

With those fixes, the tests pass on the ASan+UBSan Fuchsia build.

Thanks to Roland for pointing those out!

Diff Detail

Event Timeline

cryptoad created this revision.Sep 23 2020, 10:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 23 2020, 10:23 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cryptoad requested review of this revision.Sep 23 2020, 10:23 AM
mcgrathr accepted this revision.Sep 23 2020, 11:14 AM

LGTM modulo clang-format. Thanks for the quick fixes!

This revision is now accepted and ready to land.Sep 23 2020, 11:14 AM

LGTM modulo clang-format. Thanks for the quick fixes!

I actually formatted with a freshly built clang-format using clang-format -style=llvm -i string_utils.cpp, I am assuming there is some discrepancy between this one and the one used in pre-merge checks.

This revision was landed with ongoing or failed builds.Sep 23 2020, 12:08 PM
This revision was automatically updated to reflect the committed changes.