xen/xl-check-for-libvirt-managed-domain.patch
Charles Arnold a428832eb0 - Modify how we check for libvirt managed domains
xl-check-for-libvirt-managed-domain.patch

- bnc#878841 - VUL-0: XSA-96: Xen: Vulnerabilities in HVM MSI
  injection
  538dcada-x86-HVM-eliminate-vulnerabilities-from-hvm_inject_msi.patch
- Upstream patches from Jan
  537cd0b0-hvmloader-also-cover-PCI-MMIO-ranges-above-4G-with-UC-MTRR-ranges.patch
  537cd0cc-hvmloader-PA-range-0xfc000000-0xffffffff-should-be-UC.patch
  5383167d-ACPI-ERST-fix-table-mapping.patch
  5383175e-VT-d-fix-mask-applied-to-DMIBAR-in-desktop-chipset-XSA-59-workaround.patch
  53859549-AMD-IOMMU-don-t-free-page-table-prematurely.patch
  5385956b-x86-don-t-use-VA-for-cache-flush-when-also-flushing-TLB.patch
  53859956-timers-set-the-deadline-more-accurately.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=318
2014-06-12 05:11:30 +00:00

57 lines
1.8 KiB
Diff

Index: xen-4.4.0-testing/tools/libxl/xl.c
===================================================================
--- xen-4.4.0-testing.orig/tools/libxl/xl.c
+++ xen-4.4.0-testing/tools/libxl/xl.c
@@ -282,6 +282,32 @@ static void xl_ctx_free(void)
}
}
+/*
+ Return 0 if domain is managed by libvirt
+*/
+static int xl_lookup_libvirt_managed_domain(int argc, char **argv)
+{
+ uint32_t domid;
+ uint8_t *t_data;
+ char *domname;
+ int i, rc, t_len;
+
+ for (i=0; i<argc; ++i) {
+ rc = libxl_domain_qualifier_to_domid(ctx, argv[i], &domid);
+ if (!rc) {
+ domname = libxl_domid_to_name(ctx, domid);
+ if (domname != NULL) {
+ rc = libxl_userdata_retrieve(ctx, domid, "libvirt-xml", &t_data, &t_len);
+ if (!rc && t_len)
+ return 0;
+ break;
+ }
+ }
+ }
+
+ return 1;
+}
+
int main(int argc, char **argv)
{
int opt = 0;
@@ -345,6 +371,18 @@ int main(int argc, char **argv)
goto xit;
}
if (cspec->modifies && !dryrun_only) {
+ if (!force_execution) {
+ if (!xl_lookup_libvirt_managed_domain(argc, argv)) {
+ fprintf(stderr,
+"Warning: This domain is managed by libvirt. Using xl commands to modify this\n"
+"domain will result in errors when virsh or virt-manager is used.\n"
+"Please use only virsh or virt-manager to manage this domain.\n\n"
+"(This check can be overridden with the -f option.)\n"
+ );
+ ret = 1;
+ goto xit;
+ }
+ }
for (int i = 0; i < sizeof(locks)/sizeof(locks[0]); i++) {
if (!access(locks[i], F_OK) && !force_execution) {
fprintf(stderr,