public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [rfc 2/2] x86, bts: use physically non-contiguous trace buffer
@ 2009-04-24  8:00 Markus Metzger
  2009-04-24  8:13 ` Andrew Morton
  2009-04-25  6:40 ` Andi Kleen
  0 siblings, 2 replies; 9+ messages in thread
From: Markus Metzger @ 2009-04-24  8:00 UTC (permalink / raw)
  To: mingo, a.p.zijlstra, akpm
  Cc: markus.t.metzger, markus.t.metzger, roland, eranian, oleg,
	juan.villacis, ak, linux-kernel, tglx, hpa

Use vmalloc to allocate the branch trace buffer.

Peter Zijlstra suggested to use vmalloc rather than kmalloc to
allocate the potentially multi-page branch trace buffer.

Is there a way to have vmalloc allocate a physically non-contiguous
buffer for test purposes? Ideally, the memory area would have big
holes in it with sensitive data in between so I would know immediately
when this is overwritten.


Reported-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
---
 arch/x86/kernel/ptrace.c |    5 	3 +	2 -	0 !
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: b/arch/x86/kernel/ptrace.c
===================================================================
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -22,6 +22,7 @@
 #include <linux/seccomp.h>
 #include <linux/signal.h>
 #include <linux/workqueue.h>
+#include <linux/vmalloc.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -626,7 +627,7 @@ static int alloc_bts_buffer(struct bts_c
 	if (err < 0)
 		return err;
 
-	buffer = kzalloc(size, GFP_KERNEL);
+	buffer = vmalloc(size);
 	if (!buffer)
 		goto out_refund;
 
@@ -646,7 +647,7 @@ static inline void free_bts_buffer(struc
 	if (!context->buffer)
 		return;
 
-	kfree(context->buffer);
+	vfree(context->buffer);
 	context->buffer = NULL;
 
 	refund_locked_memory(context->mm, context->size);
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-04-29  9:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-24  8:00 [rfc 2/2] x86, bts: use physically non-contiguous trace buffer Markus Metzger
2009-04-24  8:13 ` Andrew Morton
2009-04-24  8:31   ` Ingo Molnar
2009-04-24  8:39     ` Metzger, Markus T
2009-04-26 16:08       ` Ingo Molnar
2009-04-27 10:53     ` Peter Zijlstra
2009-04-29  9:14       ` Metzger, Markus T
2009-04-25  6:40 ` Andi Kleen
2009-04-27  6:35   ` Metzger, Markus T

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox