This is an archive of the discontinued LLVM Phabricator instance.

[TSan][libdispatch] Avoid infinite recursion in dispatch_apply[_f] interceptors
ClosedPublic

Authored by yln on Mar 18 2019, 5:54 PM.

Details

Summary

In libdispatch, dispatch_apply is implemented in terms of
dispatch_apply_f. Unfortunately, this means that we can't implement the
interceptor for dispatch_apply_f by forwarding to the dispatch_apply
interceptor.

In the interceptor dispatch_apply_f, we can't use WRAP(dispatch_apply).
WRAP(dispatch_apply) -> REAL(dispatch_apply_f). Requires duplication of
some setup code.

Diff Detail

Event Timeline

yln created this revision.Mar 18 2019, 5:54 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 18 2019, 5:54 PM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript
kubamracek accepted this revision.Mar 19 2019, 6:50 AM

Looks good, thanks.

This revision is now accepted and ready to land.Mar 19 2019, 6:50 AM

Also, I assume this is already covered by a test?

yln added a comment.Mar 19 2019, 9:09 AM

Also, I assume this is already covered by a test?

On Linux, apply.c and apply-race.c fail without, but pass with this change.

This revision was automatically updated to reflect the committed changes.