Skip to content

Commit 008e43e

Browse files
committed
[MERGE #6528 @akroshg] ChakraCore Servicing update for 2020.11B
Merge pull request #6528 from akroshg:servicing_2011 Fixing - [CVE-2020-17054] [CVE-2020-17048]
2 parents 63c5099 + ab0e7c0 commit 008e43e

File tree

6 files changed

+37
-41
lines changed

6 files changed

+37
-41
lines changed

Diff for: Build/NuGet/.pack-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.11.22
1+
1.11.23

Diff for: lib/Backend/GlobOpt.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -14591,6 +14591,14 @@ GlobOpt::OptIsInvariant(
1459114591
allowNonPrimitives = true;
1459214592
}
1459314593
break;
14594+
14595+
case Js::OpCode::CheckFixedFld:
14596+
if (!instr->GetSrc1()->AsPropertySymOpnd()->NeedsPrimaryTypeCheck())
14597+
{
14598+
break;
14599+
}
14600+
// Fall through. If the instruction has to do a type check as well as a fixed field check, then we need to check the invariance
14601+
// of the type symbol.
1459414602
case Js::OpCode::CheckObjType:
1459514603
// Bug 11712101: If the operand is a field, ensure that its containing object type is invariant
1459614604
// before hoisting -- that is, don't hoist a CheckObjType over a DeleteFld on that object.

Diff for: lib/Backend/GlobOpt.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ class GlobOpt
559559
void TryOptimizeInstrWithFixedDataProperty(IR::Instr * * const pInstr);
560560
bool CheckIfPropOpEmitsTypeCheck(IR::Instr *instr, IR::PropertySymOpnd *opnd);
561561
IR::PropertySymOpnd * CreateOpndForTypeCheckOnly(IR::PropertySymOpnd* opnd, Func* func);
562-
bool FinishOptPropOp(IR::Instr *instr, IR::PropertySymOpnd *opnd, BasicBlock* block = nullptr, bool updateExistingValue = false, bool* emitsTypeCheckOut = nullptr, bool* changesTypeValueOut = nullptr);
562+
bool FinishOptPropOp(IR::Instr *instr, IR::PropertySymOpnd *opnd, BasicBlock* block = nullptr, bool* emitsTypeCheckOut = nullptr, bool* changesTypeValueOut = nullptr);
563563
IR::Instr * SetTypeCheckBailOut(IR::Opnd *opnd, IR::Instr *instr, BailOutInfo *bailOutInfo);
564564
void OptArguments(IR::Instr *Instr);
565565
void TrackInstrsForScopeObjectRemoval(IR::Instr * instr);
@@ -944,7 +944,7 @@ class GlobOpt
944944
bool ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd);
945945
bool CheckIfInstrInTypeCheckSeqEmitsTypeCheck(IR::Instr* instr, IR::PropertySymOpnd *opnd);
946946
template<bool makeChanges>
947-
bool ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd, BasicBlock* block, bool updateExistingValue, bool* emitsTypeCheckOut = nullptr, bool* changesTypeValueOut = nullptr, bool *isObjTypeChecked = nullptr);
947+
bool ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd, BasicBlock* block, bool* emitsTypeCheckOut = nullptr, bool* changesTypeValueOut = nullptr, bool *isObjTypeChecked = nullptr);
948948
template<class Fn>
949949
bool MapObjectHeaderInlinedTypeSymsUntil(BasicBlock *block, bool isObjTypeSpecialized, SymID opndId, Fn fn);
950950
void KillObjectHeaderInlinedTypeSyms(BasicBlock *block, bool isObjTypeSpecialized, SymID symId = SymID_Invalid);
@@ -954,8 +954,8 @@ class GlobOpt
954954
void SetTypeSetOnObjectTypeValue(Value* value, Js::EquivalentTypeSet* typeSet);
955955
void UpdateObjectTypeValue(Value* value, const JITTypeHolder type, bool setType, Js::EquivalentTypeSet* typeSet, bool setTypeSet);
956956
void SetObjectTypeFromTypeSym(StackSym *typeSym, Value* value, BasicBlock* block = nullptr);
957-
void SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, BasicBlock* block = nullptr, bool updateExistingValue = false);
958-
void SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, GlobOptBlockData *blockData, bool updateExistingValue = false);
957+
void SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, BasicBlock* block = nullptr);
958+
void SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, GlobOptBlockData *blockData);
959959
void KillObjectType(StackSym *objectSym, BVSparse<JitArenaAllocator>* liveFields = nullptr);
960960
void KillAllObjectTypes(BVSparse<JitArenaAllocator>* liveFields = nullptr);
961961
void EndFieldLifetime(IR::SymOpnd *symOpnd);

Diff for: lib/Backend/GlobOptFields.cpp

+18-33
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ GlobOpt::CreateOpndForTypeCheckOnly(IR::PropertySymOpnd* opnd, Func* func)
875875
}
876876

