|
Fix out-of-memory crashes related to ArrayBuffer allocation
Context: In the past, ArrayBuffer creation would return a null pointer
when memory allocation failed. The problem with that approach was that
not all callsites (and there are many) handle null pointers gracefully,
or check for null pointers at all. So this approach was leading to
potential security vulnerabilities. Right now, failure to allocate an
ArrayBuffer will crash the process, which is secure, but is responsible
for a significant number of crashes. As of Chrome 46, 2% of renderer
crashes on desktop are in WTF::ArrayBufferContents::allocateMemory.
This change should bring that number very close to zero.
Crash mitigation strategy:
1) In accordance with the ECMAScript specification, failure to allocate
the memory block that backs an ArrayBuffer should result in a RangeError
exception being thrown. Many API that internally create ArrayBuffers
are currently crashing instead of throwing an exception. Spec work is
ongoing on a cases by case basis to have the specs for the APIs changed
to state that exceptions thrown by the ArrayBuffer allocation step are
rethrown. These new exceptions, even if they are not caught and result
in script halting, are a much better UX than a process crash.
For example, an ill-behaved ad in an iframe will not interfere the
host page when there is an unhandled OOM condition.
2) In places that are not inside the scope of a script execution
context, we cannot throw exceptions, so we fail silently instead of
crashing if doing so is possible and makes sense.
3) Allocation of trivially small fixed size buffers are not resolved
by this change and will still crash the renderer. If it is not
possible to allocate very small objects, the process is probably doomed
anyways.
4) This patch leaves many non-trivial call sites in an unresolved state,
meaning that they will crash on allocation failure. The sites of these
potential crashes now have comments leading to crbug.com/536816,
and in some cases suggestions on possible resolution approaches.
The expectations is that these cases will be addressed as needed, based
on incoming crash reports.
Intent to ship thread:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/pZ9kld0LehA
BUG= 537903, 536816, 535136, 532337
R=binji@chromium.org
Total comments: 21
Total comments: 2
Total comments: 11
Total comments: 23
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+772 lines, -321 lines) |
Patch |
|
A |
third_party/WebKit/LayoutTests/fast/canvas/imageData-oom.html
|
View
|
|
1 chunk |
+33 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/fast/canvas/imageData-oom-expected.txt
|
View
|
1
2
3
4
|
1 chunk |
+10 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
|
View
|
1
2
3
4
5
6
|
4 chunks |
+28 lines, -7 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
|
View
|
3
4
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
|
View
|
1
2
3
4
5
|
1 chunk |
+8 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp
|
View
|
1
2
3
4
5
6
|
1 chunk |
+11 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/templates/interface.cpp
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/dom/DOMArrayBuffer.h
|
View
|
|
1 chunk |
+27 lines, -13 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
|
View
|
1
2
3
4
|
2 chunks |
+8 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/dom/DOMSharedArrayBuffer.h
|
View
|
1
2
3
4
5
6
|
1 chunk |
+13 lines, -7 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/dom/DOMTypedArray.h
|
View
|
1
|
2 chunks |
+23 lines, -7 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/fileapi/FileReader.cpp
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/fileapi/FileReaderLoader.h
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp
|
View
|
1
2
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/html/HTMLCanvasElement.h
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
View
|
1
2
3
4
|
7 chunks |
+30 lines, -9 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/html/ImageData.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/html/ImageData.cpp
|
View
|
1
2
3
4
|
3 chunks |
+12 lines, -9 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
|
View
|
1
2
3
4
|
1 chunk |
+5 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/testing/Internals.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/testing/Internals.cpp
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+7 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/testing/Internals.idl
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+4 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/bluetooth/BluetoothGATTCharacteristic.cpp
|
View
|
1
2
3
4
5
|
1 chunk |
+4 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.cpp
|
View
|
1
2
3
4
|
1 chunk |
+8 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+7 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp
|
View
|
1
2
|
1 chunk |
+5 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/crypto/CryptoKey.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp
|
View
|
1
2
3
4
5
6
|
1 chunk |
+15 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp
|
View
|
1
2
3
4
5
6
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/encoding/TextEncoder.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/encoding/TextEncoder.cpp
|
View
|
1
2
3
4
|
2 chunks |
+10 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/encoding/TextEncoder.idl
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
|
View
|
1
2
3
4
5
|
6 chunks |
+26 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
|
View
|
1
2
3
4
|
3 chunks |
+13 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/encryptedmedia/MediaKeyStatusMap.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
|
View
|
1
2
3
4
|
1 chunk |
+7 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/fetch/Body.cpp
|
View
|
1
2
3
4
5
6
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp
|
View
|
1
2
3
4
5
6
|
1 chunk |
+21 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
|
View
|
1
2
3
4
|
1 chunk |
+6 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+10 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+8 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp
|
View
|
1
2
3
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+12 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+9 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
|
View
|
1
2
3
4
5
6
7
8
|
5 chunks |
+9 lines, -9 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp
|
View
|
1
2
3
4
|
1 chunk |
+8 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
|
View
|
1
2
3
4
|
1 chunk |
+9 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
|
View
|
1
2
3
4
5
6
|
1 chunk |
+6 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
|
View
|
1
2
3
4
5
6
|
7 chunks |
+14 lines, -9 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
|
View
|
1
2
3
4
5
6
7
|
2 chunks |
+8 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
|
View
|
|
6 chunks |
+10 lines, -10 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webusb/USBInTransferResult.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/web/WebArrayBuffer.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/web/WebSocketImpl.cpp
|
View
|
1
2
3
4
|
1 chunk |
+7 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/ArrayBuffer.h
|
View
|
|
5 chunks |
+55 lines, -50 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/ArrayBuffer.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/ArrayBufferBuilder.h
|
View
|
1
|
3 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/ArrayBufferBuilder.cpp
|
View
|
1
|
4 chunks |
+16 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/ArrayBufferContents.h
|
View
|
1
|
4 chunks |
+26 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/ArrayBufferContents.cpp
|
View
|
1
|
6 chunks |
+45 lines, -14 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Float32Array.h
|
View
|
1
|
2 chunks |
+10 lines, -11 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Float64Array.h
|
View
|
|
2 chunks |
+12 lines, -10 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Int16Array.h
|
View
|
|
2 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Int32Array.h
|
View
|
|
2 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Int8Array.h
|
View
|
|
2 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/TypedArrayBase.h
|
View
|
|
2 chunks |
+25 lines, -13 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Uint16Array.h
|
View
|
|
2 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Uint32Array.h
|
View
|
|
2 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Uint8Array.h
|
View
|
|
2 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/wtf/Uint8ClampedArray.h
|
View
|
|
2 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
Depends on Patchset:
Total messages: 32 (10 generated)
|