xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address
@ 2018-08-16 15:27 Andrew Cooper
  2018-08-16 15:45 ` Roger Pau Monné
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Cooper @ 2018-08-16 15:27 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich, Roger Pau Monné

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>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 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 727dad4..8d0f6f1 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -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
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address
  2018-08-16 15:27 [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address Andrew Cooper
@ 2018-08-16 15:45 ` Roger Pau Monné
  2018-08-16 15:57 ` Jan Beulich
  2018-08-16 17:02 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2018-08-16 15:45 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Wei Liu, Jan Beulich, Xen-devel

On Thu, Aug 16, 2018 at 04:27:57PM +0100, Andrew Cooper 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.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address
  2018-08-16 15:27 [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address Andrew Cooper
  2018-08-16 15:45 ` Roger Pau Monné
@ 2018-08-16 15:57 ` Jan Beulich
  2018-08-16 17:02 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2018-08-16 15:57 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Xen-devel, Wei Liu, Roger Pau Monne

>>> On 16.08.18 at 17:27, <andrew.cooper3@citrix.com> 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.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address
  2018-08-16 15:27 [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address Andrew Cooper
  2018-08-16 15:45 ` Roger Pau Monné
  2018-08-16 15:57 ` Jan Beulich
@ 2018-08-16 17:02 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2018-08-16 17:02 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Roger Pau Monné, Wei Liu, Jan Beulich, Xen-devel

On Thu, Aug 16, 2018 at 04:27:57PM +0100, Andrew Cooper 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.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-16 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-16 15:27 [PATCH] x86/setup: Avoid OoB E820 lookup when calculating the L1TF safe address Andrew Cooper
2018-08-16 15:45 ` Roger Pau Monné
2018-08-16 15:57 ` Jan Beulich
2018-08-16 17:02 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).