Changeset 280004 in webkit for trunk/Source/JavaScriptCore/jit/ExecutableAllocationFuzz.cpp
- Timestamp:
- Jul 16, 2021, 3:18:46 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/ExecutableAllocationFuzz.cpp
r279916 r280004 42 42 ExecutableAllocationFuzzResult doExecutableAllocationFuzzing() 43 43 { 44 static WeakRandom random(Options::seedOfVMRandomForFuzzer() ? Options::seedOfVMRandomForFuzzer() : cryptographicallyRandomNumber());45 46 44 ASSERT(Options::useExecutableAllocationFuzz()); 47 45 … … 62 60 } 63 61 64 unsigned numChecks = s_numberOfExecutableAllocationFuzzChecks.value++; 65 66 if (numChecks == Options::fireExecutableAllocationFuzzAt()) { 62 unsigned oldValue; 63 unsigned newValue; 64 do { 65 oldValue = s_numberOfExecutableAllocationFuzzChecks.load(); 66 newValue = oldValue + 1; 67 } while (!s_numberOfExecutableAllocationFuzzChecks.compareExchangeWeak(oldValue, newValue)); 68 69 if (newValue == Options::fireExecutableAllocationFuzzAt()) { 67 70 if (Options::verboseExecutableAllocationFuzz()) { 68 71 dataLog("Will pretend to fail executable allocation.\n"); … … 71 74 return PretendToFailExecutableAllocation; 72 75 } 73 76 74 77 if (Options::fireExecutableAllocationFuzzAtOrAfter() 75 && n umChecks>= Options::fireExecutableAllocationFuzzAtOrAfter()) {78 && newValue >= Options::fireExecutableAllocationFuzzAtOrAfter()) { 76 79 if (Options::verboseExecutableAllocationFuzz()) { 77 80 dataLog("Will pretend to fail executable allocation.\n"); … … 79 82 } 80 83 return PretendToFailExecutableAllocation; 81 } else if (!Options::fireExecutableAllocationFuzzAt() && random.getUint32() < UINT_MAX * Options::randomIntegrityAuditRate()) 82 return PretendToFailExecutableAllocation; 84 } 83 85 84 86 return AllowNormalExecutableAllocation;
Note:
See TracChangeset
for help on using the changeset viewer.