lkml.org 
[lkml]   [2007]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] kmemcheck: trap uses of uninitialized memory (v2)
Hi Vegard,

On Nov 27, 2007 5:16 PM, Vegard Nossum <vegard.nossum@gmail.com> wrote:
> +config KMEMCHECK
> + bool "Trap use of uninitialized memory"
> + depends on X86_32 && !CC_OPTIMIZE_FOR_SIZE
> + help
> + This option enables tracing of dynamically allocated kernel memory
> + to see if memory is used before it has been given an initial value.
> + Be aware that this requires half of your memory for bookkeeping and
> + will insert extra code at *every* read and write to tracked memory
> + thus slow down the kernel code (but user code is unaffected).

Is it really necessary to track every memory address? Tracking slab
objects would require far less memory. You might also want to make
kzalloc() and GFP_ZERO mark the memory area as initialized to avoid
some page faults.

On Nov 27, 2007 5:16 PM, Vegard Nossum <vegard.nossum@gmail.com> wrote:
> + /* Actually allocate twice as much, since we need to track the
> + * status of each byte within the allocation. */
> + if (!(flags & __GFP_NOTRACK)) {

If you change __GFP_NOTRACK to __GFP_TRACK, you can avoid the double
negation here.

Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-29 09:05    [W:2.293 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site