This is an archive of the discontinued LLVM Phabricator instance.

DataFlowSanitizer: wrappers of functions with local linkage should have the same linkage as the function being wrapped
ClosedPublic

Authored by skerner on Mar 22 2018, 8:53 AM.

Details

Summary

This patch resolves link errors when the address of a static function is taken, and that function is uninstrumented by DFSan.

This change resolves bug 36314.

Diff Detail

Event Timeline

skerner created this revision.Mar 22 2018, 8:53 AM
skerner updated this revision to Diff 139451.Mar 22 2018, 8:55 AM

Revert a file which was mistakenly included.

skerner edited the summary of this revision. (Show Details)Mar 22 2018, 8:58 AM
skerner added a reviewer: pcc.
pcc added a comment.Mar 22 2018, 10:22 AM

It seems like a better fix would be to give the dfsw$ function internal linkage if the wrapped function has internal linkage. That way, if two translation units have static uninstrumented functions with the same name, the references to the dfsw$ functions will be correct.

skerner updated this revision to Diff 139610.Mar 23 2018, 10:37 AM

Address review comment: Wrappers of local functions should have the same linkage as the function being wrapped.

skerner retitled this revision from DataFlowSanitizer: do not allow wrapper functions with non-local linkage to have dso_local set. to DataFlowSanitizer: wrappers of functions with local linkage should have the same linkage as the function being wrapped.Mar 23 2018, 10:40 AM
In D44784#1045790, @pcc wrote:

It seems like a better fix would be to give the dfsw$ function internal linkage if the wrapped function has internal linkage. That way, if two translation units have static uninstrumented functions with the same name, the references to the dfsw$ functions will be correct.

Good point. Done.

Peter, friendly ping.

pcc accepted this revision.Mar 30 2018, 11:30 AM

LGTM

I will commit.

This revision is now accepted and ready to land.Mar 30 2018, 11:30 AM
This revision was automatically updated to reflect the committed changes.