StackProtector.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. //===- StackProtector.cpp - Stack Protector Insertion ---------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This pass inserts stack protectors into functions which need them. A variable
  10. // with a random value in it is stored onto the stack before the local variables
  11. // are allocated. Upon exiting the block, the stored value is checked. If it's
  12. // changed, then there was some sort of violation and the program aborts.
  13. //
  14. //===----------------------------------------------------------------------===//
  15. #include "llvm/CodeGen/StackProtector.h"
  16. #include "llvm/ADT/SmallPtrSet.h"
  17. #include "llvm/ADT/Statistic.h"
  18. #include "llvm/Analysis/BranchProbabilityInfo.h"
  19. #include "llvm/Analysis/EHPersonalities.h"
  20. #include "llvm/Analysis/OptimizationRemarkEmitter.h"
  21. #include "llvm/CodeGen/Passes.h"
  22. #include "llvm/CodeGen/TargetLowering.h"
  23. #include "llvm/CodeGen/TargetPassConfig.h"
  24. #include "llvm/CodeGen/TargetSubtargetInfo.h"
  25. #include "llvm/IR/Attributes.h"
  26. #include "llvm/IR/BasicBlock.h"
  27. #include "llvm/IR/Constants.h"
  28. #include "llvm/IR/DataLayout.h"
  29. #include "llvm/IR/DebugInfo.h"
  30. #include "llvm/IR/DebugLoc.h"
  31. #include "llvm/IR/DerivedTypes.h"
  32. #include "llvm/IR/Dominators.h"
  33. #include "llvm/IR/Function.h"
  34. #include "llvm/IR/IRBuilder.h"
  35. #include "llvm/IR/Instruction.h"
  36. #include "llvm/IR/Instructions.h"
  37. #include "llvm/IR/IntrinsicInst.h"
  38. #include "llvm/IR/Intrinsics.h"
  39. #include "llvm/IR/MDBuilder.h"
  40. #include "llvm/IR/Module.h"
  41. #include "llvm/IR/Type.h"
  42. #include "llvm/IR/User.h"
  43. #include "llvm/Pass.h"
  44. #include "llvm/Support/Casting.h"
  45. #include "llvm/Support/CommandLine.h"
  46. #include "llvm/Target/TargetMachine.h"
  47. #include "llvm/Target/TargetOptions.h"
  48. #include <utility>
  49. using namespace llvm;
  50. #define DEBUG_TYPE "stack-protector"
  51. STATISTIC(NumFunProtected, "Number of functions protected");
  52. STATISTIC(NumAddrTaken, "Number of local variables that have their address"
  53. " taken.");
  54. static cl::opt<bool> EnableSelectionDAGSP("enable-selectiondag-sp",
  55. cl::init(true), cl::Hidden);
  56. char StackProtector::ID = 0;
  57. INITIALIZE_PASS_BEGIN(StackProtector, DEBUG_TYPE,
  58. "Insert stack protectors", false, true)
  59. INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
  60. INITIALIZE_PASS_END(StackProtector, DEBUG_TYPE,
  61. "Insert stack protectors", false, true)
  62. FunctionPass *llvm::createStackProtectorPass() { return new StackProtector(); }
  63. void StackProtector::getAnalysisUsage(AnalysisUsage &AU) const {
  64. AU.addRequired<TargetPassConfig>();
  65. AU.addPreserved<DominatorTreeWrapperPass>();
  66. }
  67. bool StackProtector::runOnFunction(Function &Fn) {
  68. F = &Fn;
  69. M = F->getParent();
  70. DominatorTreeWrapperPass *DTWP =
  71. getAnalysisIfAvailable<DominatorTreeWrapperPass>();
  72. DT = DTWP ? &DTWP->getDomTree() : nullptr;
  73. TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
  74. Trip = TM->getTargetTriple();
  75. TLI = TM->getSubtargetImpl(Fn)->getTargetLowering();
  76. HasPrologue = false;
  77. HasIRCheck = false;
  78. Attribute Attr = Fn.getFnAttribute("stack-protector-buffer-size");
  79. if (Attr.isStringAttribute() &&
  80. Attr.getValueAsString().getAsInteger(10, SSPBufferSize))
  81. return false; // Invalid integer string
  82. if (!RequiresStackProtector())
  83. return false;
  84. // TODO(etienneb): Functions with funclets are not correctly supported now.
  85. // Do nothing if this is funclet-based personality.
  86. if (Fn.hasPersonalityFn()) {
  87. EHPersonality Personality = classifyEHPersonality(Fn.getPersonalityFn());
  88. if (isFuncletEHPersonality(Personality))
  89. return false;
  90. }
  91. ++NumFunProtected;
  92. return InsertStackProtectors();
  93. }
  94. /// \param [out] IsLarge is set to true if a protectable array is found and
  95. /// it is "large" ( >= ssp-buffer-size). In the case of a structure with
  96. /// multiple arrays, this gets set if any of them is large.
  97. bool StackProtector::ContainsProtectableArray(Type *Ty, bool &IsLarge,
  98. bool Strong,
  99. bool InStruct) const {
  100. if (!Ty)
  101. return false;
  102. if (ArrayType *AT = dyn_cast<ArrayType>(Ty)) {
  103. if (!AT->getElementType()->isIntegerTy(8)) {
  104. // If we're on a non-Darwin platform or we're inside of a structure, don't
  105. // add stack protectors unless the array is a character array.
  106. // However, in strong mode any array, regardless of type and size,
  107. // triggers a protector.
  108. if (!Strong && (InStruct || !Trip.isOSDarwin()))
  109. return false;
  110. }
  111. // If an array has more than SSPBufferSize bytes of allocated space, then we
  112. // emit stack protectors.
  113. if (SSPBufferSize <= M->getDataLayout().getTypeAllocSize(AT)) {
  114. IsLarge = true;
  115. return true;
  116. }
  117. if (Strong)
  118. // Require a protector for all arrays in strong mode
  119. return true;
  120. }
  121. const StructType *ST = dyn_cast<StructType>(Ty);
  122. if (!ST)
  123. return false;
  124. bool NeedsProtector = false;
  125. for (StructType::element_iterator I = ST->element_begin(),
  126. E = ST->element_end();
  127. I != E; ++I)
  128. if (ContainsProtectableArray(*I, IsLarge, Strong, true)) {
  129. // If the element is a protectable array and is large (>= SSPBufferSize)
  130. // then we are done. If the protectable array is not large, then
  131. // keep looking in case a subsequent element is a large array.
  132. if (IsLarge)
  133. return true;
  134. NeedsProtector = true;
  135. }
  136. return NeedsProtector;
  137. }
  138. bool StackProtector::HasAddressTaken(const Instruction *AI) {
  139. for (const User *U : AI->users()) {
  140. if (const StoreInst *SI = dyn_cast<StoreInst>(U)) {
  141. if (AI == SI->getValueOperand())
  142. return true;
  143. } else if (const PtrToIntInst *SI = dyn_cast<PtrToIntInst>(U)) {
  144. if (AI == SI->getOperand(0))
  145. return true;
  146. } else if (const CallInst *CI = dyn_cast<CallInst>(U)) {
  147. // Ignore intrinsics that are not calls. TODO: Use isLoweredToCall().
  148. if (!isa<DbgInfoIntrinsic>(CI) && !CI->isLifetimeStartOrEnd())
  149. return true;
  150. } else if (isa<InvokeInst>(U)) {
  151. return true;
  152. } else if (const SelectInst *SI = dyn_cast<SelectInst>(U)) {
  153. if (HasAddressTaken(SI))
  154. return true;
  155. } else if (const PHINode *PN = dyn_cast<PHINode>(U)) {
  156. // Keep track of what PHI nodes we have already visited to ensure
  157. // they are only visited once.
  158. if (VisitedPHIs.insert(PN).second)
  159. if (HasAddressTaken(PN))
  160. return true;
  161. } else if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) {
  162. if (HasAddressTaken(GEP))
  163. return true;
  164. } else if (const BitCastInst *BI = dyn_cast<BitCastInst>(U)) {
  165. if (HasAddressTaken(BI))
  166. return true;
  167. }
  168. }
  169. return false;
  170. }
  171. /// Search for the first call to the llvm.stackprotector intrinsic and return it
  172. /// if present.
  173. static const CallInst *findStackProtectorIntrinsic(Function &F) {
  174. for (const BasicBlock &BB : F)
  175. for (const Instruction &I : BB)
  176. if (const CallInst *CI = dyn_cast<CallInst>(&I))
  177. if (CI->getCalledFunction() ==
  178. Intrinsic::getDeclaration(F.getParent(), Intrinsic::stackprotector))
  179. return CI;
  180. return nullptr;
  181. }
  182. /// Check whether or not this function needs a stack protector based
  183. /// upon the stack protector level.
  184. ///
  185. /// We use two heuristics: a standard (ssp) and strong (sspstrong).
  186. /// The standard heuristic which will add a guard variable to functions that
  187. /// call alloca with a either a variable size or a size >= SSPBufferSize,
  188. /// functions with character buffers larger than SSPBufferSize, and functions
  189. /// with aggregates containing character buffers larger than SSPBufferSize. The
  190. /// strong heuristic will add a guard variables to functions that call alloca
  191. /// regardless of size, functions with any buffer regardless of type and size,
  192. /// functions with aggregates that contain any buffer regardless of type and
  193. /// size, and functions that contain stack-based variables that have had their
  194. /// address taken.
  195. bool StackProtector::RequiresStackProtector() {
  196. bool Strong = false;
  197. bool NeedsProtector = false;
  198. HasPrologue = findStackProtectorIntrinsic(*F);
  199. if (F->hasFnAttribute(Attribute::SafeStack))
  200. return false;
  201. // We are constructing the OptimizationRemarkEmitter on the fly rather than
  202. // using the analysis pass to avoid building DominatorTree and LoopInfo which
  203. // are not available this late in the IR pipeline.
  204. OptimizationRemarkEmitter ORE(F);
  205. if (F->hasFnAttribute(Attribute::StackProtectReq)) {
  206. ORE.emit([&]() {
  207. return OptimizationRemark(DEBUG_TYPE, "StackProtectorRequested", F)
  208. << "Stack protection applied to function "
  209. << ore::NV("Function", F)
  210. << " due to a function attribute or command-line switch";
  211. });
  212. NeedsProtector = true;
  213. Strong = true; // Use the same heuristic as strong to determine SSPLayout
  214. } else if (F->hasFnAttribute(Attribute::StackProtectStrong))
  215. Strong = true;
  216. else if (HasPrologue)
  217. NeedsProtector = true;
  218. else if (!F->hasFnAttribute(Attribute::StackProtect))
  219. return false;
  220. for (const BasicBlock &BB : *F) {
  221. for (const Instruction &I : BB) {
  222. if (const AllocaInst *AI = dyn_cast<AllocaInst>(&I)) {
  223. if (AI->isArrayAllocation()) {
  224. auto RemarkBuilder = [&]() {
  225. return OptimizationRemark(DEBUG_TYPE, "StackProtectorAllocaOrArray",
  226. &I)
  227. << "Stack protection applied to function "
  228. << ore::NV("Function", F)
  229. << " due to a call to alloca or use of a variable length "
  230. "array";
  231. };
  232. if (const auto *CI = dyn_cast<ConstantInt>(AI->getArraySize())) {
  233. if (CI->getLimitedValue(SSPBufferSize) >= SSPBufferSize) {
  234. // A call to alloca with size >= SSPBufferSize requires
  235. // stack protectors.
  236. Layout.insert(std::make_pair(AI,
  237. MachineFrameInfo::SSPLK_LargeArray));
  238. ORE.emit(RemarkBuilder);
  239. NeedsProtector = true;
  240. } else if (Strong) {
  241. // Require protectors for all alloca calls in strong mode.
  242. Layout.insert(std::make_pair(AI,
  243. MachineFrameInfo::SSPLK_SmallArray));
  244. ORE.emit(RemarkBuilder);
  245. NeedsProtector = true;
  246. }
  247. } else {
  248. // A call to alloca with a variable size requires protectors.
  249. Layout.insert(std::make_pair(AI,
  250. MachineFrameInfo::SSPLK_LargeArray));
  251. ORE.emit(RemarkBuilder);
  252. NeedsProtector = true;
  253. }
  254. continue;
  255. }
  256. bool IsLarge = false;
  257. if (ContainsProtectableArray(AI->getAllocatedType(), IsLarge, Strong)) {
  258. Layout.insert(std::make_pair(AI, IsLarge
  259. ? MachineFrameInfo::SSPLK_LargeArray
  260. : MachineFrameInfo::SSPLK_SmallArray));
  261. ORE.emit([&]() {
  262. return OptimizationRemark(DEBUG_TYPE, "StackProtectorBuffer", &I)
  263. << "Stack protection applied to function "
  264. << ore::NV("Function", F)
  265. << " due to a stack allocated buffer or struct containing a "
  266. "buffer";
  267. });
  268. NeedsProtector = true;
  269. continue;
  270. }
  271. if (Strong && HasAddressTaken(AI)) {
  272. ++NumAddrTaken;
  273. Layout.insert(std::make_pair(AI, MachineFrameInfo::SSPLK_AddrOf));
  274. ORE.emit([&]() {
  275. return OptimizationRemark(DEBUG_TYPE, "StackProtectorAddressTaken",
  276. &I)
  277. << "Stack protection applied to function "
  278. << ore::NV("Function", F)
  279. << " due to the address of a local variable being taken";
  280. });
  281. NeedsProtector = true;
  282. }
  283. }
  284. }
  285. }
  286. return NeedsProtector;
  287. }
  288. /// Create a stack guard loading and populate whether SelectionDAG SSP is
  289. /// supported.
  290. static Value *getStackGuard(const TargetLoweringBase *TLI, Module *M,
  291. IRBuilder<> &B,
  292. bool *SupportsSelectionDAGSP = nullptr) {
  293. if (Value *Guard = TLI->getIRStackGuard(B))
  294. return B.CreateLoad(Guard, true, "StackGuard");
  295. // Use SelectionDAG SSP handling, since there isn't an IR guard.
  296. //
  297. // This is more or less weird, since we optionally output whether we
  298. // should perform a SelectionDAG SP here. The reason is that it's strictly
  299. // defined as !TLI->getIRStackGuard(B), where getIRStackGuard is also
  300. // mutating. There is no way to get this bit without mutating the IR, so
  301. // getting this bit has to happen in this right time.
  302. //
  303. // We could have define a new function TLI::supportsSelectionDAGSP(), but that
  304. // will put more burden on the backends' overriding work, especially when it
  305. // actually conveys the same information getIRStackGuard() already gives.
  306. if (SupportsSelectionDAGSP)
  307. *SupportsSelectionDAGSP = true;
  308. TLI->insertSSPDeclarations(*M);
  309. return B.CreateCall(Intrinsic::getDeclaration(M, Intrinsic::stackguard));
  310. }
  311. /// Insert code into the entry block that stores the stack guard
  312. /// variable onto the stack:
  313. ///
  314. /// entry:
  315. /// StackGuardSlot = alloca i8*
  316. /// StackGuard = <stack guard>
  317. /// call void @llvm.stackprotector(StackGuard, StackGuardSlot)
  318. ///
  319. /// Returns true if the platform/triple supports the stackprotectorcreate pseudo
  320. /// node.
  321. static bool CreatePrologue(Function *F, Module *M, ReturnInst *RI,
  322. const TargetLoweringBase *TLI, AllocaInst *&AI) {
  323. bool SupportsSelectionDAGSP = false;
  324. IRBuilder<> B(&F->getEntryBlock().front());
  325. PointerType *PtrTy = Type::getInt8PtrTy(RI->getContext());
  326. AI = B.CreateAlloca(PtrTy, nullptr, "StackGuardSlot");
  327. Value *GuardSlot = getStackGuard(TLI, M, B, &SupportsSelectionDAGSP);
  328. B.CreateCall(Intrinsic::getDeclaration(M, Intrinsic::stackprotector),
  329. {GuardSlot, AI});
  330. return SupportsSelectionDAGSP;
  331. }
  332. /// InsertStackProtectors - Insert code into the prologue and epilogue of the
  333. /// function.
  334. ///
  335. /// - The prologue code loads and stores the stack guard onto the stack.
  336. /// - The epilogue checks the value stored in the prologue against the original
  337. /// value. It calls __stack_chk_fail if they differ.
  338. bool StackProtector::InsertStackProtectors() {
  339. // If the target wants to XOR the frame pointer into the guard value, it's
  340. // impossible to emit the check in IR, so the target *must* support stack
  341. // protection in SDAG.
  342. bool SupportsSelectionDAGSP =
  343. TLI->useStackGuardXorFP() ||
  344. (EnableSelectionDAGSP && !TM->Options.EnableFastISel &&
  345. !TM->Options.EnableGlobalISel);
  346. AllocaInst *AI = nullptr; // Place on stack that stores the stack guard.
  347. for (Function::iterator I = F->begin(), E = F->end(); I != E;) {
  348. BasicBlock *BB = &*I++;
  349. ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator());
  350. if (!RI)
  351. continue;
  352. // Generate prologue instrumentation if not already generated.
  353. if (!HasPrologue) {
  354. HasPrologue = true;
  355. SupportsSelectionDAGSP &= CreatePrologue(F, M, RI, TLI, AI);
  356. }
  357. // SelectionDAG based code generation. Nothing else needs to be done here.
  358. // The epilogue instrumentation is postponed to SelectionDAG.
  359. if (SupportsSelectionDAGSP)
  360. break;
  361. // Find the stack guard slot if the prologue was not created by this pass
  362. // itself via a previous call to CreatePrologue().
  363. if (!AI) {
  364. const CallInst *SPCall = findStackProtectorIntrinsic(*F);
  365. assert(SPCall && "Call to llvm.stackprotector is missing");
  366. AI = cast<AllocaInst>(SPCall->getArgOperand(1));
  367. }
  368. // Set HasIRCheck to true, so that SelectionDAG will not generate its own
  369. // version. SelectionDAG called 'shouldEmitSDCheck' to check whether
  370. // instrumentation has already been generated.
  371. HasIRCheck = true;
  372. // Generate epilogue instrumentation. The epilogue intrumentation can be
  373. // function-based or inlined depending on which mechanism the target is
  374. // providing.
  375. if (Value* GuardCheck = TLI->getSSPStackGuardCheck(*M)) {
  376. // Generate the function-based epilogue instrumentation.
  377. // The target provides a guard check function, generate a call to it.
  378. IRBuilder<> B(RI);
  379. LoadInst *Guard = B.CreateLoad(AI, true, "Guard");
  380. CallInst *Call = B.CreateCall(GuardCheck, {Guard});
  381. llvm::Function *Function = cast<llvm::Function>(GuardCheck);
  382. Call->setAttributes(Function->getAttributes());
  383. Call->setCallingConv(Function->getCallingConv());
  384. } else {
  385. // Generate the epilogue with inline instrumentation.
  386. // If we do not support SelectionDAG based tail calls, generate IR level
  387. // tail calls.
  388. //
  389. // For each block with a return instruction, convert this:
  390. //
  391. // return:
  392. // ...
  393. // ret ...
  394. //
  395. // into this:
  396. //
  397. // return:
  398. // ...
  399. // %1 = <stack guard>
  400. // %2 = load StackGuardSlot
  401. // %3 = cmp i1 %1, %2
  402. // br i1 %3, label %SP_return, label %CallStackCheckFailBlk
  403. //
  404. // SP_return:
  405. // ret ...
  406. //
  407. // CallStackCheckFailBlk:
  408. // call void @__stack_chk_fail()
  409. // unreachable
  410. // Create the FailBB. We duplicate the BB every time since the MI tail
  411. // merge pass will merge together all of the various BB into one including
  412. // fail BB generated by the stack protector pseudo instruction.
  413. BasicBlock *FailBB = CreateFailBB();
  414. // Split the basic block before the return instruction.
  415. BasicBlock *NewBB = BB->splitBasicBlock(RI->getIterator(), "SP_return");
  416. // Update the dominator tree if we need to.
  417. if (DT && DT->isReachableFromEntry(BB)) {
  418. DT->addNewBlock(NewBB, BB);
  419. DT->addNewBlock(FailBB, BB);
  420. }
  421. // Remove default branch instruction to the new BB.
  422. BB->getTerminator()->eraseFromParent();
  423. // Move the newly created basic block to the point right after the old
  424. // basic block so that it's in the "fall through" position.
  425. NewBB->moveAfter(BB);
  426. // Generate the stack protector instructions in the old basic block.
  427. IRBuilder<> B(BB);
  428. Value *Guard = getStackGuard(TLI, M, B);
  429. LoadInst *LI2 = B.CreateLoad(AI, true);
  430. Value *Cmp = B.CreateICmpEQ(Guard, LI2);
  431. auto SuccessProb =
  432. BranchProbabilityInfo::getBranchProbStackProtector(true);
  433. auto FailureProb =
  434. BranchProbabilityInfo::getBranchProbStackProtector(false);
  435. MDNode *Weights = MDBuilder(F->getContext())
  436. .createBranchWeights(SuccessProb.getNumerator(),
  437. FailureProb.getNumerator());
  438. B.CreateCondBr(Cmp, NewBB, FailBB, Weights);
  439. }
  440. }
  441. // Return if we didn't modify any basic blocks. i.e., there are no return
  442. // statements in the function.
  443. return HasPrologue;
  444. }
  445. /// CreateFailBB - Create a basic block to jump to when the stack protector
  446. /// check fails.
  447. BasicBlock *StackProtector::CreateFailBB() {
  448. LLVMContext &Context = F->getContext();
  449. BasicBlock *FailBB = BasicBlock::Create(Context, "CallStackCheckFailBlk", F);
  450. IRBuilder<> B(FailBB);
  451. B.SetCurrentDebugLocation(DebugLoc::get(0, 0, F->getSubprogram()));
  452. if (Trip.isOSOpenBSD()) {
  453. FunctionCallee StackChkFail = M->getOrInsertFunction(
  454. "__stack_smash_handler", Type::getVoidTy(Context),
  455. Type::getInt8PtrTy(Context));
  456. B.CreateCall(StackChkFail, B.CreateGlobalStringPtr(F->getName(), "SSH"));
  457. } else {
  458. FunctionCallee StackChkFail =
  459. M->getOrInsertFunction("__stack_chk_fail", Type::getVoidTy(Context));
  460. B.CreateCall(StackChkFail, {});
  461. }
  462. B.CreateUnreachable();
  463. return FailBB;
  464. }
  465. bool StackProtector::shouldEmitSDCheck(const BasicBlock &BB) const {
  466. return HasPrologue && !HasIRCheck && dyn_cast<ReturnInst>(BB.getTerminator());
  467. }
  468. void StackProtector::copyToMachineFrameInfo(MachineFrameInfo &MFI) const {
  469. if (Layout.empty())
  470. return;
  471. for (int I = 0, E = MFI.getObjectIndexEnd(); I != E; ++I) {
  472. if (MFI.isDeadObjectIndex(I))
  473. continue;
  474. const AllocaInst *AI = MFI.getObjectAllocation(I);
  475. if (!AI)
  476. continue;
  477. SSPLayoutMap::const_iterator LI = Layout.find(AI);
  478. if (LI == Layout.end())
  479. continue;
  480. MFI.setObjectSSPLayout(I, LI->second);
  481. }
  482. }