[PATCH] D41723: Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre..

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 15:04:34 PST 2018

efriedma added inline comments.

Comment at: llvm/lib/CodeGen/IndirectBrExpandPass.cpp:113
+      // index.
+      if (BBIndex == -1) {
+        BBIndex = BBs.size();
chandlerc wrote:
> efriedma wrote:
> > blockaddresses are uniqued, so no block should ever have more than one blockaddress user.  So this should probably be an assertion.
> I just didn't want to hard code that assumption, but I can if you prefer.
If we violate that assumption, something has gone very wrong (either we've created a blockaddress in the wrong context, or we leaked a blockaddress from the context, or we have a blockaddress with an invalid block+function pair).

Although, on a related note, you might want to check Constant::isConstantUsed(), so we don't generate indexes for blockaddresses which aren't actually referenced anywhere.


More information about the llvm-commits mailing list