Page MenuHomePhabricator

[CFGuard] Add address-taken IAT tables and delay-load support
Needs ReviewPublic

Authored by ajpaverd on Fri, Sep 11, 12:41 PM.

Details

Summary

This patch adds support for creating Guard Address-Taken IAT Entry Tables (.giats$y sections) in object files, matching the behavior of MSVC. These contain lists of address-taken imported functions, which are used by the linker to create the final GIATS table.
Additionally, if any DLLs are delay-loaded, the linker must look through the .giats tables and add the respective load thunks of address-taken imports to the GFIDS table, as these are also valid call targets.

Diff Detail

Event Timeline

ajpaverd created this revision.Fri, Sep 11, 12:41 PM
ajpaverd requested review of this revision.Fri, Sep 11, 12:41 PM
rnk added a reviewer: hans.Wed, Sep 16, 12:54 PM
rnk added inline comments.Wed, Sep 16, 1:57 PM
lld/COFF/Writer.cpp
1683

Can we set either ProtectDelayLoadIAT or DelayLoadIATSection now, or does that take more work?

1762

These two methods are essentially the same up until here. Your version seems more general. Can you rewrite markSymbolsForRVATable in terms of this utility? This code shouldn't be hot, I don't think we need to worry about the cost of an extra temporary vector of address-taken symbols.

dmajor added a subscriber: dmajor.Tue, Sep 22, 1:15 PM