xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation
@ 2016-07-19 17:15 Jonathan Daugherty
  2016-07-19 17:15 ` [PATCH 2/2] arm/traps: fix bug in dump_guest_s1_walk handling of level 2 page tables Jonathan Daugherty
  2016-07-20 12:23 ` [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation Julien Grall
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Daugherty @ 2016-07-19 17:15 UTC (permalink / raw)
  To: xen-devel; +Cc: julien.grall, sstabellini, Jonathan Daugherty

The dump_guest_s1_walk function was incorrectly using the top 10 bits of
the virtual address to select the L1 page table index.  The correct
amount is 12 bits, resulting in a shift of 20 bits rather than 22.

For more details, see the ARMv7-A ARM, section B3.5, "Short-descriptor
translation table format."

Signed-off-by: Jonathan Daugherty <jtd@galois.com>
---
 xen/arch/arm/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index a2eb1da..0c10c4d 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2346,7 +2346,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
     }
     first = map_domain_page(mfn);
 
-    offset = addr >> (12+10);
+    offset = addr >> (12+8);
     printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
            offset, pfn_to_paddr(mfn_x(mfn)), first[offset]);
     if ( !(first[offset] & 0x1) ||
-- 
2.9.2


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

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

* [PATCH 2/2] arm/traps: fix bug in dump_guest_s1_walk handling of level 2 page tables
  2016-07-19 17:15 [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation Jonathan Daugherty
@ 2016-07-19 17:15 ` Jonathan Daugherty
  2016-07-20 12:25   ` Julien Grall
  2016-07-20 12:23 ` [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation Julien Grall
  1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Daugherty @ 2016-07-19 17:15 UTC (permalink / raw)
  To: xen-devel; +Cc: julien.grall, sstabellini, Jonathan Daugherty

dump_guest_s1_walk intends to walk to level 2 page table entries but
was failing to do so because of a check that caused level 2 page table
descriptors to be ignored. This change fixes the check so that level 2
page table walks occur as intended by ignoring descriptors unless their
low two bits match the expected sequence [0,1].

For more information, see the ARMv7-A ARM, section B3.5.

Signed-off-by: Jonathan Daugherty <jtd@galois.com>
---
 xen/arch/arm/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 0c10c4d..dfb1949 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2350,7 +2350,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
     printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
            offset, pfn_to_paddr(mfn_x(mfn)), first[offset]);
     if ( !(first[offset] & 0x1) ||
-         !(first[offset] & 0x2) )
+          (first[offset] & 0x2) )
         goto done;
 
     mfn = p2m_lookup(d, _gfn(paddr_to_pfn(first[offset])), NULL);
-- 
2.9.2


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

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

* Re: [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation
  2016-07-19 17:15 [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation Jonathan Daugherty
  2016-07-19 17:15 ` [PATCH 2/2] arm/traps: fix bug in dump_guest_s1_walk handling of level 2 page tables Jonathan Daugherty
@ 2016-07-20 12:23 ` Julien Grall
  1 sibling, 0 replies; 5+ messages in thread
From: Julien Grall @ 2016-07-20 12:23 UTC (permalink / raw)
  To: Jonathan Daugherty, xen-devel; +Cc: sstabellini

Hi Jonathan,

Thank you for sending the bug fix.

On 19/07/16 18:15, Jonathan Daugherty wrote:
> The dump_guest_s1_walk function was incorrectly using the top 10 bits of
> the virtual address to select the L1 page table index.  The correct
> amount is 12 bits, resulting in a shift of 20 bits rather than 22.
>
> For more details, see the ARMv7-A ARM, section B3.5, "Short-descriptor

NIT: Could you specify the version of the spec (i.e something similar to 
ARM DDI 0406C.c)?

> translation table format."
>
> Signed-off-by: Jonathan Daugherty <jtd@galois.com>

With the suggestion above:

Reviewed-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  xen/arch/arm/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index a2eb1da..0c10c4d 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -2346,7 +2346,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
>      }
>      first = map_domain_page(mfn);
>
> -    offset = addr >> (12+10);
> +    offset = addr >> (12+8);
>      printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
>             offset, pfn_to_paddr(mfn_x(mfn)), first[offset]);
>      if ( !(first[offset] & 0x1) ||
>

-- 
Julien Grall

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

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

* Re: [PATCH 2/2] arm/traps: fix bug in dump_guest_s1_walk handling of level 2 page tables
  2016-07-19 17:15 ` [PATCH 2/2] arm/traps: fix bug in dump_guest_s1_walk handling of level 2 page tables Jonathan Daugherty
@ 2016-07-20 12:25   ` Julien Grall
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Grall @ 2016-07-20 12:25 UTC (permalink / raw)
  To: Jonathan Daugherty, xen-devel; +Cc: sstabellini



On 19/07/16 18:15, Jonathan Daugherty wrote:
> dump_guest_s1_walk intends to walk to level 2 page table entries but
> was failing to do so because of a check that caused level 2 page table
> descriptors to be ignored. This change fixes the check so that level 2
> page table walks occur as intended by ignoring descriptors unless their
> low two bits match the expected sequence [0,1].
>
> For more information, see the ARMv7-A ARM, section B3.5.

NIT: Could you specify the version of the spec (i.e something similar to 
ARM DDI 0406C.c)?

Also, to be precise the section would be B3.5.1.

>
> Signed-off-by: Jonathan Daugherty <jtd@galois.com>

Reviewed-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  xen/arch/arm/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 0c10c4d..dfb1949 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -2350,7 +2350,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
>      printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
>             offset, pfn_to_paddr(mfn_x(mfn)), first[offset]);
>      if ( !(first[offset] & 0x1) ||
> -         !(first[offset] & 0x2) )
> +          (first[offset] & 0x2) )
>          goto done;
>
>      mfn = p2m_lookup(d, _gfn(paddr_to_pfn(first[offset])), NULL);
>

-- 
Julien Grall

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

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

* [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation
@ 2016-07-20 16:10 Jonathan Daugherty
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Daugherty @ 2016-07-20 16:10 UTC (permalink / raw)
  To: xen-devel; +Cc: julien.grall, sstabellini, Jonathan Daugherty

The dump_guest_s1_walk function was incorrectly using the top 10 bits of
the virtual address to select the L1 page table index.  The correct
amount is 12 bits, resulting in a shift of 20 bits rather than 22.

For more details, see the ARMv7-A ARM DDI 0406C.b, section B3.5,
"Short-descriptor translation table format."

Signed-off-by: Jonathan Daugherty <jtd@galois.com>
---
 xen/arch/arm/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index a2eb1da..0c10c4d 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2346,7 +2346,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
     }
     first = map_domain_page(mfn);
 
-    offset = addr >> (12+10);
+    offset = addr >> (12+8);
     printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
            offset, pfn_to_paddr(mfn_x(mfn)), first[offset]);
     if ( !(first[offset] & 0x1) ||
-- 
2.9.2


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

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

end of thread, other threads:[~2016-07-20 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19 17:15 [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation Jonathan Daugherty
2016-07-19 17:15 ` [PATCH 2/2] arm/traps: fix bug in dump_guest_s1_walk handling of level 2 page tables Jonathan Daugherty
2016-07-20 12:25   ` Julien Grall
2016-07-20 12:23 ` [PATCH 1/2] arm/traps: fix bug in dump_guest_s1_walk L1 page table offset computation Julien Grall
2016-07-20 16:10 Jonathan Daugherty

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).