rpms/kernel/F-7 linux-2.6-x86-fix-oprofile-fix.patch, NONE, 1.1 kernel-2.6.spec, 1.3216, 1.3217

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Tue Jun 5 21:43:48 UTC 2007


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8582

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-x86-fix-oprofile-fix.patch 
Log Message:
* Tue Jun 05 2007 Chuck Ebbert <cebbert at redhat.com>
- Fix the oprofile fix.


linux-2.6-x86-fix-oprofile-fix.patch:

--- NEW FILE linux-2.6-x86-fix-oprofile-fix.patch ---
From: Chris Wright <chrisw at sous-sol.org>
Date: Fri, 1 Jun 2007 07:46:39 +0000 (-0700)
Subject: x86: fix oprofile double free
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjejb%2Fscsi-rc-fixes-2.6.git;a=commitdiff_plain;h=0939c17c7bcf1c838bea4445b80a6966809a438f

x86: fix oprofile double free

Chuck reports that the recent fix from Andi to oprofile
6c977aad03a18019015035958c65b6729cd0574c introduces a double free.  Each
cpu's cpu_msrs is setup to point to cpu 0's, which causes free_msrs to free
cpu 0's pointers for_each_possible_cpu.  Rather than copy the pointers, do
a deep copy instead.

[acme at redhat.com: allocate_msrs() was using for_each_online_cpu()]
Signed-off-by: Chris Wright <chrisw at sous-sol.org>
Cc: Andi Kleen <ak at suse.de>
Cc: Alan Cox <alan at lxorguk.ukuu.org.uk>
Cc: Dave Jones <davej at redhat.com>
Cc: Chuck Ebbert <cebbert at redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme at redhat.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index a7c0783..11b7a51 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -154,7 +154,7 @@ static int allocate_msrs(void)
 	size_t counters_size = sizeof(struct op_msr) * model->num_counters;
 
 	int i;
-	for_each_online_cpu(i) {
+	for_each_possible_cpu(i) {
 		cpu_msrs[i].counters = kmalloc(counters_size, GFP_KERNEL);
 		if (!cpu_msrs[i].counters) {
 			success = 0;
@@ -211,8 +211,14 @@ static int nmi_setup(void)
 	/* Assume saved/restored counters are the same on all CPUs */
 	model->fill_in_addresses(&cpu_msrs[0]);
 	for_each_possible_cpu (cpu) {
-		if (cpu != 0)
-			cpu_msrs[cpu] = cpu_msrs[0];
+		if (cpu != 0) {
+			memcpy(cpu_msrs[cpu].counters, cpu_msrs[0].counters,
+				sizeof(struct op_msr) * model->num_counters);
+
+			memcpy(cpu_msrs[cpu].controls, cpu_msrs[0].controls,
+				sizeof(struct op_msr) * model->num_controls);
+		}
+
 	}
 	on_each_cpu(nmi_save_registers, NULL, 0, 1);
 	on_each_cpu(nmi_cpu_setup, NULL, 0, 1);


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3216
retrieving revision 1.3217
diff -u -r1.3216 -r1.3217
--- kernel-2.6.spec	5 Jun 2007 18:05:33 -0000	1.3216
+++ kernel-2.6.spec	5 Jun 2007 21:42:46 -0000	1.3217
@@ -426,6 +426,7 @@
 Patch207: linux-2.6-x86-dell-hpet.patch
 Patch208: linux-2.6-x86-dell-e520-shutdown.patch
 Patch209: linux-2.6-x86-64_pmtrace.patch
+Patch210: linux-2.6-x86-fix-oprofile-fix.patch
 
 # 300 - 399   ppc(64)
 Patch300: linux-2.6-g5-therm-shutdown.patch
@@ -1106,6 +1107,8 @@
 %patch208 -p1
 # Add x86-64 PM_TRACE support.
 %patch209 -p1
+# Fix oprofile fix
+%patch210 -p1
 
 #
 # PowerPC
@@ -2429,6 +2432,9 @@
 %endif
 
 %changelog
+* Tue Jun 05 2007 Chuck Ebbert <cebbert at redhat.com>
+- Fix the oprofile fix.
+
 * Tue Jun 05 2007 Dave Jones <davej at redhat.com>
 - Re-add a bunch of multimedia drivers. (#242503)
 




More information about the fedora-extras-commits mailing list