Lines Matching full:shadow

24 /// Each byte of application memory is backed by a shadow memory byte. The
25 /// shadow byte can represent up to 8 labels. On Linux/x86_64, memory is then
37 /// | shadow 1 |
43 /// | shadow 3 |
49 /// | shadow 2 |
55 /// SHADOW_TO_ORIGIN(shadow) = shadow + 0x100000000000
135 // the shadow load to have alignment 16. This flag is disabled by default as
143 // The ABI list files control how shadow parameters are passed. The pass treats
156 // will make all shadow and return values set zero labels.
277 // Memory map parameters used in application-to-shadow address calculation.
279 // Shadow = ShadowBase + Offset
444 /// extra pointer argument to return the shadow. This allows the wrapped
455 /// The shadow type for all primitive types and vector types.
515 /// to shadow addresses and origin addresses.
551 /// Returns a zero constant with the shadow type of OrigTy.
557 /// Returns a zero constant with the shadow type of V's type.
560 /// Checks if V is a zero shadow.
563 /// Returns the shadow type of OrigTy.
569 /// Returns the shadow type of V's type.
606 BasicBlock *Block; // The block where Shadow is defined.
607 Value *Shadow; member
609 /// Maps a value to its latest shadow value in terms of domination tree.
611 /// Maps a value to its latest collapsed shadow value it was converted to in
625 /// Computes the shadow address for a given function argument.
627 /// Shadow = ArgTLS+ArgOffset.
630 /// Computes the shadow address for a return value.
656 void setShadow(Instruction *I, Value *Shadow);
660 /// Combines the shadow values of V1 and V2, then converts the combined value
661 /// with primitive type into a shadow value with the original type T.
666 /// Generates IR to load shadow and origin corresponding to bytes [\p
669 /// shadow always has primitive type.
672 /// current stack if the returned shadow is tainted.
681 /// the expanded shadow value.
688 /// Collapses Shadow into a single primitive shadow value, unioning all
689 /// primitive shadow values in the process. Returns the final primitive
690 /// shadow value.
695 Value *collapseToPrimitiveShadow(Value *Shadow, BasicBlock::iterator Pos);
714 /// Collapses the shadow with aggregate type into a single primitive shadow
717 Value *collapseAggregateShadow(AggregateType *AT, Value *Shadow,
720 Value *collapseToPrimitiveShadow(Value *Shadow, IRBuilder<> &IRB);
722 /// Returns the shadow value of an argument A.
747 /// Returns a chain at the current stack with previous origin V if Shadow is
749 Value *updateOriginIfTainted(Value *Shadow, Value *Origin, IRBuilder<> &IRB);
760 /// Stores Origin in terms of its Shadow value.
766 Value *Shadow, Value *Origin, Value *StoreOriginAddr,
774 /// Generates IR to load shadow and origin corresponding to bytes [\p
777 /// shadow always has primitive type.
795 // Combines shadow values and origins for all of I's operands.
949 Value *Shadow, SmallVector<unsigned, 4> &Indices, Type *SubShadowTy, in expandFromPrimitiveShadowRecursive() argument
952 return IRB.CreateInsertValue(Shadow, PrimitiveShadow, Indices); in expandFromPrimitiveShadowRecursive()
957 Shadow = expandFromPrimitiveShadowRecursive( in expandFromPrimitiveShadowRecursive()
958 Shadow, Indices, AT->getElementType(), PrimitiveShadow, IRB); in expandFromPrimitiveShadowRecursive()
961 return Shadow; in expandFromPrimitiveShadowRecursive()
967 Shadow = expandFromPrimitiveShadowRecursive( in expandFromPrimitiveShadowRecursive()
968 Shadow, Indices, ST->getElementType(Idx), PrimitiveShadow, IRB); in expandFromPrimitiveShadowRecursive()
971 return Shadow; in expandFromPrimitiveShadowRecursive()
973 llvm_unreachable("Unexpected shadow type"); in expandFromPrimitiveShadowRecursive()
993 Value *Shadow = UndefValue::get(ShadowTy); in expandFromPrimitiveShadow() local
994 Shadow = expandFromPrimitiveShadowRecursive(Shadow, Indices, ShadowTy, in expandFromPrimitiveShadow()
997 // Caches the primitive shadow value that built the shadow value. in expandFromPrimitiveShadow()
998 CachedCollapsedShadows[Shadow] = PrimitiveShadow; in expandFromPrimitiveShadow()
999 return Shadow; in expandFromPrimitiveShadow()
1003 Value *DFSanFunction::collapseAggregateShadow(AggregateType *AT, Value *Shadow, in collapseAggregateShadow() argument
1008 Value *FirstItem = IRB.CreateExtractValue(Shadow, 0); in collapseAggregateShadow()
1012 Value *ShadowItem = IRB.CreateExtractValue(Shadow, Idx); in collapseAggregateShadow()
1019 Value *DFSanFunction::collapseToPrimitiveShadow(Value *Shadow, in collapseToPrimitiveShadow() argument
1021 Type *ShadowTy = Shadow->getType(); in collapseToPrimitiveShadow()
1023 return Shadow; in collapseToPrimitiveShadow()
1025 return collapseAggregateShadow<>(AT, Shadow, IRB); in collapseToPrimitiveShadow()
1027 return collapseAggregateShadow<>(ST, Shadow, IRB); in collapseToPrimitiveShadow()
1028 llvm_unreachable("Unexpected shadow type"); in collapseToPrimitiveShadow()
1031 Value *DFSanFunction::collapseToPrimitiveShadow(Value *Shadow, in collapseToPrimitiveShadow() argument
1033 Type *ShadowTy = Shadow->getType(); in collapseToPrimitiveShadow()
1035 return Shadow; in collapseToPrimitiveShadow()
1037 // Checks if the cached collapsed shadow value dominates Pos. in collapseToPrimitiveShadow()
1038 Value *&CS = CachedCollapsedShadows[Shadow]; in collapseToPrimitiveShadow()
1043 Value *PrimitiveShadow = collapseToPrimitiveShadow(Shadow, IRB); in collapseToPrimitiveShadow()
1044 // Caches the converted primitive shadow value. in collapseToPrimitiveShadow()
1713 // Ensure IRB insertion point is after loads for shadow and origin. in runImpl()
1747 // We will not necessarily be able to compute the shadow for every phi node in runImpl()
1858 break; // ArgTLS overflows, uses a zero shadow. in getShadowForTLSArgument()
1863 break; // ArgTLS overflows, uses a zero shadow. in getShadowForTLSArgument()
1880 Value *&Shadow = ValShadowMap[V]; in getShadow() local
1881 if (!Shadow) { in getShadow()
1885 Shadow = getShadowForTLSArgument(A); in getShadow()
1886 NonZeroChecks.push_back(Shadow); in getShadow()
1888 Shadow = DFS.getZeroShadow(V); in getShadow()
1891 return Shadow; in getShadow()
1894 void DFSanFunction::setShadow(Instruction *I, Value *Shadow) { in setShadow() argument
1896 ValShadowMap[I] = Shadow; in setShadow()
1899 /// Compute the integer shadow offset that corresponds to a given
2007 return CCS.Shadow; in combineShadows()
2015 CCS.Shadow = IRB.CreateOr(PV1, PV2); in combineShadows()
2028 ShadowElements[CCS.Shadow] = std::move(UnionElems); in combineShadows()
2030 return CCS.Shadow; in combineShadows()
2040 Value *Shadow = getShadow(Inst->getOperand(0)); in combineOperandShadows() local
2042 Shadow = combineShadows(Shadow, getShadow(Inst->getOperand(I)), in combineOperandShadows()
2045 return expandFromPrimitiveShadow(Inst->getType(), Shadow, in combineOperandShadows()
2168 // Specifically, when the shadow size in bytes (i.e., loaded bytes x shadow in loadShadowFast()
2173 // For the second case, we can fit the wide shadow in a 32-bit integer. In all in loadShadowFast()
2174 // other cases, we use a 64-bit integer to hold the wide shadow. in loadShadowFast()
2188 // The wide shadow relates to two origin pointers: one for the first four in loadShadowFast()
2190 // get just the shadow bytes that correspond to the first origin pointer, in loadShadowFast()
2191 // and then the entire shadow for the second origin pointer (which will be in loadShadowFast()
2193 // shadow was empty but the other half was not). in loadShadowFast()
2210 // First OR all the WideShadows (i.e., 64bit or 32bit shadow chunks) linearly; in loadShadowFast()
2214 // shadow). in loadShadowFast()
2305 // When the byte size is small enough, we can load the shadow directly with in loadShadowOriginSansLoadTracking()
2405 // shadow data after application data; store zero shadow data before in visitLoadInst()
2406 // application data. This ensure shadow loads return either labels of the in visitLoadInst()
2439 Value *Shadow = in visitLoadInst() local
2441 DFSF.setShadow(&LI, Shadow); in visitLoadInst()
2459 Value *DFSanFunction::updateOriginIfTainted(Value *Shadow, Value *Origin, in updateOriginIfTainted() argument
2462 return IRB.CreateCall(DFS.DFSanChainOriginIfTaintedFn, {Shadow, Origin}); in updateOriginIfTainted()
2528 uint64_t Size, Value *Shadow, Value *Origin, in storeOrigin() argument
2533 Value *CollapsedShadow = collapseToPrimitiveShadow(Shadow, Pos); in storeOrigin()
2608 "Shadow vector is too large!"); in storePrimitiveShadowOrigin()
2670 // shadow data after application data; store zero shadow data before in visitStoreInst()
2671 // application data. This ensure shadow loads return either labels of the in visitStoreInst()
2681 Value *Shadow = in visitStoreInst() local
2685 Shadows.push_back(Shadow); in visitStoreInst()
2696 PrimitiveShadow = DFSF.combineShadows(Shadow, PtrShadow, SI.getIterator()); in visitStoreInst()
2698 PrimitiveShadow = DFSF.collapseToPrimitiveShadow(Shadow, SI.getIterator()); in visitStoreInst()
2723 // Conservatively set data at stored addresses and return with zero shadow to in visitCASOrRMW()
2724 // prevent shadow data races. in visitCASOrRMW()
2784 // This memory will have a shadow, so with the loads and stores we will be in visitLandingPadInst()
2802 // Only propagate shadow/origin of base pointer value but ignore those of in visitGetElementPtrInst()
3034 // Adds the return value shadow. in addShadowArguments()
3137 // Adds shadow arguments. in visitWrappedCallBase()
3155 // zero extend the shadow parameters. This is required for targets in visitWrappedCallBase()
3170 // Loads the return value shadow and origin. in visitWrappedCallBase()
3218 // the shadow operations aren't reordered before it. in visitLibAtomicLoad()
3258 // the shadow operations aren't reordered after it. in visitLibAtomicStore()
3280 // This operation is not atomic for the shadow and origin memory. in visitLibAtomicExchange()
3304 // This operation is not atomic for the shadow and origin memory. in visitLibAtomicCompareExchange()
3395 // after overflow have zero shadow values. in visitCallBase()
3423 // Loads the return value shadow. in visitCallBase()
3427 // Set overflowed return shadow to be zero. in visitCallBase()
3454 // Give the shadow phi node valid predecessors to fool SplitEdge into working. in visitPHINode()