From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by kanga.kvack.org (Postfix) with ESMTP id E807D6B0055 for ; Wed, 10 Sep 2014 10:38:45 -0400 (EDT) Received: by mail-pa0-f53.google.com with SMTP id rd3so7010374pab.26 for ; Wed, 10 Sep 2014 07:38:45 -0700 (PDT) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com. [210.118.77.12]) by mx.google.com with ESMTPS id fr9si27877486pdb.239.2014.09.10.07.38.44 for (version=TLSv1 cipher=RC4-MD5 bits=128/128); Wed, 10 Sep 2014 07:38:44 -0700 (PDT) Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBO004MZWT7FU90@mailout2.w1.samsung.com> for linux-mm@kvack.org; Wed, 10 Sep 2014 15:41:31 +0100 (BST) From: Andrey Ryabinin Subject: [RFC/PATCH v2 09/10] kmemleak: disable kasan instrumentation for kmemleak Date: Wed, 10 Sep 2014 18:31:26 +0400 Message-id: <1410359487-31938-10-git-send-email-a.ryabinin@samsung.com> In-reply-to: <1410359487-31938-1-git-send-email-a.ryabinin@samsung.com> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1410359487-31938-1-git-send-email-a.ryabinin@samsung.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org Cc: Andrey Ryabinin , Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Andrew Morton , Dave Hansen , Andi Kleen , Vegard Nossum , "H. Peter Anvin" , x86@kernel.org, linux-mm@kvack.org, Catalin Marinas kmemleak scans all memory while searching for pointers to objects. So function scan_block could access kasan's shadow memory region while searching for pointer. Also kmalloc internally round up allocation size, and kmemleak uses rounded up size as size of object. This makes kasan to complain while calculation of object's checksum. The simplest solution here is to disable kasan. Signed-off-by: Andrey Ryabinin --- mm/kmemleak.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 3cda50c..9bda1b3 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -98,6 +98,7 @@ #include #include +#include #include #include #include @@ -1113,7 +1114,10 @@ static bool update_checksum(struct kmemleak_object *object) if (!kmemcheck_is_obj_initialized(object->pointer, object->size)) return false; + kasan_disable_local(); object->checksum = crc32(0, (void *)object->pointer, object->size); + kasan_enable_local(); + return object->checksum != old_csum; } @@ -1164,7 +1168,9 @@ static void scan_block(void *_start, void *_end, BYTES_PER_POINTER)) continue; + kasan_disable_local(); pointer = *ptr; + kasan_enable_local(); object = find_and_get_object(pointer, 1); if (!object) -- 1.8.5.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org