Changeset 278356 in webkit
- Timestamp:
- Jun 2, 2021, 9:26:00 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r278351 r278356 1 2021-06-02 Keith Miller <[email protected]> 2 3 Convert small JIT pool tests into executable fuzzing 4 https://bugs.webkit.org/show_bug.cgi?id=226279 5 6 Right now, we try to test our engine on a small JIT pool. This isn't a known configuration for any 7 actual ports and causes issues if we run out of JIT memory when we need to compile an OSR exit. 8 Instead of testing such a small pool we should just fuzz each executable allocation that says it 9 can fail. 10 11 The current fuzzing doesn't do a good job tracking the number of DFG/FTL compiles when allocations 12 fail, so when enabled those tests will just exit early. Also, right now we use a random seed picked 13 by the engine for these tests, which makes it hard to reproduce crashes on the bots. If we see 14 flakiness on the bots we can have the harness pass in a number so it gets logged in the repro command. 15 16 Reviewed by Michael Saboff. 17 18 * bytecode/CodeBlock.cpp: 19 (JSC::CodeBlock::numberOfDFGCompiles): 20 * jit/ExecutableAllocationFuzz.cpp: 21 (JSC::doExecutableAllocationFuzzing): 22 * jsc.cpp: 23 (runJSC): 24 1 25 2021-06-02 Chris Dumez <[email protected]> 2 26 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r278253 r278356 2482 2482 { 2483 2483 ASSERT(JITCode::isBaselineCode(jitType())); 2484 2485 // FIXME: We don't really do a good job tracking when a compilation failed because of executable allocation fuzzing. https://bugs.webkit.org/show_bug.cgi?id=226276 2486 if (Options::useExecutableAllocationFuzz()) 2487 return 1000000; 2484 2488 if (Options::testTheFTL()) { 2485 2489 if (m_didFailFTLCompilation) -
trunk/Source/JavaScriptCore/jit/ExecutableAllocationFuzz.cpp
r191058 r278356 30 30 #include <wtf/Atomics.h> 31 31 #include <wtf/DataLog.h> 32 #include <wtf/WeakRandom.h> 32 33 33 34 namespace JSC { … … 41 42 ExecutableAllocationFuzzResult doExecutableAllocationFuzzing() 42 43 { 44 static WeakRandom random(Options::seedOfVMRandomForFuzzer() ? Options::seedOfVMRandomForFuzzer() : cryptographicallyRandomNumber()); 45 43 46 ASSERT(Options::useExecutableAllocationFuzz()); 44 47 45 unsigned oldValue; 46 unsigned newValue; 47 do { 48 oldValue = s_numberOfExecutableAllocationFuzzChecks.load(); 49 newValue = oldValue + 1; 50 } while (!s_numberOfExecutableAllocationFuzzChecks.compareExchangeWeak(oldValue, newValue)); 51 52 if (newValue == Options::fireExecutableAllocationFuzzAt()) { 48 unsigned numChecks = s_numberOfExecutableAllocationFuzzChecks.value++; 49 50 if (numChecks == Options::fireExecutableAllocationFuzzAt()) { 53 51 if (Options::verboseExecutableAllocationFuzz()) { 54 52 dataLog("Will pretend to fail executable allocation.\n"); … … 57 55 return PretendToFailExecutableAllocation; 58 56 } 59 57 60 58 if (Options::fireExecutableAllocationFuzzAtOrAfter() 61 && n ewValue>= Options::fireExecutableAllocationFuzzAtOrAfter()) {59 && numChecks >= Options::fireExecutableAllocationFuzzAtOrAfter()) { 62 60 if (Options::verboseExecutableAllocationFuzz()) { 63 61 dataLog("Will pretend to fail executable allocation.\n"); … … 65 63 } 66 64 return PretendToFailExecutableAllocation; 67 } 65 } else if (!Options::fireExecutableAllocationFuzzAt() && random.getUint32() < UINT_MAX * Options::randomIntegrityAuditRate()) 66 return PretendToFailExecutableAllocation; 68 67 69 68 return AllowNormalExecutableAllocation; -
trunk/Source/JavaScriptCore/jsc.cpp
r278240 r278356 3490 3490 if (Options::useExceptionFuzz()) 3491 3491 printf("JSC EXCEPTION FUZZ: encountered %u checks.\n", numberOfExceptionFuzzChecks()); 3492 bool fireAtEnabled = 3493 Options::fireExecutableAllocationFuzzAt() || Options::fireExecutableAllocationFuzzAtOrAfter(); 3494 if (Options::useExecutableAllocationFuzz() && (!fireAtEnabled || Options::verboseExecutableAllocationFuzz())) 3492 if (Options::useExecutableAllocationFuzz() && Options::verboseExecutableAllocationFuzz()) 3495 3493 printf("JSC EXECUTABLE ALLOCATION FUZZ: encountered %u checks.\n", numberOfExecutableAllocationFuzzChecks()); 3496 3494 if (Options::useOSRExitFuzz() && Options::verboseOSRExitFuzz()) { -
trunk/Tools/ChangeLog
r278353 r278356 1 2021-06-02 Keith Miller <[email protected]> 2 3 Convert small JIT pool tests into executable fuzzing 4 https://bugs.webkit.org/show_bug.cgi?id=226279 5 6 Reviewed by Michael Saboff. 7 8 Right now, we try to test our engine on a small JIT pool. This isn't a known configuration for any 9 actual ports and causes issues if we run out of JIT memory when we need to compile an OSR exit. 10 Instead of testing such a small pool we should just fuzz each executable allocation that says it 11 can fail. 12 13 The current fuzzing doesn't do a good job tracking the number of DFG/FTL compiles when allocations 14 fail, so when enabled those tests will just exit early. Also, right now we use a random seed picked 15 by the engine for these tests, which makes it hard to reproduce crashes on the bots. If we see 16 flakiness on the bots we can have the harness pass in a number so it gets logged in the repro command. 17 18 * Scripts/jsc-stress-test-helpers/js-executable-allocation-fuzz: 19 * Scripts/run-jsc-stress-tests: 20 1 21 2021-06-02 Jonathan Bedard <[email protected]> 2 22 -
trunk/Tools/Scripts/jsc-stress-test-helpers/js-executable-allocation-fuzz
r226395 r278356 70 70 } 71 71 72 open (my $testInput, "$commandString --useExecutableAllocationFuzz=true |") or fail("Cannot execute initial command when getting check count");72 open (my $testInput, "$commandString --useExecutableAllocationFuzz=true --verboseExecutableAllocationFuzz=true |") or fail("Cannot execute initial command when getting check count"); 73 73 while (my $inputLine = <$testInput>) { 74 74 chomp($inputLine); -
trunk/Tools/Scripts/run-jsc-stress-tests
r278234 r278356 190 190 puts " no-cjit-validate-phases, no-cjit-collect-continuously, dfg-eager" 191 191 puts " and for FTL platforms: no-ftl, ftl-eager-no-cjit and" 192 puts " ftl-no-cjit- small-pool."192 puts " ftl-no-cjit-fuzz." 193 193 exit 1 194 194 end … … 852 852 end 853 853 854 def runFTLNoCJIT SmallPool(*optionalTestSpecificOptions)855 run("ftl-no-cjit- small-pool", "--jitMemoryReservationSize=102400", *(FTL_OPTIONS + NO_CJIT_OPTIONS + optionalTestSpecificOptions))854 def runFTLNoCJITFuzz(*optionalTestSpecificOptions) 855 run("ftl-no-cjit-fuzz", "--useExecutableAllocationFuzz=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS + optionalTestSpecificOptions)) 856 856 end 857 857 … … 898 898 runFTLEager 899 899 runFTLEagerNoCJITValidate 900 runFTLNoCJIT SmallPool900 runFTLNoCJITFuzz 901 901 902 902 return if $mode == "basic" … … 929 929 runNoFTL 930 930 runFTLNoCJITValidate 931 runFTLNoCJIT SmallPool931 runFTLNoCJITFuzz 932 932 933 933 return if $mode == "basic" … … 1009 1009 runFTLEager 1010 1010 runFTLEagerNoCJITValidate 1011 runFTLNoCJIT SmallPool1011 runFTLNoCJITFuzz 1012 1012 end 1013 1013 end … … 1161 1161 run("ftl-eager-modules", "-m", *(FTL_OPTIONS + EAGER_OPTIONS)) 1162 1162 run("ftl-eager-no-cjit-modules", "-m", "--validateGraph=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS + EAGER_OPTIONS)) 1163 run("ftl-no-cjit- small-pool-modules", "-m", "--jitMemoryReservationSize=102400", *(FTL_OPTIONS + NO_CJIT_OPTIONS))1163 run("ftl-no-cjit-fuzz-modules", "-m", "--useExecutableAllocationFuzz=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS)) 1164 1164 end 1165 1165
Note:
See TracChangeset
for help on using the changeset viewer.