arm64: update the "minimum maximum" comment.

Noticed while looking at riscv64. Looks like a bug, but actually nothing
we can do about it now or for the foreseeable future.

Bug: https://github.com/google/android-riscv64/issues/45
Test: treehugger
Change-Id: I2be81b2fd7095df40958a1f641d7b89cf5a8e41d
This commit is contained in:
Elliott Hughes 2023-09-19 18:40:03 +00:00
parent 720007ba43
commit 6bc53ff7dd

View file

@ -106,13 +106,9 @@ Result<void> SetMmapRndBitsAction(const BuiltinArguments&) {
// uml does not support mmap_rnd_bits
return {};
#elif defined(__aarch64__)
// arm64 architecture supports 18 - 33 rnd bits depending on pagesize and
// VA_SIZE. However the kernel might have been compiled with a narrower
// range using CONFIG_ARCH_MMAP_RND_BITS_MIN/MAX. To use the maximum
// supported number of bits, we start from the theoretical maximum of 33
// bits and try smaller values until we reach 24 bits which is the
// Android-specific minimum. Don't go lower even if the configured maximum
// is smaller than 24.
// arm64 supports 14 - 33 rnd bits depending on page size and ARM64_VA_BITS.
// The kernel (6.5) still defaults to 39 va bits for 4KiB pages, so shipping
// devices are only getting 24 bits of randomness in practice.
if (SetMmapRndBitsMin(33, 24, false) && (!Has32BitAbi() || SetMmapRndBitsMin(16, 16, true))) {
return {};
}