diff mbox

[RFC,02/29] xen/arm: don't allow dom0 to access to vpl011 UART0 memory range

Message ID eac5a48e230576a707c66acdfedf1db34b98a58d.1367188423.git.julien.grall@linaro.org
State Changes Requested, archived
Headers show

Commit Message

Julien Grall April 28, 2013, 11:01 p.m. UTC
As vpl011 UART is not initialized for dom 0, when the domain tries to access to
this range, a segfault will occur in Xen. The right behaviour should be a data
abort for the guest.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/vpl011.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ian Campbell April 29, 2013, 2:57 p.m. UTC | #1
On Mon, 2013-04-29 at 00:01 +0100, Julien Grall wrote:
> As vpl011 UART is not initialized for dom 0, when the domain tries to access to
> this range, a segfault will occur in Xen. The right behaviour should be a data
> abort for the guest.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

However I wonder if the provision of a vpl011 UART isn't something which
should be made platform specific.

It's really a workaround for DEBUG_LL in a kernel which is configured
for vexpress, I expect Arndale has different serial ports?

> ---
>  xen/arch/arm/vpl011.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
> index 9472d0a..13ba623 100644
> --- a/xen/arch/arm/vpl011.c
> +++ b/xen/arch/arm/vpl011.c
> @@ -85,7 +85,9 @@ static void uart0_print_char(char c)
>  
>  static int uart0_mmio_check(struct vcpu *v, paddr_t addr)
>  {
> -    return addr >= UART0_START && addr < UART0_END;
> +    struct domain *d = v->domain;
> +
> +    return d->domain_id != 0 && addr >= UART0_START && addr < UART0_END;
>  }
>  
>  static int uart0_mmio_read(struct vcpu *v, mmio_info_t *info)
Julien Grall April 29, 2013, 3:19 p.m. UTC | #2
On 04/29/2013 03:57 PM, Ian Campbell wrote:

> On Mon, 2013-04-29 at 00:01 +0100, Julien Grall wrote:
>> As vpl011 UART is not initialized for dom 0, when the domain tries to access to
>> this range, a segfault will occur in Xen. The right behaviour should be a data
>> abort for the guest.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> However I wonder if the provision of a vpl011 UART isn't something which
> should be made platform specific.
> 
> It's really a workaround for DEBUG_LL in a kernel which is configured
> for vexpress, I expect Arndale has different serial ports?

Right. I'm currently working on a patch for linux to enable early printk
for Arm.

For the moment it's doesn't impact the Arndale board because this range
is already mapped to a physical address.
By the way, I think vpl011 is useless with Stefano's patch series for
SMP. He moved xenvm out of versatile express platform.
diff mbox

Patch

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 9472d0a..13ba623 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -85,7 +85,9 @@  static void uart0_print_char(char c)
 
 static int uart0_mmio_check(struct vcpu *v, paddr_t addr)
 {
-    return addr >= UART0_START && addr < UART0_END;
+    struct domain *d = v->domain;
+
+    return d->domain_id != 0 && addr >= UART0_START && addr < UART0_END;
 }
 
 static int uart0_mmio_read(struct vcpu *v, mmio_info_t *info)