File 5b75afef-x86-setup-avoid-OoB-E820-lookup.patch of Package xen.10697
# Commit 3e4ec07e14bce81f6ae22c31ff1302d1f297a226
# Date 2018-08-16 18:10:07 +0100
# Author Andrew Cooper <andrew.cooper3@citrix.com>
# Committer Andrew Cooper <andrew.cooper3@citrix.com>
x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address
A number of corner cases (most obviously, no-real-mode and no Multiboot memory
map) can end up with e820_raw.nr_map being 0, at which point the L1TF
calculation will underflow.
Spotted by Coverity.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -805,7 +805,7 @@ void __init __start_xen(unsigned long mb
/* Sanitise the raw E820 map to produce a final clean version. */
max_page = raw_max_page = init_e820(memmap_type, e820_raw, &e820_raw_nr);
- if ( !efi_enabled )
+ if ( !efi_enabled && e820_raw_nr >= 1 )
{
/*
* Supplement the heuristics in l1tf_calculations() by assuming that