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

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

Cr-Commit-Position: refs/heads/master@{#303251}


CrOS-Libchrome-Original-Commit: 32ea7f9a9a2385bd8911bf5bc37748a560a387d5
3 files changed
tree: 49321ed4e45606758fb8aff079893cad8abaa789
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/