crosvm/sys_util
Daniel Verkamp 3eeaf6a339 linux: fill pmem alignment area with anon map
Rather than mapping past the end of the file when using a pmem backing
file that is not 2 MiB aligned, use an anonymous mapping to fill the
remaining part of the arena.

This partially reverts https://crrev.com/c/2153103 while keeping the
effective change: the anonymous mapping used to fill the padding is now
added with the same protection as the file mapping.

Also handle images that are not a multiple of the page size (typically
4096 bytes) - the memory mapping on the host will handle zero-filling
reads and discarding writes past the end of the mapped file as long as
we map a size containing the partial last page.

BUG=chromium:1244217
TEST=Boot crosvm with non-2MB aligned pmem disk; read the last few bytes
TEST=./test_all

Change-Id: Ibe8da170175bb9befce924122b912a28a6dc0e7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3131444
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-09-03 20:00:13 +00:00
..
poll_token_derive Update syn, quote, and proc-macro past 1.0 2020-02-06 05:28:15 +00:00
src linux: fill pmem alignment area with anon map 2021-09-03 20:00:13 +00:00
.build_test_serial build_test: misc options, improvements, amd bug fixes 2020-10-15 13:40:32 +00:00
Cargo.toml sys_util: Switch syslog error to thiserror 2021-05-18 16:42:20 +00:00