The VM region is [kLowMemBegin, kHighMemEnd] (note the inclusive
ranges). Thus the size of the region is
kHighMemEnd - kLowMemBegin + 1
Note kLowMemBegin is assumed to be 0 so the size that should be
passed to MemToShadowSize() should be kHighMemEnd + 1, not
The overall effect of this bug is we were requesting a shadow memory 1-byte
smaller than required. This is due to the way kHighMemEnd is aligned (adding +1
changes bits that aren't removed by doing >> SHADOW_SCALE).
This latent bug was likely hidden because the shadow memory size is
always page aligned due to being allocated by mmap.
Note this bug was present before the refactor introduced by
5d2be1a18845. However, the refactor preserved it.