[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25e057c01002080638g149c974r759f50365cd05233@mail.gmail.com>
Date: Mon, 8 Feb 2010 15:38:09 +0100
From: roel kluin <roel.kluin@...il.com>
To: Catalin Marinas <catalin.marinas@....com>
Cc: linux-kernel@...r.kernel.org, Vegard Nossum <vegardno@....uio.no>,
Andrew Morton <akpm@...ux-foundation.org>,
Pekka Enberg <penberg@...helsinki.fi>,
Christian Casteyde <casteyde.christian@...e.fr>
Subject: Re: [PATCH] kmemcheck: Test the full object in kmemcheck_is_obj_initialized()
On Mon, Feb 8, 2010 at 12:16 PM, Catalin Marinas
<catalin.marinas@....com> wrote:
> This is a fix for bug #14845 (bugzilla.kernel.org). The
> update_checksum() function in mm/kmemleak.c calls
> kmemcheck_is_obj_initialised() before scanning an object. When
> KMEMCHECK_PARTIAL_OK is enabled, this function returns true. However,
> the crc32_le() reads smaller intervals (32-bit) for which
> kmemleak_is_obj_initialised() may be false leading to a kmemcheck
> warning.
>
> Note that kmemcheck_is_obj_initialized() is currently only used by
> kmemleak before scanning a memory location.
> enum kmemcheck_shadow kmemcheck_shadow_test(void *shadow, unsigned int size)
> {
> +#ifdef CONFIG_KMEMCHECK_PARTIAL_OK
> uint8_t *x;
> unsigned int i;
>
> x = shadow;
>
> -#ifdef CONFIG_KMEMCHECK_PARTIAL_OK
> /*
> * Make sure _some_ bytes are initialized. Gcc frequently generates
> * code to access neighboring bytes.
> @@ -139,13 +139,25 @@ enum kmemcheck_shadow kmemcheck_shadow_test(void *shadow, unsigned int size)
> if (x[i] == KMEMCHECK_SHADOW_INITIALIZED)
> return x[i];
> }
> +
> + return x[0];
> #else
> + return kmemcheck_shadow_test_all(shadow, size);
> +#endif
> +}
> +
> +enum kmemcheck_shadow kmemcheck_shadow_test_all(void *shadow, unsigned int size)
> +{
> + uint8_t *x;
> + unsigned int i;
> +
> + x = shadow;
> +
> /* All bytes must be initialized. */
> for (i = 0; i < size; ++i) {
> if (x[i] != KMEMCHECK_SHADOW_INITIALIZED)
> return x[i];
> }
> -#endif
>
> return x[0];
> }
Are we certain that size cannot be 0 in kmemcheck_shadow_test()
and kmemcheck_shadow_test_all() or other functions in
arch/x86/mm/kmemcheck/shadow.c with these unsigned
comparisons in loops?
Roel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists