# HG changeset patch # Parent 98fe3b2a572d4ffe704124e75c7aa8d94dbb51bc kexec: clear notes during setup Explicity zero the memory backing the crash notes during setup. This allows the crash environment to be rather more certain whether the crash notes were actually written, rather than trusting that the memory was clear beforehand. Signed-off-by: Andrew Cooper diff -r 98fe3b2a572d xen/common/kexec.c --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -401,7 +401,7 @@ static int kexec_init_cpu_notes(const un /* If we dont care about the position of allocation, malloc. */ if ( low_crashinfo_mode == LOW_CRASHINFO_NONE ) - note = xmalloc_bytes(nr_bytes); + note = xzalloc_bytes(nr_bytes); /* Protect the write into crash_notes[] with a spinlock, as this function * is on a hotplug path and a hypercall path. */ @@ -505,7 +505,7 @@ static int __init kexec_init(void) if ( low_crashinfo_mode > LOW_CRASHINFO_NONE ) { - size_t crash_heap_size; + size_t crash_heap_size, i; /* This calculation is safe even if the machine is booted in * uniprocessor mode. */ @@ -520,6 +520,9 @@ static int __init kexec_init(void) if ( ! crash_heap_current ) return -ENOMEM; + for ( i=0; i< (crash_heap_size >> PAGE_SHIFT); ++i ) + clear_page(crash_heap_current + (i << PAGE_SHIFT)); + crash_heap_end = crash_heap_current + crash_heap_size; }