1. 24 Jan, 2011 1 commit
  2. 11 Jan, 2010 1 commit
  3. 23 Sep, 2009 2 commits
    • Jan Beulich's avatar
      BUILD_BUG_ON(): fix it and a couple of bogus uses of it · 8c87df45
      Jan Beulich authored
      gcc permitting variable length arrays makes the current construct used for
      BUILD_BUG_ON() useless, as that doesn't produce any diagnostic if the
      controlling expression isn't really constant.  Instead, this patch makes
      it so that a bit field gets used here.  Consequently, those uses where the
      condition isn't really constant now also need fixing.
      
      Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
      MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even if
      the expression is compile time constant (__builtin_constant_p() yields
      true), the array is still deemed of variable length by gcc, and hence the
      whole expression doesn't have the intended effect.
      
      [akpm@linux-foundation.org: make arch/sparc/include/asm/vio.h compile]
      [akpm@linux-foundation.org: more nonsensical assertions in tpm.c..]
      Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
      Cc: Mimi Zohar <zohar@us.ibm.com>
      Cc: James Morris <jmorris@namei.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8c87df45
    • Andrew Morton's avatar
      include/linux/kmemcheck.h: fix a trillion warnings · fa081b00
      Andrew Morton authored
      of the form
      
      include/net/inet_sock.h:208: warning: ISO C90 forbids mixed declarations and code
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Acked-by: Vegard Nossum's avatarVegard Nossum <vegard.nossum@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fa081b00
  4. 21 Sep, 2009 1 commit
  5. 04 Sep, 2009 1 commit
    • Pekka Enberg's avatar
      kmemleak: Don't scan uninitialized memory when kmemcheck is enabled · 8e019366
      Pekka Enberg authored
      Ingo Molnar reported the following kmemcheck warning when running both
      kmemleak and kmemcheck enabled:
      
        PM: Adding info for No Bus:vcsa7
        WARNING: kmemcheck: Caught 32-bit read from uninitialized memory
        (f6f6e1a4)
        d873f9f600000000c42ae4c1005c87f70000000070665f666978656400000000
         i i i i u u u u i i i i i i i i i i i i i i i i i i i i i u u u
                 ^
      
        Pid: 3091, comm: kmemleak Not tainted (2.6.31-rc7-tip #1303) P4DC6
        EIP: 0060:[<c110301f>] EFLAGS: 00010006 CPU: 0
        EIP is at scan_block+0x3f/0xe0
        EAX: f40bd700 EBX: f40bd780 ECX: f16b46c0 EDX: 00000001
        ESI: f6f6e1a4 EDI: 00000000 EBP: f10f3f4c ESP: c2605fcc
         DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
        CR0: 8005003b CR2: e89a4844 CR3: 30ff1000 CR4: 000006f0
        DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
        DR6: ffff4ff0 DR7: 00000400
         [<c110313c>] scan_object+0x7c/0xf0
         [<c1103389>] kmemleak_scan+0x1d9/0x400
         [<c1103a3c>] kmemleak_scan_thread+0x4c/0xb0
         [<c10819d4>] kthread+0x74/0x80
         [<c10257db>] kernel_thread_helper+0x7/0x3c
         [<ffffffff>] 0xffffffff
        kmemleak: 515 new suspected memory leaks (see
        /sys/kernel/debug/kmemleak)
        kmemleak: 42 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
      
      The problem here is that kmemleak will scan partially initialized
      objects that makes kmemcheck complain. Fix that up by skipping
      uninitialized memory regions when kmemcheck is enabled.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      8e019366
  6. 15 Jun, 2009 4 commits
    • Vegard Nossum's avatar
      kmemcheck: introduce bitfield API · fc7d0c9f
      Vegard Nossum authored
      Add the bitfield API which can be used to annotate bitfields in structs
      and get rid of false positive reports.
      
      According to Al Viro, the syntax we were using (putting #ifdef inside
      macro arguments) was not valid C. He also suggested using begin/end
      markers instead, which is what we do now.
      
      [rebased for mainline inclusion]
      Signed-off-by: Vegard Nossum's avatarVegard Nossum <vegard.nossum@gmail.com>
      fc7d0c9f
    • Vegard Nossum's avatar
      kmemcheck: add hooks for the page allocator · b1eeab67
      Vegard Nossum authored
      This adds support for tracking the initializedness of memory that
      was allocated with the page allocator. Highmem requests are not
      tracked.
      
      Cc: Dave Hansen <dave@linux.vnet.ibm.com>
      Acked-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      
      [build fix for !CONFIG_KMEMCHECK]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      
      [rebased for mainline inclusion]
      Signed-off-by: Vegard Nossum's avatarVegard Nossum <vegard.nossum@gmail.com>
      b1eeab67
    • Vegard Nossum's avatar
      kmemcheck: add DMA hooks · d7002857
      Vegard Nossum authored
      This patch hooks into the DMA API to prevent the reporting of the
      false positives that would otherwise be reported when memory is
      accessed that is also used directly by devices.
      
      [rebased for mainline inclusion]
      Signed-off-by: Vegard Nossum's avatarVegard Nossum <vegard.nossum@gmail.com>
      d7002857
    • Vegard Nossum's avatar
      kmemcheck: add mm functions · 2dff4405
      Vegard Nossum authored
      With kmemcheck enabled, the slab allocator needs to do this:
      
      1. Tell kmemcheck to allocate the shadow memory which stores the status of
         each byte in the allocation proper, e.g. whether it is initialized or
         uninitialized.
      2. Tell kmemcheck which parts of memory that should be marked uninitialized.
         There are actually a few more states, such as "not yet allocated" and
         "recently freed".
      
      If a slab cache is set up using the SLAB_NOTRACK flag, it will never return
      memory that can take page faults because of kmemcheck.
      
      If a slab cache is NOT set up using the SLAB_NOTRACK flag, callers can still
      request memory with the __GFP_NOTRACK flag. This does not prevent the page
      faults from occuring, however, but marks the object in question as being
      initialized so that no warnings will ever be produced for this object.
      
      In addition to (and in contrast to) __GFP_NOTRACK, the
      __GFP_NOTRACK_FALSE_POSITIVE flag indicates that the allocation should
      not be tracked _because_ it would produce a false positive. Their values
      are identical, but need not be so in the future (for example, we could now
      enable/disable false positives with a config option).
      
      Parts of this patch were contributed by Pekka Enberg but merged for
      atomicity.
      Signed-off-by: Vegard Nossum's avatarVegard Nossum <vegard.nossum@gmail.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      
      [rebased for mainline inclusion]
      Signed-off-by: Vegard Nossum's avatarVegard Nossum <vegard.nossum@gmail.com>
      2dff4405
  7. 13 Jun, 2009 1 commit