profile: fix stats and data leakage

Previous thread: x86, cacheinfo: Turn off L3 cache index disable feature in virtualized environments by Linux Kernel Mailing List on Friday, May 14, 2010 - 2:59 pm. (1 message)

Next thread: ARM: 6106/1: Implement copy_to_user_page() for noMMU by Linux Kernel Mailing List on Friday, May 14, 2010 - 9:59 pm. (1 message)
From: Linux Kernel Mailing List
Date: Friday, May 14, 2010 - 9:59 pm

Gitweb:     http://git.kernel.org/linus/16a2164bb03612efe79a76c73da6da44445b9287
Commit:     16a2164bb03612efe79a76c73da6da44445b9287
Parent:     bfcc6e2eca507819e297a4c758ebd6b26e625330
Author:     Hugh Dickins <hughd@google.com>
AuthorDate: Fri May 14 19:44:10 2010 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Fri May 14 19:45:06 2010 -0700

    profile: fix stats and data leakage
    
    If the kernel is large or the profiling step small, /proc/profile
    leaks data and readprofile shows silly stats, until readprofile -r
    has reset the buffer: clear the prof_buffer when it is vmalloc()ed.
    
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 kernel/profile.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/profile.c b/kernel/profile.c
index a55d3a3..dfadc5b 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -127,8 +127,10 @@ int __ref profile_init(void)
 		return 0;
 
 	prof_buffer = vmalloc(buffer_bytes);
-	if (prof_buffer)
+	if (prof_buffer) {
+		memset(prof_buffer, 0, buffer_bytes);
 		return 0;
+	}
 
 	free_cpumask_var(prof_cpu_mask);
 	return -ENOMEM;
--

Previous thread: x86, cacheinfo: Turn off L3 cache index disable feature in virtualized environments by Linux Kernel Mailing List on Friday, May 14, 2010 - 2:59 pm. (1 message)

Next thread: ARM: 6106/1: Implement copy_to_user_page() for noMMU by Linux Kernel Mailing List on Friday, May 14, 2010 - 9:59 pm. (1 message)