Skip to contentSkip to conversation

libxl: Don't ignore error when we fail to give access to ioport/irq/iomem

PATCH Applied Julien Grall 4 participants 8 messages Jan 9, 2015 – Jan 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libxl: Don't ignore error when we fail to give access to ioport/irq/iomem

If we fail to give the access, the domain will unlikely work correctly. So we should bail out at the first error.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>

---
This patch is candidate for a backport for at least Xen 4.4 and Xen 4.5.

Changes in v2:
- Also bail out when libxl fails to give access to iomem

---
 tools/libxl/libxl_create.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/libxl/libxl_create.c +4 -1
index 1198225..6f87d1c 100644
@@ -1167,6 +1167,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
                  "failed give dom%d access to ioports %"PRIx32"-%"PRIx32,
                  domid, io->first, io->first + io->number - 1);
             ret = ERROR_FAIL;
+            goto error_out;
         }
     }
 
@@ -1182,6 +1183,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
         if (ret < 0) {
             LOGE(ERROR, "failed give dom%d access to irq %d", domid, irq);
             ret = ERROR_FAIL;
+            goto error_out;
         }
     }
 
@@ -1198,7 +1200,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
                  "failed give dom%d access to iomem range %"PRIx64"-%"PRIx64,
                  domid, io->start, io->start + io->number - 1);
             ret = ERROR_FAIL;
-            continue;
+            goto error_out;
         }
         ret = xc_domain_memory_mapping(CTX->xch, domid,
                                        io->gfn, io->start,
@@ -1209,6 +1211,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
                  " to guest address %"PRIx64,
                  domid, io->start, io->start + io->number - 1, io->gfn);
             ret = ERROR_FAIL;
+            goto error_out;
         }
     }
 
Signature · 1 line
2.1.4
#3 lore raw

Hi Ian,

Quoted 10 lines · Ian Campbell
Quoted 9 lines · Wei Liu
Quoted 7 lines · Julien Grall

If we fail to give the access, the domain will unlikely work correctly. So we should bail out at the first error.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Quoted 5 lines
Quoted 1 line

Applied, thanks.

Should this be backported?

Yes. But it may not apply directly on Xen 4.4.

Regards,

Signature · 1 line
Julien Grall
#4 lore raw

Julien Grall writes ("Re: [PATCH v2] libxl: Don't ignore error when we fail to give access to ioport/irq/iomem"):

Quoted 4 lines · Ian Campbell
Quoted 1 line

Should this be backported?

Yes. But it may not apply directly on Xen 4.4.

I have made a note of this. I will apply it to 4.5 after the release freeze is over and 4.5 is handed over to stable tree maintenance.

As you suspected, it doesn't apply cleanly to 4.4. I would welcome a backport. If no-one else backports it I will do it myself.

Thanks,
Ian.

#5 lore raw

Hi Ian,

Quoted 11 lines · Ian Jackson

Julien Grall writes ("Re: [PATCH v2] libxl: Don't ignore error when we fail to give access to ioport/irq/iomem"):

Quoted 4 lines · Ian Campbell
Quoted 1 line

Should this be backported?

Yes. But it may not apply directly on Xen 4.4.

I have made a note of this. I will apply it to 4.5 after the release freeze is over and 4.5 is handed over to stable tree maintenance.

As you suspected, it doesn't apply cleanly to 4.4. I would welcome a backport. If no-one else backports it I will do it myself.

I will give a look to provide a backport for Xen 4.4.

Would it useful to have a backport for Xen 4.3?

Regards,

Signature · 1 line
Julien Grall
#6 lore raw

Julien Grall writes ("Re: [PATCH v2] libxl: Don't ignore error when we fail to give access to ioport/irq/iomem"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

As you suspected, it doesn't apply cleanly to 4.4. I would welcome a backport. If no-one else backports it I will do it myself.

I will give a look to provide a backport for Xen 4.4.

Thanks.

Quoted 1 line

Would it useful to have a backport for Xen 4.3?

Yes. With luck, though, the 4.4 patch can be cherry-picked onto 4.3.

Ian.

#7 lore raw
In reply to Ian Campbell
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Wei Liu
Quoted 7 lines · Julien Grall

If we fail to give the access, the domain will unlikely work correctly. So we should bail out at the first error.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Quoted 6 lines
Quoted 1 line

Applied, thanks.

Should this be backported?

Yes. This should be backported.

Wei.