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
3 files changed