Re: [Xen-devel] [PATCH] tools/migrate: Prevent PTE truncation from being fatal duing the live phase

2016-09-02 Thread Ian Jackson
Wei Liu writes ("Re: [PATCH] tools/migrate: Prevent PTE truncation from being 
fatal duing the live phase"):
> Ian, please backport this to Xen 4.6 and 4.7.

Queued, thanks.

Ian.

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


Re: [Xen-devel] [PATCH] tools/migrate: Prevent PTE truncation from being fatal duing the live phase

2016-09-02 Thread Wei Liu
On Fri, Sep 02, 2016 at 09:30:03AM +0100, Wei Liu wrote:
> On Thu, Sep 01, 2016 at 10:45:03AM +0100, Andrew Cooper wrote:
> > It is possible, when normalising a PV pagetable that the table has been 
> > freed
> > and reused for something else by the guest.
> > 
> > In such a case, data read might no longer be a pagetable, and fail the
> > truncation check.  However, this should only be fatal if we encounter such a
> > page in the paused phase.
> > 
> > This check is now consistent with all other checks in the same area.
> > 
> > Signed-off-by: Andrew Cooper 
> 
> Reviewed-by: Wei Liu 

Pushed.

Ian, please backport this to Xen 4.6 and 4.7.

Wei.

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


Re: [Xen-devel] [PATCH] tools/migrate: Prevent PTE truncation from being fatal duing the live phase

2016-09-02 Thread Wei Liu
On Thu, Sep 01, 2016 at 10:45:03AM +0100, Andrew Cooper wrote:
> It is possible, when normalising a PV pagetable that the table has been freed
> and reused for something else by the guest.
> 
> In such a case, data read might no longer be a pagetable, and fail the
> truncation check.  However, this should only be fatal if we encounter such a
> page in the paused phase.
> 
> This check is now consistent with all other checks in the same area.
> 
> Signed-off-by: Andrew Cooper 

Reviewed-by: Wei Liu 

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


[Xen-devel] [PATCH] tools/migrate: Prevent PTE truncation from being fatal duing the live phase

2016-09-01 Thread Andrew Cooper
It is possible, when normalising a PV pagetable that the table has been freed
and reused for something else by the guest.

In such a case, data read might no longer be a pagetable, and fail the
truncation check.  However, this should only be fatal if we encounter such a
page in the paused phase.

This check is now consistent with all other checks in the same area.

Signed-off-by: Andrew Cooper 
---
CC: Ian Jackson 
CC: Wei Liu 

This was hit by OSSTest:
http://logs.test-lab.xenproject.org/osstest/logs/100684/test-amd64-i386-xl-raw/16.ts-guest-localmigrate.log

The patch is untested, but the only plausible option given the circumstances.
---
 tools/libxc/xc_sr_save_x86_pv.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c
index 7043409..f218d17 100644
--- a/tools/libxc/xc_sr_save_x86_pv.c
+++ b/tools/libxc/xc_sr_save_x86_pv.c
@@ -949,9 +949,14 @@ static int normalise_pagetable(struct xc_sr_context *ctx, 
const uint64_t *src,
 #ifdef __i386__
 if ( mfn == INVALID_MFN )
 {
-ERROR("PTE truncation detected.  L%lu[%u] = %016"PRIx64,
-  type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT, i, pte);
-errno = E2BIG;
+if ( !ctx->dominfo.paused )
+errno = EAGAIN;
+else
+{
+ERROR("PTE truncation detected.  L%lu[%u] = %016"PRIx64,
+  type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT, i, pte);
+errno = E2BIG;
+}
 return -1;
 }
 #endif
-- 
2.1.4


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


[Xen-devel] [PATCH] tools/migrate: Prevent PTE truncation from being fatal duing the live phase

2016-09-01 Thread Andrew Cooper
It is possible, when normalising a PV pagetable that the table has been freed
and reused for something else by the guest.

In such a case, data read might no longer be a pagetable, and fail the
truncation check.  However, this should only be fatal if we encounter such a
page in the paused phase.

This check is now consistent with all other checks in the same area.

Signed-off-by: Andrew Cooper 
---
CC: Ian Jackson 
CC: Wei Liu 

This was hit by OSSTest:
http://logs.test-lab.xenproject.org/osstest/logs/100684/test-amd64-i386-xl-raw/16.ts-guest-localmigrate.log

The patch is untested, but the only plausible option given the circumstances.
---
 tools/libxc/xc_sr_save_x86_pv.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c
index 7043409..f218d17 100644
--- a/tools/libxc/xc_sr_save_x86_pv.c
+++ b/tools/libxc/xc_sr_save_x86_pv.c
@@ -949,9 +949,14 @@ static int normalise_pagetable(struct xc_sr_context *ctx, 
const uint64_t *src,
 #ifdef __i386__
 if ( mfn == INVALID_MFN )
 {
-ERROR("PTE truncation detected.  L%lu[%u] = %016"PRIx64,
-  type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT, i, pte);
-errno = E2BIG;
+if ( !ctx->dominfo.paused )
+errno = EAGAIN;
+else
+{
+ERROR("PTE truncation detected.  L%lu[%u] = %016"PRIx64,
+  type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT, i, pte);
+errno = E2BIG;
+}
 return -1;
 }
 #endif
-- 
2.1.4


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