Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Issue 702473009: Add memory corruption checking to base::File(). (Closed)

Created:
6 years, 1 month ago by gavinp
Modified:
6 years, 1 month ago
Reviewers:
pasko, Nico
CC:
chromium-reviews, erikwright+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@protect_fds
Project:
chromium
Visibility:
Public.

Description

Add memory corruption checking to base::File(). Since we crash on invalid fd in ScopedFD::Close(), memory corruption in a base::File() object can cause crashes; perhaps long after the memory is actually corrupt. This CL puts a checksum in memory near the fd on POSIX systems. The checksum is different enough to be very unlikely to be correct after a random memory write, but also very cheap to compute, so we can have most operations on a file double quickly double check its integrity, for earlier (and more useful for debugging) crashes. This is intended to help us debug issue 424562. Once we have found out if and where memory is being corrupted, this instrumentation code should be removed. R=thakis@chromium.org,pasko@chromium.org BUG=424562 Committed: https://crrev.com/32ea7f9a9a2385bd8911bf5bc37748a560a387d5 Cr-Commit-Position: refs/heads/master@{#303251}

Patch Set 1 #

Patch Set 2 : self review #

Patch Set 3 : rebase to master #

Total comments: 6

Patch Set 4 : remediate #

Patch Set 5 : build fix; ignore correctly #

Total comments: 2

Patch Set 6 : final comment fixup #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+163 lines, -1 line) Patch
M base/files/file.h View 1 2 3 3 chunks +51 lines, -1 line 0 comments Download
M base/files/file_posix.cc View 1 2 3 4 5 1 chunk +43 lines, -0 lines 2 comments Download
M base/files/file_unittest.cc View 1 2 3 4 2 chunks +69 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (2 generated)
gavinp
thakis: PTAL. As we discussed yesterday. pasko: FYI.
6 years, 1 month ago (2014-11-06 22:34:57 UTC) #1
Nico
"In file included from external/chromium_org/base/basictypes.h:18:0, from external/chromium_org/base/files/file.h:20, from external/chromium_org/base/files/file_posix.cc:5: external/chromium_org/base/files/file_posix.cc: In member function 'void base::File::MemoryCheckingScopedFD::ComputeMemoryChecksum(unsigned ...
6 years, 1 month ago (2014-11-06 22:49:35 UTC) #2
Nico
To be clear, the thinking is that this is a temporary debugging thing to help ...
6 years, 1 month ago (2014-11-06 22:53:43 UTC) #3
gavinp
Nico, Thank you so much for such a fast and thorough review. I've made a ...
6 years, 1 month ago (2014-11-06 23:52:55 UTC) #5
Nico
lgtm https://codereview.chromium.org/702473009/diff/100001/base/files/file_posix.cc File base/files/file_posix.cc (right): https://codereview.chromium.org/702473009/diff/100001/base/files/file_posix.cc#newcode508 base/files/file_posix.cc:508: // which implicitly gives us a divisor of ...
6 years, 1 month ago (2014-11-07 00:12:09 UTC) #6
gavinp
Thank you for your reviews, Nico. I'm going to let the try jobs bake a ...
6 years, 1 month ago (2014-11-07 00:37:36 UTC) #7
pasko
lgtm thank you https://codereview.chromium.org/702473009/diff/120001/base/files/file_posix.cc File base/files/file_posix.cc (right): https://codereview.chromium.org/702473009/diff/120001/base/files/file_posix.cc#newcode503 base/files/file_posix.cc:503: // By choosing constants that satisfy ...
6 years, 1 month ago (2014-11-07 12:35:03 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/702473009/120001
6 years, 1 month ago (2014-11-07 16:42:41 UTC) #10
gavinp
Thanks for your review Egor. I'm CQing this! Hopefully we'll get this to the vendor ...
6 years, 1 month ago (2014-11-07 16:47:21 UTC) #11
commit-bot: I haz the power
Committed patchset #6 (id:120001)
6 years, 1 month ago (2014-11-07 17:46:20 UTC) #12
commit-bot: I haz the power
6 years, 1 month ago (2014-11-07 17:47:10 UTC) #13
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/32ea7f9a9a2385bd8911bf5bc37748a560a387d5
Cr-Commit-Position: refs/heads/master@{#303251}

Powered by Google App Engine
This is Rietveld 408576698