This is an archive of the discontinued LLVM Phabricator instance.

[hwasan] Implement error report callback.
ClosedPublic

Authored by eugenis on Nov 19 2020, 2:39 PM.

Details

Summary

Similar to __asan_set_error_report_callback, pass the entire report to a
user provided callback function.

Diff Detail

Event Timeline

eugenis created this revision.Nov 19 2020, 2:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2020, 2:39 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
eugenis requested review of this revision.Nov 19 2020, 2:39 PM

You can notice that this change is moving SetAbortMessage call out from under error_message_lock_.
I'm not sure why exactly I'm doing this, other than the fact that ASan does it this way.
This will allow Printf() from within the callback, which is quite unlikely to happen, but I guess possible in verbose mode or something like that.
All of this is still under the wider error_report_lock_, so a hwasan error in the callback will result in the "nested bug" message and an immediate exit.

eugenis updated this revision to Diff 306542.Nov 19 2020, 2:53 PM

remove unnecessary copy

It's actually not necessary to copy the error message as long as error_message_ptr_ is reset under the lock.

hctim added a comment.Nov 19 2020, 3:16 PM

You can notice that this change is moving SetAbortMessage call out from under error_message_lock_
I'm not sure why exactly I'm doing this, other than the fact that ASan does it this way.
All of this is still under the wider error_report_lock_, so a hwasan error in the callback will result in the "nested bug" message and an immediate exit.

Isn't that why ASan is doing it? HWASan error in the cb if it's still locked would result in deadlock.

Possible to add a test just to double check this? Seems like a plausible scenario to tag-mismatch in the callback.

hctim added a comment.Nov 19 2020, 3:21 PM

Isn't that why ASan is doing it? HWASan error in the cb if it's still locked would result in deadlock.

Possible to add a test just to double check this? Seems like a plausible scenario to tag-mismatch in the callback.

Scratch that, just saw the global ScopedErrorReportLock

Harbormaster completed remote builds in B79531: Diff 306540.
pcc accepted this revision.Nov 20 2020, 4:21 PM

LGTM

This revision is now accepted and ready to land.Nov 20 2020, 4:21 PM
This revision was automatically updated to reflect the committed changes.