Bug 1697935 - Remove unused javascript.options.spectre.object_mitigations.barriers pref. r=iain

The "barriers" here refered to type-barriers which no longer exist after
IonBuilder was removed so this pref is now dead. Also remove the .misc suffix
of the sibling pref.

Differential Revision: https://phabricator.services.mozilla.com/D108123
This commit is contained in:
Ted Campbell 2021-03-13 16:46:57 +00:00
Родитель bc646014e0
Коммит 787e85a561
10 изменённых файлов: 21 добавлений и 38 удалений

Просмотреть файл

@ -766,7 +766,7 @@ class MOZ_RAII CacheIRCompiler {
// (1) mitigations are enabled and (2) the object is used by other // (1) mitigations are enabled and (2) the object is used by other
// instructions (if the object is *not* used by other instructions, // instructions (if the object is *not* used by other instructions,
// zeroing its register is pointless). // zeroing its register is pointless).
return JitOptions.spectreObjectMitigationsMisc && return JitOptions.spectreObjectMitigations &&
!allocator.isDeadAfterInstruction(objId); !allocator.isDeadAfterInstruction(objId);
} }

Просмотреть файл

@ -251,15 +251,13 @@ DefaultJitOptions::DefaultJitOptions() {
#if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) #if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
SET_DEFAULT(spectreIndexMasking, false); SET_DEFAULT(spectreIndexMasking, false);
SET_DEFAULT(spectreObjectMitigationsBarriers, false); SET_DEFAULT(spectreObjectMitigations, false);
SET_DEFAULT(spectreObjectMitigationsMisc, false);
SET_DEFAULT(spectreStringMitigations, false); SET_DEFAULT(spectreStringMitigations, false);
SET_DEFAULT(spectreValueMasking, false); SET_DEFAULT(spectreValueMasking, false);
SET_DEFAULT(spectreJitToCxxCalls, false); SET_DEFAULT(spectreJitToCxxCalls, false);
#else #else
SET_DEFAULT(spectreIndexMasking, true); SET_DEFAULT(spectreIndexMasking, true);
SET_DEFAULT(spectreObjectMitigationsBarriers, true); SET_DEFAULT(spectreObjectMitigations, true);
SET_DEFAULT(spectreObjectMitigationsMisc, true);
SET_DEFAULT(spectreStringMitigations, true); SET_DEFAULT(spectreStringMitigations, true);
SET_DEFAULT(spectreValueMasking, true); SET_DEFAULT(spectreValueMasking, true);
SET_DEFAULT(spectreJitToCxxCalls, true); SET_DEFAULT(spectreJitToCxxCalls, true);

Просмотреть файл

@ -113,8 +113,7 @@ struct DefaultJitOptions {
// measure the effectiveness of each mitigation with various proof of // measure the effectiveness of each mitigation with various proof of
// concept. // concept.
bool spectreIndexMasking; bool spectreIndexMasking;
bool spectreObjectMitigationsBarriers; bool spectreObjectMitigations;
bool spectreObjectMitigationsMisc;
bool spectreStringMitigations; bool spectreStringMitigations;
bool spectreValueMasking; bool spectreValueMasking;
bool spectreJitToCxxCalls; bool spectreJitToCxxCalls;

Просмотреть файл

@ -3961,7 +3961,7 @@ void LIRGenerator::visitGuardNoDenseElements(MGuardNoDenseElements* ins) {
void LIRGenerator::visitGuardShape(MGuardShape* ins) { void LIRGenerator::visitGuardShape(MGuardShape* ins) {
MOZ_ASSERT(ins->object()->type() == MIRType::Object); MOZ_ASSERT(ins->object()->type() == MIRType::Object);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
auto* lir = auto* lir =
new (alloc()) LGuardShape(useRegisterAtStart(ins->object()), temp()); new (alloc()) LGuardShape(useRegisterAtStart(ins->object()), temp());
assignSnapshot(lir, ins->bailoutKind()); assignSnapshot(lir, ins->bailoutKind());

Просмотреть файл

@ -542,7 +542,7 @@ void MacroAssembler::branchTestObjClass(Condition cond, Register obj,
branchPtr(cond, Address(scratch, BaseShape::offsetOfClasp()), ImmPtr(clasp), branchPtr(cond, Address(scratch, BaseShape::offsetOfClasp()), ImmPtr(clasp),
label); label);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
spectreZeroRegister(cond, scratch, spectreRegToZero); spectreZeroRegister(cond, scratch, spectreRegToZero);
} }
} }
@ -568,7 +568,7 @@ void MacroAssembler::branchTestObjClass(Condition cond, Register obj,
loadPtr(Address(scratch, BaseShape::offsetOfClasp()), scratch); loadPtr(Address(scratch, BaseShape::offsetOfClasp()), scratch);
branchPtr(cond, clasp, scratch, label); branchPtr(cond, clasp, scratch, label);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
spectreZeroRegister(cond, scratch, spectreRegToZero); spectreZeroRegister(cond, scratch, spectreRegToZero);
} }
} }
@ -595,7 +595,7 @@ void MacroAssembler::branchTestObjClass(Condition cond, Register obj,
loadPtr(Address(scratch, BaseShape::offsetOfClasp()), scratch); loadPtr(Address(scratch, BaseShape::offsetOfClasp()), scratch);
branchPtr(cond, clasp, scratch, label); branchPtr(cond, clasp, scratch, label);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
spectreZeroRegister(cond, scratch, spectreRegToZero); spectreZeroRegister(cond, scratch, spectreRegToZero);
} }
} }
@ -607,14 +607,14 @@ void MacroAssembler::branchTestObjShape(Condition cond, Register obj,
MOZ_ASSERT(obj != scratch); MOZ_ASSERT(obj != scratch);
MOZ_ASSERT(spectreRegToZero != scratch); MOZ_ASSERT(spectreRegToZero != scratch);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
move32(Imm32(0), scratch); move32(Imm32(0), scratch);
} }
branchPtr(cond, Address(obj, JSObject::offsetOfShape()), ImmGCPtr(shape), branchPtr(cond, Address(obj, JSObject::offsetOfShape()), ImmGCPtr(shape),
label); label);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
spectreMovePtr(cond, scratch, spectreRegToZero); spectreMovePtr(cond, scratch, spectreRegToZero);
} }
} }
@ -635,13 +635,13 @@ void MacroAssembler::branchTestObjShape(Condition cond, Register obj,
MOZ_ASSERT(obj != shape); MOZ_ASSERT(obj != shape);
MOZ_ASSERT(spectreRegToZero != scratch); MOZ_ASSERT(spectreRegToZero != scratch);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
move32(Imm32(0), scratch); move32(Imm32(0), scratch);
} }
branchPtr(cond, Address(obj, JSObject::offsetOfShape()), shape, label); branchPtr(cond, Address(obj, JSObject::offsetOfShape()), shape, label);
if (JitOptions.spectreObjectMitigationsMisc) { if (JitOptions.spectreObjectMitigations) {
spectreMovePtr(cond, scratch, spectreRegToZero); spectreMovePtr(cond, scratch, spectreRegToZero);
} }
} }

