OSDN Git Service

Reland [AArch64][MachineOutliner] Return address signing for outlined functions
authorDavid Tellenbach <david.tellenbach@me.com>
Thu, 5 Dec 2019 01:20:59 +0000 (02:20 +0100)
committerDavid Tellenbach <david.tellenbach@me.com>
Thu, 5 Dec 2019 01:20:59 +0000 (02:20 +0100)
commitcec2d5c17457722113580251c8a045fa9aca9b1b
tree1124f091c79eef1eb183e440c74caa6a815c93fc
parent28f5ad5801d408b35afc437fb3c430104ee3ce3e
Reland [AArch64][MachineOutliner] Return address signing for outlined functions

Summary:
Reland after fixing an ASan failure by stopping outlining early if the
constraints for return address signing removed too many outlining candidates.

During AArch64 frame lowering instructions to enable return address
signing are inserted into functions if needed. Functions generated during
machine outlining don't run through target frame lowering and hence are
missing such instructions.

This patch introduces the following changes:

1. If not all functions that potentially participate in function outlining agree
   on their return address signing scope and their return address signing key,
   outlining is disabled for these functions.
2. If not all functions that potentially participate in function outlining agree
   on their support for v8.3A features, outlining is disabled for these
   functions.
3. If an outlining candidate would outline instructions that modify sp in a way
   that invalidates return address signing, outlining is disabled for that
   particular candidate.
4. If all candidate functions agree on the signing scope, signing key and their
   support for v8.3 features, the outlined function behaves as if it had the
   same scope and key attributes and as if it would provide the same v8.3A
   support as the original functions.

Reviewers: ostannard, paquette

Reviewed By: ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70635
12 files changed:
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-cfi.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-diff-scope-same-key.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-non-leaf.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-regsave.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-same-scope-diff-key.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-same-scope-same-key-a.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-same-scope-same-key-b.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-sp-mod.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-subtarget.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-thunk.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-v8-3.ll [new file with mode: 0644]