OSDN Git Service

base: make SafeCopy work on older Linux kernels.
authorJosh Gao <jmgao@google.com>
Wed, 19 Apr 2017 22:44:20 +0000 (15:44 -0700)
committerJosh Gao <jmgao@google.com>
Thu, 20 Apr 2017 01:18:16 +0000 (18:18 -0700)
commit9a2eea3e6fe2dce60935f312b6a32d25a9ed2187
tree17aa7f5238d880cb0f27c9cca6a89c19a596f950
parent6c99499c8a3bad181847d6bdfe28dae06e09477b
base: make SafeCopy work on older Linux kernels.

process_vm_readv is documented to not split transfer across a single
iovec element, but this appears to not be the case for the newer
kernels we have on our workstations.

Split up transfers across page boundaries, to avoid this. This has the
side effect of limiting the maximum size of a transfer, but 64 pages
ought to be enough for anybody.

Test: safe_copy_test on 3.13.0-101-generic (failing before)
Test: safe_copy_test on 4.4.0-66-generic (still passing)
Change-Id: I6a6dbf0cd2aeaa7eab39f6d41285d46ebd760e30
runtime/base/safe_copy.cc
runtime/base/safe_copy.h
runtime/base/safe_copy_test.cc