Просмотреть файл

@ -5293,11 +5293,8 @@ JS_PUBLIC_API void JS_SetGlobalJitCompilerOption(JSContext* cx,
case JSJITCOMPILER_SPECTRE_INDEX_MASKING: case JSJITCOMPILER_SPECTRE_INDEX_MASKING:
jit::JitOptions.spectreIndexMasking = !!value; jit::JitOptions.spectreIndexMasking = !!value;
break; break;
case JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS_BARRIERS: case JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS:
jit::JitOptions.spectreObjectMitigationsBarriers = !!value; jit::JitOptions.spectreObjectMitigations = !!value;
break;
case JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS_MISC:
jit::JitOptions.spectreObjectMitigationsMisc = !!value;
break; break;
case JSJITCOMPILER_SPECTRE_STRING_MITIGATIONS: case JSJITCOMPILER_SPECTRE_STRING_MITIGATIONS:
jit::JitOptions.spectreStringMitigations = !!value; jit::JitOptions.spectreStringMitigations = !!value;

Просмотреть файл

@ -2640,8 +2640,7 @@ extern JS_PUBLIC_API void JS_SetOffthreadIonCompilationEnabled(JSContext* cx,
Register(NATIVE_REGEXP_ENABLE, "native_regexp.enable") \ Register(NATIVE_REGEXP_ENABLE, "native_regexp.enable") \
Register(SIMULATOR_ALWAYS_INTERRUPT, "simulator.always-interrupt") \ Register(SIMULATOR_ALWAYS_INTERRUPT, "simulator.always-interrupt") \
Register(SPECTRE_INDEX_MASKING, "spectre.index-masking") \ Register(SPECTRE_INDEX_MASKING, "spectre.index-masking") \
Register(SPECTRE_OBJECT_MITIGATIONS_BARRIERS, "spectre.object-mitigations.barriers") \ Register(SPECTRE_OBJECT_MITIGATIONS, "spectre.object-mitigations") \
Register(SPECTRE_OBJECT_MITIGATIONS_MISC, "spectre.object-mitigations.misc") \
Register(SPECTRE_STRING_MITIGATIONS, "spectre.string-mitigations") \ Register(SPECTRE_STRING_MITIGATIONS, "spectre.string-mitigations") \
Register(SPECTRE_VALUE_MASKING, "spectre.value-masking") \ Register(SPECTRE_VALUE_MASKING, "spectre.value-masking") \
Register(SPECTRE_JIT_TO_CXX_CALLS, "spectre.jit-to-C++-calls") \ Register(SPECTRE_JIT_TO_CXX_CALLS, "spectre.jit-to-C++-calls") \

Просмотреть файл

@ -10994,15 +10994,13 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
if (const char* str = op.getStringOption("spectre-mitigations")) { if (const char* str = op.getStringOption("spectre-mitigations")) {
if (strcmp(str, "on") == 0) { if (strcmp(str, "on") == 0) {
jit::JitOptions.spectreIndexMasking = true; jit::JitOptions.spectreIndexMasking = true;
jit::JitOptions.spectreObjectMitigationsBarriers = true; jit::JitOptions.spectreObjectMitigations = true;
jit::JitOptions.spectreObjectMitigationsMisc = true;
jit::JitOptions.spectreStringMitigations = true; jit::JitOptions.spectreStringMitigations = true;
jit::JitOptions.spectreValueMasking = true; jit::JitOptions.spectreValueMasking = true;
jit::JitOptions.spectreJitToCxxCalls = true; jit::JitOptions.spectreJitToCxxCalls = true;
} else if (strcmp(str, "off") == 0) { } else if (strcmp(str, "off") == 0) {
jit::JitOptions.spectreIndexMasking = false; jit::JitOptions.spectreIndexMasking = false;
jit::JitOptions.spectreObjectMitigationsBarriers = false; jit::JitOptions.spectreObjectMitigations = false;
jit::JitOptions.spectreObjectMitigationsMisc = false;
jit::JitOptions.spectreStringMitigations = false; jit::JitOptions.spectreStringMitigations = false;
jit::JitOptions.spectreValueMasking = false; jit::JitOptions.spectreValueMasking = false;
jit::JitOptions.spectreJitToCxxCalls = false; jit::JitOptions.spectreJitToCxxCalls = false;

Просмотреть файл

@ -856,10 +856,8 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
bool spectreIndexMasking = bool spectreIndexMasking =
Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.index_masking"); Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.index_masking");
bool spectreObjectMitigationsBarriers = Preferences::GetBool( bool spectreObjectMitigations =
JS_OPTIONS_DOT_STR "spectre.object_mitigations.barriers"); Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.object_mitigations");
bool spectreObjectMitigationsMisc = Preferences::GetBool(
JS_OPTIONS_DOT_STR "spectre.object_mitigations.misc");
bool spectreStringMitigations = bool spectreStringMitigations =
Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.string_mitigations"); Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.string_mitigations");
bool spectreValueMasking = bool spectreValueMasking =
@ -912,12 +910,8 @@ static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_INDEX_MASKING, JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_INDEX_MASKING,
spectreIndexMasking); spectreIndexMasking);
JS_SetGlobalJitCompilerOption( JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS,
cx, JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS_BARRIERS, spectreObjectMitigations);
spectreObjectMitigationsBarriers);
JS_SetGlobalJitCompilerOption(cx,
JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS_MISC,
spectreObjectMitigationsMisc);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_STRING_MITIGATIONS, JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_STRING_MITIGATIONS,
spectreStringMitigations); spectreStringMitigations);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_VALUE_MASKING, JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_VALUE_MASKING,

Просмотреть файл

@ -1212,14 +1212,12 @@ pref("javascript.options.dump_stack_on_debuggee_would_run", false);
// Spectre security vulnerability mitigations. // Spectre security vulnerability mitigations.
#if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) #if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
pref("javascript.options.spectre.index_masking", false); pref("javascript.options.spectre.index_masking", false);
pref("javascript.options.spectre.object_mitigations.barriers", false);
pref("javascript.options.spectre.object_mitigations.misc", false); pref("javascript.options.spectre.object_mitigations.misc", false);
pref("javascript.options.spectre.string_mitigations", false); pref("javascript.options.spectre.string_mitigations", false);
pref("javascript.options.spectre.value_masking", false); pref("javascript.options.spectre.value_masking", false);
pref("javascript.options.spectre.jit_to_C++_calls", false); pref("javascript.options.spectre.jit_to_C++_calls", false);
#else #else
pref("javascript.options.spectre.index_masking", true); pref("javascript.options.spectre.index_masking", true);
pref("javascript.options.spectre.object_mitigations.barriers", true);
pref("javascript.options.spectre.object_mitigations.misc", true); pref("javascript.options.spectre.object_mitigations.misc", true);
pref("javascript.options.spectre.string_mitigations", true); pref("javascript.options.spectre.string_mitigations", true);
pref("javascript.options.spectre.value_masking", true); pref("javascript.options.spectre.value_masking", true);