Bug 1437483 part 1 - Add pref for Spectre mitigations for Ion object type barriers. r=nbp

This commit is contained in:
Jan de Mooij 2018-02-26 15:25:37 +01:00
Родитель 81684073f2
Коммит 190f5a93e1
8 изменённых файлов: 14 добавлений и 0 удалений

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

@ -129,6 +129,7 @@ const char* mozilla::dom::ContentPrefs::gEarlyPrefs[] = {
"javascript.options.parallel_parsing",
"javascript.options.shared_memory",
"javascript.options.spectre.index_masking",
"javascript.options.spectre.object_mitigations.barriers",
"javascript.options.spectre.string_mitigations",
"javascript.options.spectre.value_masking",
"javascript.options.streams",

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

@ -235,6 +235,7 @@ DefaultJitOptions::DefaultJitOptions()
}
SET_DEFAULT(spectreIndexMasking, true);
SET_DEFAULT(spectreObjectMitigationsBarriers, false);
SET_DEFAULT(spectreStringMitigations, true);
SET_DEFAULT(spectreValueMasking, true);

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

@ -98,6 +98,7 @@ struct DefaultJitOptions
// measure the effectiveness of each mitigation with various proof of
// concept.
bool spectreIndexMasking;
bool spectreObjectMitigationsBarriers;
bool spectreStringMitigations;
bool spectreValueMasking;

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

@ -7265,6 +7265,9 @@ JS_SetGlobalJitCompilerOption(JSContext* cx, JSJitCompilerOption opt, uint32_t v
case JSJITCOMPILER_SPECTRE_INDEX_MASKING:
jit::JitOptions.spectreIndexMasking = !!value;
break;
case JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS_BARRIERS:
jit::JitOptions.spectreObjectMitigationsBarriers = !!value;
break;
case JSJITCOMPILER_SPECTRE_STRING_MITIGATIONS:
jit::JitOptions.spectreStringMitigations = !!value;
break;

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

@ -5924,6 +5924,7 @@ JS_SetOffthreadIonCompilationEnabled(JSContext* cx, bool enabled);
Register(JUMP_THRESHOLD, "jump-threshold") \
Register(SIMULATOR_ALWAYS_INTERRUPT, "simulator.always-interrupt") \
Register(SPECTRE_INDEX_MASKING, "spectre.index-masking") \
Register(SPECTRE_OBJECT_MITIGATIONS_BARRIERS, "spectre.object-mitigations.barriers") \
Register(SPECTRE_STRING_MITIGATIONS, "spectre.string-mitigations") \
Register(SPECTRE_VALUE_MASKING, "spectre.value-masking") \
Register(ASMJS_ATOMICS_ENABLE, "asmjs.atomics.enable") \

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

@ -8469,10 +8469,12 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
if (const char* str = op.getStringOption("spectre-mitigations")) {
if (strcmp(str, "on") == 0) {
jit::JitOptions.spectreIndexMasking = true;
jit::JitOptions.spectreObjectMitigationsBarriers = true;
jit::JitOptions.spectreStringMitigations = true;
jit::JitOptions.spectreValueMasking = true;
} else if (strcmp(str, "off") == 0) {
jit::JitOptions.spectreIndexMasking = false;
jit::JitOptions.spectreObjectMitigationsBarriers = false;
jit::JitOptions.spectreStringMitigations = false;
jit::JitOptions.spectreValueMasking = false;
} else {

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

@ -808,6 +808,8 @@ ReloadPrefsCallback(const char* pref, void* data)
bool streams = Preferences::GetBool(JS_OPTIONS_DOT_STR "streams");
bool spectreIndexMasking = Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.index_masking");
bool spectreObjectMitigationsBarriers =
Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.object_mitigations.barriers");
bool spectreStringMitigations =
Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.string_mitigations");
bool spectreValueMasking = Preferences::GetBool(JS_OPTIONS_DOT_STR "spectre.value_masking");
@ -873,6 +875,8 @@ ReloadPrefsCallback(const char* pref, void* data)
#endif
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_INDEX_MASKING, spectreIndexMasking);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_OBJECT_MITIGATIONS_BARRIERS,
spectreObjectMitigationsBarriers);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_STRING_MITIGATIONS,
spectreStringMitigations);
JS_SetGlobalJitCompilerOption(cx, JSJITCOMPILER_SPECTRE_VALUE_MASKING, spectreValueMasking);

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

@ -1561,6 +1561,7 @@ pref("javascript.options.dump_stack_on_debuggee_would_run", false);
// Spectre security vulnerability mitigations.
pref("javascript.options.spectre.index_masking", true);
pref("javascript.options.spectre.object_mitigations.barriers", false);
pref("javascript.options.spectre.string_mitigations", true);
pref("javascript.options.spectre.value_masking", true);