sandbox::TouchMemory now doesn't destroy input buffer

Windows 10 RS4 (maybe older as well) x64 implementation of CopyFile expects
that the HANDLE passed to NtCreateFile is not modified upon error. Old
implementation of TouchMemory 'destroys' the buffer before passing it to
the broker. This can be fixed by first reading the original value and then
restoring back at the original place. This has to be done carefully so
optimizer won't remove the code.

R=wfh@chromium.org

Bug: 839775
Change-Id: Iff80f3a5f145b85da2f0ba500e74387fce4e0e4b
Reviewed-on: https://chromium-review.googlesource.com/1061460
Reviewed-by: Will Harris <wfh@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#559279}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9466f2db2d1d17d12ba472a57a3382bb20dc196e
3 files changed
tree: 9d3658720edace3ed0e962528ae0d26ec9e61011
  1. linux/
  2. mac/
  3. win/
  4. BUILD.gn
  5. features.gni
  6. ipc.dict
  7. OWNERS
  8. sandbox_export.h