Skip to contentSkip to conversation

x86/mm: relax the check in get_pg_owner

PATCH Superseded Wei Liu 2 participants 5 messages Mar 23, 2017 – Mar 24, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 x86/mm: relax the check in get_pg_owner

PVH guest is actually an translated guest. It should be able to manipulate page table for other domains when acting as Dom0.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/mm.c | 6 ------
 1 file changed, 6 deletions(-)
xen/arch/x86/mm.c +0 -6
index a6b2649cda..3635764df8 100644
@@ -3041,12 +3041,6 @@ static struct domain *get_pg_owner(domid_t domid)
         goto out;
     }
 
-    if ( unlikely(paging_mode_translate(curr)) )
-    {
-        MEM_LOG("Cannot mix foreign mappings with translated domains");
-        goto out;
-    }
-
     switch ( domid )
     {
     case DOMID_IO:
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 23.03.17 at 19:08, <[email protected]> wrote:

PVH guest is actually an translated guest. It should be able to manipulate page table for other domains when acting as Dom0.

The same was true for PVHv1, so I'm afraid there's a little more to this.

xen/arch/x86/mm.c static struct domain *get_pg_owner(domid_t domid) · line 3048

Quoted 11 lines
xen/arch/x86/mm.c +0 -5
@@ -3041,12 +3041,6 @@ static struct domain *get_pg_owner(domid_t domid)
         goto out;
     }
 
-    if ( unlikely(paging_mode_translate(curr)) )
-    {
-        MEM_LOG("Cannot mix foreign mappings with translated domains");
-        goto out;
-    }

Prior to Roger's recent removal of PVHv1 code this was

    if ( !is_pvh_domain(curr) && unlikely(paging_mode_translate(curr)) )

Instead of removing the left side, I think it should have been converted to !is_hvm_domain() (or is_pv_domain()).

Protection against this being used on other than PV domains as target luckily looks to be there:
- mmuext and mmu_update already have respective (albeit somewhat inconsistent) checks,
- do_update_va_mapping_otherdomain() is not wired up for HVM.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#2 lore raw
Quoted 21 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 23.03.17 at 19:08, <[email protected]> wrote:

PVH guest is actually an translated guest. It should be able to manipulate page table for other domains when acting as Dom0.

The same was true for PVHv1, so I'm afraid there's a little more to this.

xen/arch/x86/mm.c static struct domain *get_pg_owner(domid_t domid) · line 3048

Quoted 11 lines
xen/arch/x86/mm.c +0 -5
@@ -3041,12 +3041,6 @@ static struct domain *get_pg_owner(domid_t domid)
         goto out;
     }
 
-    if ( unlikely(paging_mode_translate(curr)) )
-    {
-        MEM_LOG("Cannot mix foreign mappings with translated domains");
-        goto out;
-    }

Prior to Roger's recent removal of PVHv1 code this was

Quoted 5 lines
    if ( !is_pvh_domain(curr) && unlikely(paging_mode_translate(curr)) )

Instead of removing the left side, I think it should have been converted to !is_hvm_domain() (or is_pv_domain()).

DYM:

    if ( !is_hvm_domain(curr) && unlikely(paging_mode_translate(curr)) )

?

Here is something I'm not entirely sure of: is autotranslated PV guest still a thing? I thought Andrew removed it already?

Quoted 6 lines

Protection against this being used on other than PV domains as target luckily looks to be there:
- mmuext and mmu_update already have respective (albeit somewhat inconsistent) checks,
- do_update_va_mapping_otherdomain() is not wired up for HVM.

Yes. That's right.

Wei.

Quoted 3 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 24.03.17 at 12:08, <[email protected]> wrote:
Quoted 21 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 23.03.17 at 19:08, <[email protected]> wrote:

PVH guest is actually an translated guest. It should be able to manipulate page table for other domains when acting as Dom0.

The same was true for PVHv1, so I'm afraid there's a little more to this.

xen/arch/x86/mm.c static struct domain *get_pg_owner(domid_t domid) · line 3048

Quoted 11 lines
xen/arch/x86/mm.c +0 -5
@@ -3041,12 +3041,6 @@ static struct domain *get_pg_owner(domid_t domid)
         goto out;
     }
 
-    if ( unlikely(paging_mode_translate(curr)) )
-    {
-        MEM_LOG("Cannot mix foreign mappings with translated domains");
-        goto out;
-    }

Prior to Roger's recent removal of PVHv1 code this was

Quoted 5 lines
    if ( !is_pvh_domain(curr) && unlikely(paging_mode_translate(curr)) )

Instead of removing the left side, I think it should have been converted to !is_hvm_domain() (or is_pv_domain()).

Quoted 5 lines

DYM:

    if ( !is_hvm_domain(curr) && unlikely(paging_mode_translate(curr)) )

?

Yes.

Quoted 2 lines

Here is something I'm not entirely sure of: is autotranslated PV guest still a thing? I thought Andrew removed it already?

From the tools, iirc, but not from the hypervisor, at least not entirely (as you see from the change you want to make).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw
Quoted 35 lines · Jan Beulich
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 24.03.17 at 12:08, <[email protected]> wrote:
Quoted 21 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 23.03.17 at 19:08, <[email protected]> wrote:

PVH guest is actually an translated guest. It should be able to manipulate page table for other domains when acting as Dom0.

The same was true for PVHv1, so I'm afraid there's a little more to this.

xen/arch/x86/mm.c static struct domain *get_pg_owner(domid_t domid) · line 3048

Quoted 11 lines
xen/arch/x86/mm.c +0 -5
@@ -3041,12 +3041,6 @@ static struct domain *get_pg_owner(domid_t domid)
         goto out;
     }
 
-    if ( unlikely(paging_mode_translate(curr)) )
-    {
-        MEM_LOG("Cannot mix foreign mappings with translated domains");
-        goto out;
-    }

Prior to Roger's recent removal of PVHv1 code this was

Quoted 5 lines
    if ( !is_pvh_domain(curr) && unlikely(paging_mode_translate(curr)) )

Instead of removing the left side, I think it should have been converted to !is_hvm_domain() (or is_pv_domain()).

Quoted 5 lines

DYM:

    if ( !is_hvm_domain(curr) && unlikely(paging_mode_translate(curr)) )

?

Quoted 8 lines

Yes.

Quoted 2 lines

Here is something I'm not entirely sure of: is autotranslated PV guest still a thing? I thought Andrew removed it already?

From the tools, iirc, but not from the hypervisor, at least not entirely (as you see from the change you want to make).

OK, I will update the patch per your suggestion.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel