Commit c0d26f39 authored by earthdok's avatar earthdok Committed by Commit bot

MSan: disallow uninitialized data in GLES2Implementation::BufferDataHelper.

MSan doesn't undestand shared memory, so a buffer that has been tainted with
uninitialized values would still be considered uninitialized even after a write
on the other end (the GPU). This results in confusing uninit reports in the
renderer after readback. Doing an explicit check early should make those reports
less confusing and less flaky. We might even find some real bugs!

BUG=445745
R=zmo@chromium.org

Review URL: https://codereview.chromium.org/867903004

Cr-Commit-Position: refs/heads/master@{#314098}
parent 9c9a966e
......@@ -17,6 +17,7 @@
#include <sstream>
#include <string>
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/numerics/safe_math.h"
#include "gpu/command_buffer/client/buffer_tracker.h"
#include "gpu/command_buffer/client/gpu_control.h"
......@@ -1239,6 +1240,14 @@ void GLES2Implementation::BufferDataHelper(
if (!ValidateSize("glBufferData", size))
return;
#if defined(MEMORY_SANITIZER) && !defined(OS_NACL)
// Do not upload uninitialized data. Even if it's not a bug, it can cause a
// bogus MSan report during a readback later. This is because MSan doesn't
// understand shared memory and would assume we were reading back the same
// unintialized data.
if (data) __msan_check_mem_is_initialized(data, size);
#endif
GLuint buffer_id;
if (GetBoundPixelTransferBuffer(target, "glBufferData", &buffer_id)) {
if (!buffer_id) {
......
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