[xen staging-4.11] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen staging-4.11] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address

patchbot
commit a07f444502ad8358e019cf0ae37a3e4b205467b4
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Fri Sep 14 13:04:07 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Fri Sep 14 13:04:07 2018 +0200

    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 <[hidden email]>
    Reviewed-by: Roger Pau Monné <[hidden email]>
    Reviewed-by: Jan Beulich <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    master commit: 3e4ec07e14bce81f6ae22c31ff1302d1f297a226
    master date: 2018-08-16 18:10:07 +0100
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 3cd3e81b30..2860c425ef 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -912,7 +912,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     /* Sanitise the raw E820 map to produce a final clean version. */
     max_page = raw_max_page = init_e820(memmap_type, &e820_raw);
 
-    if ( !efi_enabled(EFI_BOOT) )
+    if ( !efi_enabled(EFI_BOOT) && e820_raw.nr_map >= 1 )
     {
         /*
          * Supplement the heuristics in l1tf_calculations() by assuming that
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog