Skip to contentSkip to conversation

x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address

PATCH In review Andrew Cooper 4 participants 4 messages Aug 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/setup.c +1 -1
index 727dad4..8d0f6f1 100644
@@ -913,7 +913,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
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Andrew Cooper

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.

Thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 16.08.18 at 17:27, <[email protected]> wrote:

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel