[PATCH] D81251: [AArch64] Add BTI to CFI jumptables.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 17:12:47 PDT 2020


eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/IPO/LowerTypeTests.cpp:1233
+  } else if (JumpTableArch == Triple::aarch64) {
+    if (Dest->getParent()->getModuleFlag("branch-target-enforcement"))
+      AsmOS << "hint #34\n"; // BTI C
----------------
danielkiss wrote:
> eugenis wrote:
> > Do we need to check the function attribute here as well? What happens if a function opts out of BTI?
> No, direct jump does not need a landing pad. So this jump will be fine even that target function opted out.
> 
What I meant is, if a function has ignore-branch-target-enforcement, do not we want to skip the BTI hint in that function's CFI stub?
Or, rather, replace it with NOP to preserve the stub size.

Thinking about it some more - no, probably not. The attribute can be used on a "naked" function that already has BTI in the assembly; in that case we'd need BTI in the jump table as well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81251/new/

https://reviews.llvm.org/D81251





More information about the llvm-commits mailing list