[PATCH] D137666: [msan] Increase size of app/shadow/origin mappings on aarch64

Thurston Dang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 08:30:30 PST 2022


thurston added a comment.

In D137666#3919581 <https://reviews.llvm.org/D137666#3919581>, @eugenis wrote:

> Sorry, I don't follow. What is limited to 64Gb (the sum of all app regions? why does it matter?) and why can't an "invalid" region be mapped?

msan.h defines the "invalid" regions (anything except the app/origin/shadow), which msan will mprotect. If an app allocates memory outside of msan's expected app regions, msan will refuse to mprotect the invalid region (because it overlaps with the app's existing allocations). To fix this, I increased the app regions (and updated the invalid/origin/shadow regions accordingly).

Increasing the app regions will also increase the shadow and origin regions (they are exactly the same sizes). Since the origin region is calculated as shadow region + 0x1000000000ULL (64GB), if the region size is larger than 64GB, the start of the shadow region will overlap with the end of the origin region. The SHADOW_TO_ORIGIN constant therefore imposes a 64GB limit on the size of each contiguous region. I therefore increased this constant, as well as the MEM_TO_SHADOW XOR constant (which imposes a 384GB limit).



================
Comment at: compiler-rt/lib/msan/msan.h:118
 };
 # define MEM_TO_SHADOW(mem) ((uptr)mem ^ 0x6000000000ULL)
 # define SHADOW_TO_ORIGIN(shadow) (((uptr)(shadow)) + 0x1000000000ULL)
----------------
vitalybuka wrote:
> What about this one?
Good catch, thanks. It got lost in the g3 -> llvm diff migration. I'll upload a new diff with arc.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137666/new/

https://reviews.llvm.org/D137666



More information about the llvm-commits mailing list