877877
bool
878-
GlobOpt::FinishOptPropOp(IR::Instr *instr, IR::PropertySymOpnd *opnd, BasicBlock* block, bool updateExistingValue, bool* emitsTypeCheckOut, bool* changesTypeValueOut)
878+
GlobOpt::FinishOptPropOp(IR::Instr *instr, IR::PropertySymOpnd *opnd, BasicBlock* block, bool* emitsTypeCheckOut, bool* changesTypeValueOut)
879879
{
880880
if (!DoFieldRefOpts() || !OpCodeAttr::FastFldInstr(instr->m_opcode))
881881
{
@@ -888,7 +888,7 @@ GlobOpt::FinishOptPropOp(IR::Instr *instr, IR::PropertySymOpnd *opnd, BasicBlock
888888

889889
if (isTypeCheckSeqCandidate)
890890
{
891-
isObjTypeSpecialized = ProcessPropOpInTypeCheckSeq<true>(instr, opnd, block, updateExistingValue, emitsTypeCheckOut, changesTypeValueOut, &isObjTypeChecked);
891+
isObjTypeSpecialized = ProcessPropOpInTypeCheckSeq<true>(instr, opnd, block, emitsTypeCheckOut, changesTypeValueOut, &isObjTypeChecked);
892892
}
893893

894894
if (opnd == instr->GetDst() && this->objectTypeSyms)
@@ -1102,19 +1102,19 @@ GlobOpt::CompareCurrentTypesWithExpectedTypes(JsTypeValueInfo *valueInfo, IR::Pr
11021102
bool
11031103
GlobOpt::ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd)
11041104
{
1105-
return ProcessPropOpInTypeCheckSeq<true>(instr, opnd, this->currentBlock, false);
1105+
return ProcessPropOpInTypeCheckSeq<true>(instr, opnd, this->currentBlock);
11061106
}
11071107

11081108
bool GlobOpt::CheckIfInstrInTypeCheckSeqEmitsTypeCheck(IR::Instr* instr, IR::PropertySymOpnd *opnd)
11091109
{
11101110
bool emitsTypeCheck;
1111-
ProcessPropOpInTypeCheckSeq<false>(instr, opnd, this->currentBlock, false, &emitsTypeCheck);
1111+
ProcessPropOpInTypeCheckSeq<false>(instr, opnd, this->currentBlock, &emitsTypeCheck);
11121112
return emitsTypeCheck;
11131113
}
11141114

11151115
template<bool makeChanges>
11161116
bool
1117-
GlobOpt::ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd, BasicBlock* block, bool updateExistingValue, bool* emitsTypeCheckOut, bool* changesTypeValueOut, bool *isTypeCheckedOut)
1117+
GlobOpt::ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd, BasicBlock* block, bool* emitsTypeCheckOut, bool* changesTypeValueOut, bool *isTypeCheckedOut)
11181118
{
11191119
// We no longer mark types as dead in the backward pass, so we should never see an instr with a dead type here
11201120
// during the forward pass. For the time being we've retained the logic below to deal with dead types in case
@@ -1193,7 +1193,7 @@ GlobOpt::ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd
11931193
addsProperty = isStore && isSpecialized && opnd->HasInitialType();
11941194
if (produceType)
11951195
{
1196-
SetObjectTypeFromTypeSym(typeSym, opndType, nullptr, block, updateExistingValue);
1196+
SetObjectTypeFromTypeSym(typeSym, opndType, nullptr, block);
11971197
}
11981198
}
11991199
else if (valueInfo->GetJsType() != nullptr)
@@ -1227,7 +1227,7 @@ GlobOpt::ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd
12271227
}
12281228
if (produceType)
12291229
{
1230-
SetObjectTypeFromTypeSym(typeSym, opndType, nullptr, block, updateExistingValue);
1230+
SetObjectTypeFromTypeSym(typeSym, opndType, nullptr, block);
12311231
}
12321232
isSpecialized = !isTypeDead || !objectMayHaveAcquiredAdditionalProperties;
12331233
emitsTypeCheck = isSpecialized && objectMayHaveAcquiredAdditionalProperties;
@@ -1376,11 +1376,11 @@ GlobOpt::ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd
13761376
{
13771377
if (opnd->IsMono())
13781378
{
1379-
SetObjectTypeFromTypeSym(typeSym, opnd->GetFirstEquivalentType(), nullptr, block, updateExistingValue);
1379+
SetObjectTypeFromTypeSym(typeSym, opnd->GetFirstEquivalentType(), nullptr, block);
13801380
}
13811381
else
13821382
{
1383-
SetObjectTypeFromTypeSym(typeSym, nullptr, opndTypeSet, block, updateExistingValue);
1383+
SetObjectTypeFromTypeSym(typeSym, nullptr, opndTypeSet, block);
13841384
}
13851385
}
13861386
isSpecialized = !isTypeDead;
@@ -1421,11 +1421,11 @@ GlobOpt::ProcessPropOpInTypeCheckSeq(IR::Instr* instr, IR::PropertySymOpnd *opnd
14211421
{
14221422
if (opnd->IsMono())
14231423
{
1424-
SetObjectTypeFromTypeSym(typeSym, opnd->GetFirstEquivalentType(), nullptr, block, updateExistingValue);
1424+
SetObjectTypeFromTypeSym(typeSym, opnd->GetFirstEquivalentType(), nullptr, block);
14251425
}
14261426
else
14271427
{
1428-
SetObjectTypeFromTypeSym(typeSym, nullptr, opndTypeSet, block, updateExistingValue);
1428+
SetObjectTypeFromTypeSym(typeSym, nullptr, opndTypeSet, block);
14291429
}
14301430
}
14311431
isSpecialized = !isTypeDead;
@@ -1788,18 +1788,18 @@ GlobOpt::SetObjectTypeFromTypeSym(StackSym *typeSym, Value* value, BasicBlock* b
17881788
}
17891789

17901790
void
1791-
GlobOpt::SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, BasicBlock* block, bool updateExistingValue)
1791+
GlobOpt::SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, BasicBlock* block)
17921792
{
17931793
if (block == nullptr)
17941794
{
17951795
block = this->currentBlock;
17961796
}
17971797

1798-
SetObjectTypeFromTypeSym(typeSym, type, typeSet, &block->globOptData, updateExistingValue);
1798+
SetObjectTypeFromTypeSym(typeSym, type, typeSet, &block->globOptData);
17991799
}
18001800

