Commit 8364fc74 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[test] Proper OOM handling for multi-mapped mock allocator

When reserving the requested virtual memory fails (due to address space
exhaustion), simply return nullptr to indicate allocation failure, which
callers must be prepared to handle anyway. That way, ClusterFuzz will
correctly classify OOM situations.
Bonus change: skip demo test on simulators to save time.
Drive-by cleanup: add a 'simulator_run' section to mjsunit.status

Bug: chromium:1042151,chromium:1042173
Change-Id: I8569f3c0d2a681fbf6f91b665dcb88a4ac3b901e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2002391Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65785}
parent 8c330260
......@@ -241,7 +241,10 @@ class MultiMappedAllocator : public ArrayBufferAllocatorBase {
void* virtual_alloc =
mmap(nullptr, rounded_length, prot, flags | MAP_NORESERVE, -1, 0);
if (reinterpret_cast<intptr_t>(virtual_alloc) == -1) {
FATAL("mmap (virtual) failed with error %d: %s", errno, strerror(errno));
// Virtual memory allocation failed, probably because the requested
// size was too big. Callers can handle this.
munmap(real_alloc, kChunkSize);
return nullptr;
}
i::Address virtual_base = reinterpret_cast<i::Address>(virtual_alloc);
i::Address virtual_end = virtual_base + rounded_length;
......
......@@ -136,15 +136,11 @@
'wasm/embenchen/*': [PASS, SLOW],
'wasm/grow-memory': [PASS, SLOW],
'wasm/unreachable-validation': [PASS, SLOW],
'wasm/atomics-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['(arch == arm or arch == arm64) and simulator_run', SKIP], ['tsan', SKIP]],
'wasm/atomics64-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['(arch == arm or arch == arm64) and simulator_run', SKIP], ['tsan', SKIP]],
'wasm/atomics-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['tsan', SKIP]],
'wasm/atomics64-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['tsan', SKIP]],
'wasm/compare-exchange-stress': [PASS, SLOW, NO_VARIANTS],
'wasm/compare-exchange64-stress': [PASS, SLOW, NO_VARIANTS],
# Too slow in simulators.
'regress/regress-crbug-941743': [PASS, ['simulator_run', SKIP]],
'random-bit-correlations': [PASS, ['simulator_run', SLOW]],
# Very slow on ARM and MIPS, contains no architecture dependent code.
'unicode-case-overoptimization': [PASS, NO_VARIANTS, ['arch in (arm, arm64, mipsel, mips64el, mips64, mips)', SKIP]],
'regress/regress-3976': [PASS, NO_VARIANTS, ['arch in (arm, arm64, mipsel, mips64el, mips64, mips)', SKIP]],
......@@ -160,8 +156,7 @@
# OOM with too many isolates/memory objects (https://crbug.com/1010272)
# Predictable tests fail due to race between postMessage and GrowMemory
# Agressively skipping test for variants, and simulator runs.
'regress/wasm/regress-1010272': [PASS, NO_VARIANTS, ['simulator_run', SKIP], ['system == android', SKIP], ['predictable', SKIP]],
'regress/wasm/regress-1010272': [PASS, NO_VARIANTS, ['system == android', SKIP], ['predictable', SKIP]],
}], # ALWAYS
##############################################################################
......@@ -198,12 +193,12 @@
'regress/regress-752764': [SLOW],
}], # mode == debug
['novfp3 == True', {
['novfp3', {
'asm/embenchen/box2d': [SKIP],
'asm/embenchen/zlib': [SKIP],
'asm/embenchen/memops': [SKIP],
'asm/embenchen/lua_binarytrees': [SKIP],
}], # novfp3 == True
}], # novfp3
##############################################################################
# TODO(ahaas): Port multiple return values to MIPS, S390 and PPC
......@@ -212,7 +207,18 @@
}],
##############################################################################
['gc_stress == True', {
['simulator_run', {
# Skip/annotate tests that are too slow on simulators.
'random-bit-correlations': [SLOW],
'regress/regress-crbug-941743': [SKIP],
'regress/regress-crbug-1041232': [SKIP],
'regress/wasm/regress-1010272': [SKIP],
'wasm/atomics-stress': [SKIP],
'wasm/atomics64-stress': [SKIP],
}], # simulator_run
##############################################################################
['gc_stress', {
# Skip tests not suitable for GC stress.
'allocation-site-info': [SKIP],
'array-constructor-feedback': [SKIP],
......@@ -286,7 +292,7 @@
# BUG(v8:10035)
'compiler/deopt-array-builtins': [SKIP],
}], # 'gc_stress == True'
}], # 'gc_stress'
##############################################################################
['lite_mode or variant == jitless', {
......@@ -492,7 +498,6 @@
['arch == arm64 and simulator_run', {
'compiler/osr-big': [PASS, SLOW],
'regress/regress-454725': [PASS, SLOW],
'regress/regress-crbug-1041232': [PASS, ['not pointer_compression', SLOW]],
'try': [PASS, SLOW],
'non-extensible-array-reduce': [PASS, SLOW],
}], # 'arch == arm64 and simulator_run'
......@@ -748,11 +753,6 @@
'regress/regress-779407': [SKIP],
}], # 'arch == mips64el or arch == mips64'
['(arch == mips64el or arch == mips64) and simulator_run', {
# Slow tests which have flaky timeout on simulator.
'wasm/atomics64-stress': [SKIP],
}], # '(arch == mips64el or arch == mips64) and simulator_run'
##############################################################################
['system == windows', {
# Too slow with turbo fan.
......@@ -944,8 +944,6 @@
'harmony/regexp-property-lu-ui': [PASS, SLOW],
'whitespaces': [PASS, SLOW],
'generated-transition-stub': [PASS, SLOW],
'wasm/atomics-stress': [SKIP],
'wasm/atomics64-stress': [SKIP],
}], # 'simulator_run and (arch in [ppc64, s390x])'
##############################################################################
......
......@@ -33,3 +33,6 @@ assertEquals(undefined, a[kSize]);
assertEquals(undefined, a[kSize + 1]);
assertEquals(undefined, a[kSize + kChunkSize]);
assertEquals(undefined, a[kSize + kSize]);
// Check that excessive requests throw (crbug.com/1042173, crbug.com/1042151).
assertThrows(() => new ArrayBuffer(Number.MAX_SAFE_INTEGER));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment