Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 4354

kernel-2.6.18-194.11.1.el5.src.rpm

From: Don Dutile <ddutile@redhat.com>
Date: Thu, 11 Sep 2008 12:05:41 -0400
Subject: [xen] remove /proc/xen*/* from bare-metal and FV guests
Message-id: 48C941D5.3050109@redhat.com
O-Subject: [RHEL5.3 PATCH] Remove /proc/xen*/* from bare-metal & FV guest systems
Bugzilla: 461532
RH-Acked-by: Bill Burns <bburns@redhat.com>
RH-Acked-by: Neil Horman <nhorman@redhat.com>
RH-Acked-by: Rik van Riel <riel@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>
RH-Acked-by: Mark McLoughlin <markmc@redhat.com>
RH-Acked-by: Chris Lalancette <clalance@redhat.com>

BZ 461532

The addition of the xen pv-on-hvm drivers in the bare-metal (& FV guest)
kernel brought the common code that added files to /proc/xen.

/proc/xen is used by applications (rpm %post, customer LSF application, kdump, etc.)
to determine what type of kernel is running (dom0, domU or bare-metal), and
adjust how they work.  In the rpm %post case, it can create incorrect grub
entries on systems, depending on what was running or not running as a kernel,
and what is being installed.
For applications, it can do improperly things like licensing problems;
for core-dumps, it'll look for sections that don't/shouldn't exist.

The following patch removes /proc/xen*/* from the bare-metal & FV guests,
so the above problems don't occur, and ensure they do exist as they do now
on -xen guest & -xen dom0.

Testing:
=======
-- all on x86_64 (the changes are not architecture dependent)
a) FV guest: ensured booting via pv-on-hvm, and using vnif still works;
           : ensured booting via emulated IDE & 8139 still works.
b) FV guest: make sure dynamic device attach/detach (xen-vbd) still works
c) xenU guest: ensure that /proc/xen/[balloon, capabilities, privcmd, xenbus]
               are still created (i.e., no regression on xenU) (ls -R /proc/xen)
d) -xen dom0: ensure that /proc/xen/[balloon, capabilities, privcmd, xenbus, xsd_kva, xsd_port]
              are still created (i.e., no regression on dom0) (ls -R /proc/xen)
e) did *not* do dump/core test; other's have verified that by
   reverting back to -109 kernel, pre-/proc/xen on bare-metal/FV guest works.

Brew build:
===========
https://brewweb.devel.redhat.com/taskinfo?taskID=1464407

Please review & ACK.

- Don

diff --git a/drivers/xen/balloon/balloon.c b/drivers/xen/balloon/balloon.c
index d704a9f..39d7185 100644
--- a/drivers/xen/balloon/balloon.c
+++ b/drivers/xen/balloon/balloon.c
@@ -504,7 +504,7 @@ static int __init balloon_init(void)
 	balloon_timer.data = 0;
 	balloon_timer.function = balloon_alarm;
     
-#ifdef CONFIG_PROC_FS
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_XEN_PRIVILEGED_GUEST)
 	if ((balloon_pde = create_xen_proc_entry("balloon", 0644)) == NULL) {
 		WPRINTK("Unable to create /proc/xen/balloon.\n");
 		return -1;
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index e66c8fa..2e76c7f 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -1168,8 +1168,9 @@ static int __init xenbus_probe_init(void)
 #endif
 	}
 
-
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_XEN_PRIVILEGED_GUEST)
 	xenbus_dev_init();
+#endif
 
 	/* Initialize the interface to xenstore. */
 	err = xs_init();
diff --git a/drivers/xenpv_hvm/platform-pci/Makefile b/drivers/xenpv_hvm/platform-pci/Makefile
index eb18c1b..901a4e0 100644
--- a/drivers/xenpv_hvm/platform-pci/Makefile
+++ b/drivers/xenpv_hvm/platform-pci/Makefile
@@ -14,9 +14,7 @@ xen-platform-pci-objs += panic-handler.o
 xen-platform-pci-objs += ../../xen/xenbus/xenbus_comms.o
 xen-platform-pci-objs += ../../xen/xenbus/xenbus_xs.o
 xen-platform-pci-objs += ../../xen/xenbus/xenbus_probe.o 
-xen-platform-pci-objs += ../../xen/xenbus/xenbus_dev.o 
 xen-platform-pci-objs += ../../xen/xenbus/xenbus_client.o 
-xen-platform-pci-objs += ../../xen/core/xen_proc.o
 
 # Can we do better ?
 ifeq ($(ARCH),ia64)