This is an archive of the discontinued LLVM Phabricator instance.

[HWASAN] Prevent crashes on thread exit
ClosedPublic

Authored by vitalybuka on May 11 2023, 2:30 PM.

Details

Summary

I can't figure out how to reproduce this for test, but I see the case on
random binaries.

The known issue is with GLIBC, others may have a workaround, e.g. Bionic,
https://cs.android.com/android/platform/superproject/+/master:bionic/libc/bionic/pthread_exit.cpp;l=149
see signals blocked above.

Diff Detail

Event Timeline

vitalybuka created this revision.May 11 2023, 2:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2023, 2:30 PM
Herald added a subscriber: Enna1. · View Herald Transcript
vitalybuka requested review of this revision.May 11 2023, 2:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2023, 2:30 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka edited the summary of this revision. (Show Details)May 11 2023, 2:33 PM

I do not understand the bionic issue. __hwasan_thread_exit is called very late (as the last thing in that function), while the signals are blocked. Why do thread cleanup functions matter?

vitalybuka edited the summary of this revision. (Show Details)May 11 2023, 3:22 PM

I do not understand the bionic issue. __hwasan_thread_exit is called very late (as the last thing in that function), while the signals are blocked. Why do thread cleanup functions matter?

fixed

eugenis accepted this revision.May 11 2023, 3:55 PM

LGTM

This revision is now accepted and ready to land.May 11 2023, 3:55 PM
This revision was automatically updated to reflect the committed changes.