Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761874AbZJNPdA (ORCPT ); Wed, 14 Oct 2009 11:33:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934527AbZJNPdA (ORCPT ); Wed, 14 Oct 2009 11:33:00 -0400 Received: from cam-admin0.cambridge.arm.com ([193.131.176.58]:57779 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934491AbZJNPc7 (ORCPT ); Wed, 14 Oct 2009 11:32:59 -0400 Subject: [PATCH] kmemleak: Do not use off-slab management with SLAB_NOLEAKTRACE To: linux-kernel@vger.kernel.org From: Catalin Marinas Cc: Tetsuo Handa , Pekka Enberg , Christoph Lameter Date: Wed, 14 Oct 2009 16:31:46 +0100 Message-ID: <20091014153146.8955.19964.stgit@pc1117.cambridge.arm.com> User-Agent: StGit/0.15-rc3-10-g00be MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Oct 2009 15:31:46.0992 (UTC) FILETIME=[70F5BB00:01CA4CE3] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1527 Lines: 37 With the slab allocator, if off-slab management is enabled for the kmem_caches used by kmemleak, it leads to recursive calls into kmemleak_alloc(). Off-slab management can be triggered by other config options increasing the slab size, e.g. DEBUG_PAGEALLOC. Reported-by: Tetsuo Handa Cc: Pekka Enberg Cc: Christoph Lameter Signed-off-by: Catalin Marinas --- mm/slab.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 7dfa481..646db30 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2261,9 +2261,11 @@ kmem_cache_create (const char *name, size_t size, size_t align, /* * Determine if the slab management is 'on' or 'off' slab. * (bootstrapping cannot cope with offslab caches so don't do - * it too early on.) + * it too early on. Always use on-slab management when + * SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak) */ - if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init) + if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init && + !(flags & SLAB_NOLEAKTRACE)) /* * Size is large, assume best to place the slab management obj * off-slab (should allow better packing of objs). -- 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/