18011801
void
1802-
GlobOpt::SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, GlobOptBlockData *blockData, bool updateExistingValue)
1802+
GlobOpt::SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, Js::EquivalentTypeSet * typeSet, GlobOptBlockData *blockData)
18031803
{
18041804
Assert(typeSym != nullptr);
18051805

@@ -1810,25 +1810,10 @@ GlobOpt::SetObjectTypeFromTypeSym(StackSym *typeSym, const JITTypeHolder type, J
18101810
blockData = &this->currentBlock->globOptData;
18111811
}
18121812

1813-
if (updateExistingValue)
1814-
{
1815-
Value* value = blockData->FindValueFromMapDirect(typeSymId);
1816-
1817-
// If we're trying to update an existing value, the value better exist. We only do this when updating a generic
1818-
// value created during loop pre-pass for field hoisting, so we expect the value info to still be blank.
1819-
Assert(value != nullptr && value->GetValueInfo() != nullptr && value->GetValueInfo()->IsJsType());
1820-
JsTypeValueInfo* valueInfo = value->GetValueInfo()->AsJsType();
1821-
Assert(valueInfo->GetJsType() == nullptr && valueInfo->GetJsTypeSet() == nullptr);
1822-
UpdateObjectTypeValue(value, type, true, typeSet, true);
1823-
}
1824-
else
1825-
{
1826-
JsTypeValueInfo* valueInfo = JsTypeValueInfo::New(this->alloc, type, typeSet);
1827-
this->SetSymStoreDirect(valueInfo, typeSym);
1828-
Value* value = NewValue(valueInfo);
1829-
blockData->SetValue(value, typeSym);
1830-
}
1831-
1813+
JsTypeValueInfo* valueInfo = JsTypeValueInfo::New(this->alloc, type, typeSet);
1814+
this->SetSymStoreDirect(valueInfo, typeSym);
1815+
Value* value = NewValue(valueInfo);
1816+
blockData->SetValue(value, typeSym);
18321817
blockData->liveFields->Set(typeSymId);
18331818
}
18341819

Diff for: lib/Backend/Lower.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -27152,8 +27152,11 @@ void Lowerer::LowerLdFrameDisplay(IR::Instr *instr, bool doStackFrameDisplay)
2715227152
if (instr->m_func != this->m_func && this->m_func->DoStackFrameDisplay())
2715327153
{
2715427154
StackSym * inlineeFrameDisplaySym = instr->m_func->GetLocalFrameDisplaySym();
27155-
Assert(inlineeFrameDisplaySym->IsAllocated());
27156-
InsertMove(IR::SymOpnd::New(inlineeFrameDisplaySym, TyMachReg, m_func), dstOpnd, instr);
27155+
Assert((inlineeFrameDisplaySym && inlineeFrameDisplaySym->IsAllocated()) || this->m_func->IsLoopBody());
27156+
if (inlineeFrameDisplaySym && inlineeFrameDisplaySym->IsAllocated())
27157+
{
27158+
InsertMove(IR::SymOpnd::New(inlineeFrameDisplaySym, TyMachReg, m_func), dstOpnd, instr);
27159+
}
2715727160
}
2715827161
}
2715927162

Diff for: lib/Common/ChakraCoreVersion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// ChakraCore version number definitions (used in ChakraCore binary metadata)
1818
#define CHAKRA_CORE_MAJOR_VERSION 1
1919
#define CHAKRA_CORE_MINOR_VERSION 11
20-
#define CHAKRA_CORE_PATCH_VERSION 22
20+
#define CHAKRA_CORE_PATCH_VERSION 23
2121
#define CHAKRA_CORE_VERSION_RELEASE_QFE 0 // Redundant with PATCH_VERSION. Keep this value set to 0.
2222

2323
// -------------

0 commit comments

Comments
 (0)