mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "Vegard Nossum" <vegard.nossum@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] kmemcheck: trap uses of uninitialized memory (v2)
Date: Thu, 29 Nov 2007 10:02:55 +0200	[thread overview]
Message-ID: <84144f020711290002p290e91a4ubc40f1efbc877f75@mail.gmail.com> (raw)
In-Reply-To: <474C34CC.6060509@gmail.com>

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

  parent reply	other threads:[~2007-11-29  8:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 15:16 Vegard Nossum
2007-11-28  6:51 ` Richard Knutsson
2007-11-28 18:31   ` Vegard Nossum
2007-11-29  4:49     ` Richard Knutsson
2007-11-29  8:02 ` Pekka Enberg [this message]
2007-11-29  9:10   ` Vegard Nossum
2007-11-29  9:39     ` Pekka J Enberg
2007-11-29 10:04       ` Vegard Nossum
2007-11-29 12:05         ` Pekka J Enberg
2007-11-29 10:29 ` Andi Kleen
2007-11-29 13:24   ` Vegard Nossum
2007-11-29 13:45     ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84144f020711290002p290e91a4ubc40f1efbc877f75@mail.gmail.com \
    --to=penberg@cs.helsinki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vegard.nossum@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome