All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: drop setup_idle_pagetable()
@ 2013-06-12 14:59 Jan Beulich
  2013-06-12 15:06 ` Andrew Cooper
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jan Beulich @ 2013-06-12 14:59 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]

With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for
the idle domain, this creates an invalid L4 entry (due to translating
a NULL struct page_info pointer to a physical address).

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

--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -185,7 +185,6 @@ static void __init init_idle_domain(void
     scheduler_init();
     set_current(idle_vcpu[0]);
     this_cpu(curr_vcpu) = current;
-    setup_idle_pagetable();
 }
 
 void __devinit srat_detect_node(int cpu)
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -810,14 +810,6 @@ void __init paging_init(void)
     panic("Not enough memory for m2p table\n");    
 }
 
-void __init setup_idle_pagetable(void)
-{
-    /* Install per-domain mappings for idle domain. */
-    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
-              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
-                            __PAGE_HYPERVISOR));
-}
-
 void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
-void setup_idle_pagetable(void);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_PRESENT  _AC(0x001,U)




[-- Attachment #2: x86-drop-setup-idle-pagetable.patch --]
[-- Type: text/plain, Size: 1505 bytes --]

x86: drop setup_idle_pagetable()

With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for
the idle domain, this creates an invalid L4 entry (due to translating
a NULL struct page_info pointer to a physical address).

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

--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -185,7 +185,6 @@ static void __init init_idle_domain(void
     scheduler_init();
     set_current(idle_vcpu[0]);
     this_cpu(curr_vcpu) = current;
-    setup_idle_pagetable();
 }
 
 void __devinit srat_detect_node(int cpu)
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -810,14 +810,6 @@ void __init paging_init(void)
     panic("Not enough memory for m2p table\n");    
 }
 
-void __init setup_idle_pagetable(void)
-{
-    /* Install per-domain mappings for idle domain. */
-    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
-              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
-                            __PAGE_HYPERVISOR));
-}
-
 void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
-void setup_idle_pagetable(void);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_PRESENT  _AC(0x001,U)

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH] x86: drop setup_idle_pagetable()
  2013-06-12 14:59 [PATCH] x86: drop setup_idle_pagetable() Jan Beulich
@ 2013-06-12 15:06 ` Andrew Cooper
  2013-06-12 15:12 ` Keir Fraser
  2013-06-12 15:14 ` George Dunlap
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2013-06-12 15:06 UTC (permalink / raw)
  To: Jan Beulich; +Cc: George Dunlap, Keir (Xen.org), xen-devel

On 12/06/13 15:59, Jan Beulich wrote:
> With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for
> the idle domain, this creates an invalid L4 entry (due to translating
> a NULL struct page_info pointer to a physical address).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Is it perhaps prudent to extend some of the $FOO_from_page() macros to
guard against NULL pointers in debug builds?

~Andrew

>
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -185,7 +185,6 @@ static void __init init_idle_domain(void
>      scheduler_init();
>      set_current(idle_vcpu[0]);
>      this_cpu(curr_vcpu) = current;
> -    setup_idle_pagetable();
>  }
>  
>  void __devinit srat_detect_node(int cpu)
> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -810,14 +810,6 @@ void __init paging_init(void)
>      panic("Not enough memory for m2p table\n");    
>  }
>  
> -void __init setup_idle_pagetable(void)
> -{
> -    /* Install per-domain mappings for idle domain. */
> -    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
> -              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
> -                            __PAGE_HYPERVISOR));
> -}
> -
>  void __init zap_low_mappings(void)
>  {
>      BUG_ON(num_online_cpus() != 1);
> --- a/xen/include/asm-x86/page.h
> +++ b/xen/include/asm-x86/page.h
> @@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
>  extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
>      l1_fixmap[L1_PAGETABLE_ENTRIES];
>  void paging_init(void);
> -void setup_idle_pagetable(void);
>  #endif /* !defined(__ASSEMBLY__) */
>  
>  #define _PAGE_PRESENT  _AC(0x001,U)
>
>
>

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

* Re: [PATCH] x86: drop setup_idle_pagetable()
  2013-06-12 14:59 [PATCH] x86: drop setup_idle_pagetable() Jan Beulich
  2013-06-12 15:06 ` Andrew Cooper
@ 2013-06-12 15:12 ` Keir Fraser
  2013-06-12 15:14 ` George Dunlap
  2 siblings, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2013-06-12 15:12 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: George Dunlap

On 12/06/2013 15:59, "Jan Beulich" <JBeulich@suse.com> wrote:

> With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for
> the idle domain, this creates an invalid L4 entry (due to translating
> a NULL struct page_info pointer to a physical address).
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -185,7 +185,6 @@ static void __init init_idle_domain(void
>      scheduler_init();
>      set_current(idle_vcpu[0]);
>      this_cpu(curr_vcpu) = current;
> -    setup_idle_pagetable();
>  }
>  
>  void __devinit srat_detect_node(int cpu)
> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -810,14 +810,6 @@ void __init paging_init(void)
>      panic("Not enough memory for m2p table\n");
>  }
>  
> -void __init setup_idle_pagetable(void)
> -{
> -    /* Install per-domain mappings for idle domain. */
> -    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
> -              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
> -                            __PAGE_HYPERVISOR));
> -}
> -
>  void __init zap_low_mappings(void)
>  {
>      BUG_ON(num_online_cpus() != 1);
> --- a/xen/include/asm-x86/page.h
> +++ b/xen/include/asm-x86/page.h
> @@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
>  extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
>      l1_fixmap[L1_PAGETABLE_ENTRIES];
>  void paging_init(void);
> -void setup_idle_pagetable(void);
>  #endif /* !defined(__ASSEMBLY__) */
>  
>  #define _PAGE_PRESENT  _AC(0x001,U)
> 
> 
> 

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

* Re: [PATCH] x86: drop setup_idle_pagetable()
  2013-06-12 14:59 [PATCH] x86: drop setup_idle_pagetable() Jan Beulich
  2013-06-12 15:06 ` Andrew Cooper
  2013-06-12 15:12 ` Keir Fraser
@ 2013-06-12 15:14 ` George Dunlap
  2013-06-12 15:25   ` Keir Fraser
  2 siblings, 1 reply; 5+ messages in thread
From: George Dunlap @ 2013-06-12 15:14 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Keir Fraser, xen-devel

On 12/06/13 15:59, Jan Beulich wrote:
> With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for
> the idle domain, this creates an invalid L4 entry (due to translating
> a NULL struct page_info pointer to a physical address).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

I don't think it buys very much awesomeness, but it should certainly be 
pretty low risk.

Acked-by: George Dunlap <george.dunlap@eu.citrix.com>

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

* Re: [PATCH] x86: drop setup_idle_pagetable()
  2013-06-12 15:14 ` George Dunlap
@ 2013-06-12 15:25   ` Keir Fraser
  0 siblings, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2013-06-12 15:25 UTC (permalink / raw)
  To: George Dunlap, Jan Beulich; +Cc: xen-devel

On 12/06/2013 16:14, "George Dunlap" <george.dunlap@eu.citrix.com> wrote:

> On 12/06/13 15:59, Jan Beulich wrote:
>> With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for
>> the idle domain, this creates an invalid L4 entry (due to translating
>> a NULL struct page_info pointer to a physical address).
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> I don't think it buys very much awesomeness, but it should certainly be
> pretty low risk.
> 
> Acked-by: George Dunlap <george.dunlap@eu.citrix.com>

Pagetable entries pointing into the wilderness are actively dangerous. At
the very least they can cause cache-attribute collisions. This is a real bug
fix.

 -- Keir

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

end of thread, other threads:[~2013-06-12 15:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 14:59 [PATCH] x86: drop setup_idle_pagetable() Jan Beulich
2013-06-12 15:06 ` Andrew Cooper
2013-06-12 15:12 ` Keir Fraser
2013-06-12 15:14 ` George Dunlap
2013-06-12 15:25   ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.