Hi Markus & Kees,

On 2018/12/17 0:56, Markus F.X.J. Oberhumer wrote:
> Yueyi,
>
> if ASLR does indeed exclude the last page (like it should), how do
> you get the invalid (0xfffffffffffff000, 4096) mapping then?
Regarding following code, seems ASLR is align to ARM64_MEMSTART_ALIGN,I
don`t think it will exclude the top 4K address space.

```
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
         extern u16 memstart_offset_seed;
         u64 range = linear_region_size -
                    (bootloader_memory_limit - memblock_start_of_DRAM());

         /*
          * If the size of the linear region exceeds, by a sufficient
          * margin, the size of the region that the available physical
          * memory spans, randomize the linear region as well.
          */
         if (memstart_offset_seed > 0 && range >= ARM64_MEMSTART_ALIGN) {
                 range = range / ARM64_MEMSTART_ALIGN + 1;
                 memstart_addr -= ARM64_MEMSTART_ALIGN *
                                  ((range * memstart_offset_seed) >> 16);
         }
}
```

Thanks,
Yueyi

Reply via email to