Skip to contentSkip to conversation

xen/arm: Scrub heap pages during boot

PATCH Applied Julien Grall 2 participants 6 messages Jan 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Scrub heap pages during boot

Scrub heap pages was disabled because it was slow on the models. Now that Xen supports real hardware, it's possible to enable by default scrubbing.

---
This patch should go to Xen 4.4. It avoid to give non-cleared page to a domain.

The downside is it's now slow on models.

The current implementation of scrub_heap_pages loop on every page in the frametable. On ARM, there is only which can contains MMIO. We are safe because when frametable is initialized, page are marked inuse. So the function won't clear theses pages.

---
 xen/arch/arm/setup.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
xen/arch/arm/setup.c +2 -4
index 9fc40c8..d7c7f4d 100644
@@ -764,10 +764,8 @@ void __init start_xen(unsigned long boot_phys_offset,
     if ( construct_dom0(dom0) != 0)
             panic("Could not set up DOM0 guest OS");
 
-    /* Scrub RAM that is still free and so may go to an unprivileged domain.
-       XXX too slow in simulator
-       scrub_heap_pages();
-    */
+    /* Scrub RAM that is still free and so may go to an unprivileged domain. */
+    scrub_heap_pages();
 
     init_constructors();
 
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Julien Grall

Scrub heap pages was disabled because it was slow on the models. Now that Xen supports real hardware, it's possible to enable by default scrubbing.

Quoted 5 lines

---
This patch should go to Xen 4.4. It avoid to give non-cleared page to a domain.

The downside is it's now slow on models.

There is a no-bootscrub command-line option which can be used in that case. Could you update the relevant model wiki pages to mention it please?

Quoted 4 lines

The current implementation of scrub_heap_pages loop on every page in the frametable. On ARM, there is only which can contains MMIO. We are safe because when frametable is initialized, page are marked inuse. So the function won't clear theses pages.

I don't think this behaviour is specific to ARM, x86 has MMIO regions mixed in with RAM as well.

Quoted 1 line

From an RM PoV I think this is a necessary fix since it can otherwise

potentially leak information from a previous boot. I also think it is low risk, nothing should have been relying on non-zero content of any page.

Quoted 21 lines
---
 xen/arch/arm/setup.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
xen/arch/arm/setup.c +2 -4
index 9fc40c8..d7c7f4d 100644
@@ -764,10 +764,8 @@ void __init start_xen(unsigned long boot_phys_offset,
     if ( construct_dom0(dom0) != 0)
             panic("Could not set up DOM0 guest OS");
 
-    /* Scrub RAM that is still free and so may go to an unprivileged domain.
-       XXX too slow in simulator
-       scrub_heap_pages();
-    */
+    /* Scrub RAM that is still free and so may go to an unprivileged domain. */
+    scrub_heap_pages();
 
     init_constructors();
 
#2 lore raw
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Julien Grall

Scrub heap pages was disabled because it was slow on the models. Now that Xen supports real hardware, it's possible to enable by default scrubbing.

Thanks.

Quoted 9 lines
Quoted 5 lines

---
This patch should go to Xen 4.4. It avoid to give non-cleared page to a domain.

The downside is it's now slow on models.

There is a no-bootscrub command-line option which can be used in that case. Could you update the relevant model wiki pages to mention it please?

I have updated the wiki page.

Quoted 8 lines
Quoted 5 lines

The current implementation of scrub_heap_pages loop on every page in the frametable. On ARM, there is only which can contains MMIO. We are safe because when frametable is initialized, page are marked inuse. So the function won't clear theses pages.

I don't think this behaviour is specific to ARM, x86 has MMIO regions mixed in with RAM as well.

I was not sure, so I prefered to explain why it's ok.

Signature · 1 line
Julien Grall
Applied
#3 lore raw
Quoted 11 lines · Julien Grall
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Julien Grall

Scrub heap pages was disabled because it was slow on the models. Now that Xen supports real hardware, it's possible to enable by default scrubbing.

Thanks.

Applied.

Quoted 11 lines
Quoted 9 lines
Quoted 5 lines

---
This patch should go to Xen 4.4. It avoid to give non-cleared page to a domain.

The downside is it's now slow on models.

There is a no-bootscrub command-line option which can be used in that case. Could you update the relevant model wiki pages to mention it please?

I have updated the wiki page.

Thanks.

#4 lore raw
Quoted 21 lines · Ian Campbell
Quoted 11 lines · Julien Grall
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Julien Grall

Scrub heap pages was disabled because it was slow on the models. Now that Xen supports real hardware, it's possible to enable by default scrubbing.

Thanks.

Applied.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

---
This patch should go to Xen 4.4. It avoid to give non-cleared page to a domain.

The downside is it's now slow on models.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

There is a no-bootscrub command-line option which can be used in that case. Could you update the relevant model wiki pages to mention it please?

I have updated the wiki page.

Thanks.

You made it say "comment out the code" rather than advising to use the command line option like I suggested -- was that on purpose?

Is something broken with the command line option?

Ian

#5 lore raw
Quoted 26 lines · Ian Campbell
Quoted 25 lines · Ian Campbell
Quoted 11 lines · Julien Grall
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Julien Grall

Scrub heap pages was disabled because it was slow on the models. Now that Xen supports real hardware, it's possible to enable by default scrubbing.

Thanks.

Applied.

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

---
This patch should go to Xen 4.4. It avoid to give non-cleared page to a domain.

The downside is it's now slow on models.

There is a no-bootscrub command-line option which can be used in that case. Could you update the relevant model wiki pages to mention it please?

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I have updated the wiki page.

Thanks.

You made it say "comment out the code" rather than advising to use the command line option like I suggested -- was that on purpose?

Is something broken with the command line option?

No, I thought we will need to create a command line. I will update the wiki page.

Signature · 1 line
Julien Grall