Re: [git pull] OProfile fixes for v2.6.28

From: Eric Dumazet
Date: Mon Nov 10 2008 - 03:06:18 EST


Robert Richter a écrit :
Hi Ingo,

please pull oprofile fixes for 2.6.28 for tip regression:

git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git oprofile-for-tip

Thanks,

-Robert

Andi Kleen (1):
oprofile: Fix p6 counter overflow check

Carl Love (2):
Cell OProfile: Incorrect local array size in activate spu profiling function
Cell OProfile: Incorrect local array size in activate spu profiling function

Jesper Dangaard Brouer (1):
Change UTF8 chars in Kconfig help text about Oprofile AMD barcelona

Nick Piggin (1):
oprofile: fix memory ordering

Robert Richter (1):
Revert "Cell OProfile: Incorrect local array size in activate spu profiling function"


Hi Robert

I am still trying to find why oprofile stops after some millions of samples on my machine.

(All versions of linux supporting oprofile/NMI on this machine have this problem)
Note : I am using a 32bit kernel.

While doing code review I found this bug.

Impact: 32bit kernels, memory corruption

[PATCH] oprofile: fix an overflow in ppro code

reset_value was changed from long to u64 in commit b99170288421c79f0c2efa8b33e26e65f4bb7fb8
(oprofile: Implement Intel architectural perfmon support)

But dynamic allocation of this array use a wrong type (long instead of u64)

Signed-off-by: Eric Dumazet <dada1@xxxxxxxxxxxxx>
---
arch/x86/oprofile/op_model_ppro.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 3f1b81a..716d26f 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -69,7 +69,7 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
int i;

if (!reset_value) {
- reset_value = kmalloc(sizeof(unsigned) * num_counters,
+ reset_value = kmalloc(sizeof(reset_value[0]) * num_counters,
GFP_ATOMIC);
if (!reset_value)
return;