Skip to content

Commit d554d0c

Browse files
committed
[MERGE #5116 @MSLaguana] ChakraCore 2018-05 security updates
Merge pull request #5116 from MSLaguana:servicing/1805
2 parents c0c1d63 + ec2922b commit d554d0c

39 files changed

+513
-276
lines changed

Build/NuGet/.pack-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.3
1+
1.8.4

lib/Backend/BackwardPass.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4124,8 +4124,9 @@ BackwardPass::UpdateArrayBailOutKind(IR::Instr *const instr)
41244124

41254125
IR::BailOutKind includeBailOutKinds = IR::BailOutInvalid;
41264126
if(!baseValueType.IsNotNativeArray() &&
4127-
(!baseValueType.IsLikelyNativeArray() || instr->GetSrc1()->IsVar()) &&
4128-
!currentBlock->noImplicitCallNativeArrayUses->IsEmpty())
4127+
(!baseValueType.IsLikelyNativeArray() || !instr->GetSrc1()->IsInt32()) &&
4128+
!currentBlock->noImplicitCallNativeArrayUses->IsEmpty() &&
4129+
!(instr->GetBailOutKind() & IR::BailOutOnArrayAccessHelperCall))
41294130
{
41304131
// There is an upwards-exposed use of a native array. Since the array referenced by this instruction can be aliased,
41314132
// this instruction needs to bail out if it converts the native array even if this array specifically is not
@@ -4231,6 +4232,11 @@ BackwardPass::ProcessStackSymUse(StackSym * stackSym, BOOLEAN isNonByteCodeUse)
42314232
return true;
42324233
}
42334234

4235+
if (this->DoMarkTempNumbers())
4236+
{
4237+
Assert((block->loop != nullptr) == block->tempNumberTracker->HasTempTransferDependencies());
4238+
block->tempNumberTracker->ProcessUse(stackSym, this);
4239+
}
42344240
if (this->DoMarkTempObjects())
42354241
{
42364242
Assert((block->loop != nullptr) == block->tempObjectTracker->HasTempTransferDependencies());
@@ -4293,17 +4299,7 @@ BackwardPass::ProcessSymUse(Sym * sym, bool isRegOpndUse, BOOLEAN isNonByteCodeU
42934299
}
42944300
}
42954301

4296-
StackSym * stackSym = sym->AsStackSym();
4297-
bool isUsed = ProcessStackSymUse(stackSym, isNonByteCodeUse);
4298-
4299-
if (!IsCollectionPass() && isRegOpndUse && this->DoMarkTempNumbers())
4300-
{
4301-
// Collect mark temp number information
4302-
Assert((block->loop != nullptr) == block->tempNumberTracker->HasTempTransferDependencies());
4303-
block->tempNumberTracker->ProcessUse(stackSym, this);
4304-
}
4305-
4306-
return isUsed;
4302+
return ProcessStackSymUse(sym->AsStackSym(), isNonByteCodeUse);
43074303
}
43084304

43094305
bool

lib/Backend/GlobOpt.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6482,6 +6482,8 @@ GlobOpt::OptConstPeep(IR::Instr *instr, IR::Opnd *constSrc, Value **pDstVal, Val
64826482

64836483
instr->m_opcode = Js::OpCode::Ld_A;
64846484

6485+
InvalidateInductionVariables(instr);
6486+
64856487
return true;
64866488
}
64876489

@@ -7088,16 +7090,7 @@ GlobOpt::OptConstFoldUnary(
70887090
}
70897091
}
70907092

7091-
// If this is an induction variable, then treat it the way the prepass would have if it had seen
7092-
// the assignment and the resulting change to the value number, and mark it as indeterminate.
7093-
for (Loop * loop = this->currentBlock->loop; loop; loop = loop->parent)
7094-
{
7095-
InductionVariable *iv = nullptr;
7096-
if (loop->inductionVariables && loop->inductionVariables->TryGetReference(dstSym->m_id, &iv))
7097-
{
7098-
iv->SetChangeIsIndeterminate();
7099-
}
7100-
}
7093+
InvalidateInductionVariables(instr);
71017094

