lkml.org 
[lkml]   [2016]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC v1 3/4] x86, boot: Implement ASLR for kernel memory sections (x86_64)
From
Date


On 04/15/2016 06:03 PM, Thomas Garnier wrote:
> +void __init kernel_randomize_memory(void)
> +{
> + size_t i;
> + unsigned long addr = memory_rand_start;
> + unsigned long padding, rand, mem_tb;
> + struct rnd_state rnd_st;
> + unsigned long remain_padding = memory_rand_end - memory_rand_start;
> +
> + if (!kaslr_enabled())
> + return;
> +
> + /* Take the additional space when Xen is not active. */
> + if (!xen_domain())
> + page_offset_base -= __XEN_SPACE;

This should be !xen_pv_domain(). Xen HVM guests are no different from
bare metal as far as address ranges are concerned. (Technically it's
probably !xen_pv_domain() && !xen_pvh_domain() but we can ignore PVH for
now since it is being replaced by an HVM-type guest)

Having said that, I am not sure I understand why page_offset_base is
shifted. I thought 0xffff800000000000 - 0xffff87ffffffffff is not
supposed to be used by anyone, whether we are running under a hypervisor
or not.

-boris


\
 
 \ /
  Last update: 2016-04-21 15:41    [W:0.261 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site