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;
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,
952 return IRB.CreateInsertValue(Shadow, PrimitiveShadow, Indices);
957 Shadow = expandFromPrimitiveShadowRecursive(
958 Shadow, Indices, AT->getElementType(), PrimitiveShadow, IRB);
961 return Shadow;
967 Shadow = expandFromPrimitiveShadowRecursive(
968 Shadow, Indices, ST->getElementType(Idx), PrimitiveShadow, IRB);
971 return Shadow;
973 llvm_unreachable("Unexpected shadow type");
993 Value *Shadow = UndefValue::get(ShadowTy);
994 Shadow = expandFromPrimitiveShadowRecursive(Shadow, Indices, ShadowTy,
997 // Caches the primitive shadow value that built the shadow value.
998 CachedCollapsedShadows[Shadow] = PrimitiveShadow;
999 return Shadow;
1003 Value *DFSanFunction::collapseAggregateShadow(AggregateType *AT, Value *Shadow,
1008 Value *FirstItem = IRB.CreateExtractValue(Shadow, 0);
1012 Value *ShadowItem = IRB.CreateExtractValue(Shadow, Idx);
1019 Value *DFSanFunction::collapseToPrimitiveShadow(Value *Shadow,
1021 Type *ShadowTy = Shadow->getType();
1023 return Shadow;
1025 return collapseAggregateShadow<>(AT, Shadow, IRB);
1027 return collapseAggregateShadow<>(ST, Shadow, IRB);
1028 llvm_unreachable("Unexpected shadow type");
1031 Value *DFSanFunction::collapseToPrimitiveShadow(Value *Shadow,
1033 Type *ShadowTy = Shadow->getType();
1035 return Shadow;
1037 // Checks if the cached collapsed shadow value dominates Pos.
1038 Value *&CS = CachedCollapsedShadows[Shadow];
1043 Value *PrimitiveShadow = collapseToPrimitiveShadow(Shadow, IRB);
1044 // Caches the converted primitive shadow value.
1713 // Ensure IRB insertion point is after loads for shadow and origin.
1747 // We will not necessarily be able to compute the shadow for every phi node
1858 break; // ArgTLS overflows, uses a zero shadow.
1863 break; // ArgTLS overflows, uses a zero shadow.
1880 Value *&Shadow = ValShadowMap[V];
1881 if (!Shadow) {
1885 Shadow = getShadowForTLSArgument(A);
1886 NonZeroChecks.push_back(Shadow);
1888 Shadow = DFS.getZeroShadow(V);
1891 return Shadow;
1894 void DFSanFunction::setShadow(Instruction *I, Value *Shadow) {
1896 ValShadowMap[I] = Shadow;
1899 /// Compute the integer shadow offset that corresponds to a given
2007 return CCS.Shadow;
2015 CCS.Shadow = IRB.CreateOr(PV1, PV2);
2028 ShadowElements[CCS.Shadow] = std::move(UnionElems);
2030 return CCS.Shadow;
2040 Value *Shadow = getShadow(Inst->getOperand(0));
2042 Shadow = combineShadows(Shadow, getShadow(Inst->getOperand(I)),
2045 return expandFromPrimitiveShadow(Inst->getType(), Shadow,
2168 // Specifically, when the shadow size in bytes (i.e., loaded bytes x shadow
2173 // For the second case, we can fit the wide shadow in a 32-bit integer. In all
2174 // other cases, we use a 64-bit integer to hold the wide shadow.
2188 // The wide shadow relates to two origin pointers: one for the first four
2190 // get just the shadow bytes that correspond to the first origin pointer,
2191 // and then the entire shadow for the second origin pointer (which will be
2193 // shadow was empty but the other half was not).
2210 // First OR all the WideShadows (i.e., 64bit or 32bit shadow chunks) linearly;
2214 // shadow).
2305 // When the byte size is small enough, we can load the shadow directly with
2405 // shadow data after application data; store zero shadow data before
2406 // application data. This ensure shadow loads return either labels of the
2439 Value *Shadow =
2441 DFSF.setShadow(&LI, Shadow);
2459 Value *DFSanFunction::updateOriginIfTainted(Value *Shadow, Value *Origin,
2462 return IRB.CreateCall(DFS.DFSanChainOriginIfTaintedFn, {Shadow, Origin});
2528 uint64_t Size, Value *Shadow, Value *Origin,
2533 Value *CollapsedShadow = collapseToPrimitiveShadow(Shadow, Pos);
2608 "Shadow vector is too large!");
2670 // shadow data after application data; store zero shadow data before
2671 // application data. This ensure shadow loads return either labels of the
2681 Value *Shadow =
2685 Shadows.push_back(Shadow);
2696 PrimitiveShadow = DFSF.combineShadows(Shadow, PtrShadow, SI.getIterator());
2698 PrimitiveShadow = DFSF.collapseToPrimitiveShadow(Shadow, SI.getIterator());
2723 // Conservatively set data at stored addresses and return with zero shadow to
2724 // prevent shadow data races.
2784 // This memory will have a shadow, so with the loads and stores we will be
2802 // Only propagate shadow/origin of base pointer value but ignore those of
3034 // Adds the return value shadow.
3137 // Adds shadow arguments.
3155 // zero extend the shadow parameters. This is required for targets
3170 // Loads the return value shadow and origin.
3218 // the shadow operations aren't reordered before it.
3258 // the shadow operations aren't reordered after it.
3280 // This operation is not atomic for the shadow and origin memory.
3304 // This operation is not atomic for the shadow and origin memory.
3395 // after overflow have zero shadow values.
3423 // Loads the return value shadow.
3427 // Set overflowed return shadow to be zero.
3454 // Give the shadow phi node valid predecessors to fool SplitEdge into working.