71027095
return true;
71037096
}
@@ -12422,16 +12415,7 @@ GlobOpt::OptConstFoldBinary(
1242212415
this->ToInt32Dst(instr, dst->AsRegOpnd(), this->currentBlock);
1242312416
}
1242412417

12425-
// If this is an induction variable, then treat it the way the prepass would have if it had seen
12426-
// the assignment and the resulting change to the value number, and mark it as indeterminate.
12427-
for (Loop * loop = this->currentBlock->loop; loop; loop = loop->parent)
12428-
{
12429-
InductionVariable *iv = nullptr;
12430-
if (loop->inductionVariables && loop->inductionVariables->TryGetReference(dstSym->m_id, &iv))
12431-
{
12432-
iv->SetChangeIsIndeterminate();
12433-
}
12434-
}
12418+
InvalidateInductionVariables(instr);
1243512419

1243612420
return true;
1243712421
}

lib/Backend/GlobOpt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ class GlobOpt
685685
void DetectUnknownChangesToInductionVariables(GlobOptBlockData *const blockData);
686686
void SetInductionVariableValueNumbers(GlobOptBlockData *const blockData);
687687
void FinalizeInductionVariables(Loop *const loop, GlobOptBlockData *const headerData);
688+
void InvalidateInductionVariables(IR::Instr * instr);
688689
enum class SymBoundType {OFFSET, VALUE, UNKNOWN};
689690
SymBoundType DetermineSymBoundOffsetOrValueRelativeToLandingPad(StackSym *const sym, const bool landingPadValueIsLowerBound, ValueInfo *const valueInfo, const IntBounds *const bounds, GlobOptBlockData *const landingPadGlobOptBlockData, int *const boundOffsetOrValueRef);
690691

lib/Backend/GlobOptIntBounds.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,30 @@ void GlobOpt::FinalizeInductionVariables(Loop *const loop, GlobOptBlockData *con
12621262
}
12631263
}
12641264

1265+
void
1266+
GlobOpt::InvalidateInductionVariables(IR::Instr * instr)
1267+
{
1268+
Assert(instr->GetDst() != nullptr && instr->GetDst()->IsRegOpnd());
1269+
1270+
// Induction variables are always var syms.
1271+
StackSym * dstSym = instr->GetDst()->AsRegOpnd()->m_sym;
1272+
if (!dstSym->IsVar())
1273+
{
1274+
dstSym = dstSym->GetVarEquivSym(this->func);
1275+
}
1276+
1277+
// If this is an induction variable, then treat it the way the prepass would have if it had seen
1278+
// the assignment and the resulting change to the value number, and mark it as indeterminate.
1279+
for (Loop * loop = this->currentBlock->loop; loop; loop = loop->parent)
1280+
{
1281+
InductionVariable *iv = nullptr;
1282+
if (loop->inductionVariables && loop->inductionVariables->TryGetReference(dstSym->m_id, &iv))
1283+
{
1284+
iv->SetChangeIsIndeterminate();
1285+
}
1286+
}
1287+
}
1288+
12651289
GlobOpt::SymBoundType GlobOpt::DetermineSymBoundOffsetOrValueRelativeToLandingPad(
12661290
StackSym *const sym,
12671291
const bool landingPadValueIsLowerBound,

lib/Backend/Inline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,11 +2089,11 @@ Inline::InlineBuiltInFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *
20892089
callInstr->m_opcode = inlineCallOpCode;
20902090
SetupInlineInstrForCallDirect(builtInFunctionId, callInstr, argoutInstr);
20912091

2092+
WrapArgsOutWithCoerse(builtInFunctionId, callInstr);
2093+
20922094
// Generate ByteCodeArgOutCaptures and move the ArgOut_A/ArgOut_A_Inline close to the call instruction
20932095
callInstr->MoveArgs(/*generateByteCodeCapture*/ true);
20942096

2095-
WrapArgsOutWithCoerse(builtInFunctionId, callInstr);
2096-
20972097
inlineBuiltInEndInstr = callInstr;
20982098
}
20992099
else

0 commit comments

Comments
 (0)