From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by kanga.kvack.org (Postfix) with ESMTP id 1665B6B0032 for ; Fri, 30 Jan 2015 18:11:57 -0500 (EST) Received: by mail-pa0-f44.google.com with SMTP id rd3so57722800pab.3 for ; Fri, 30 Jan 2015 15:11:56 -0800 (PST) Received: from mail-pa0-x22e.google.com (mail-pa0-x22e.google.com. [2607:f8b0:400e:c03::22e]) by mx.google.com with ESMTPS id sq9si10953704pbc.134.2015.01.30.15.11.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Jan 2015 15:11:56 -0800 (PST) Received: by mail-pa0-f46.google.com with SMTP id lj1so57732073pab.5 for ; Fri, 30 Jan 2015 15:11:56 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20150130134217.73d6f43f8257936275351834@linux-foundation.org> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1422544321-24232-1-git-send-email-a.ryabinin@samsung.com> <1422544321-24232-7-git-send-email-a.ryabinin@samsung.com> <20150129151243.fd76aca21757b1ca5b62163e@linux-foundation.org> <54CBB9C9.3060500@samsung.com> <20150130134217.73d6f43f8257936275351834@linux-foundation.org> Date: Sat, 31 Jan 2015 03:11:55 +0400 Message-ID: Subject: Re: [PATCH v10 06/17] mm: slub: introduce metadata_access_enable()/metadata_access_disable() From: Andrey Ryabinin Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Andrey Ryabinin , LKML , Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Dave Hansen , Andi Kleen , "x86@kernel.org" , "linux-mm@kvack.org" , Pekka Enberg , David Rientjes 2015-01-31 0:42 GMT+03:00 Andrew Morton : > On Fri, 30 Jan 2015 20:05:13 +0300 Andrey Ryabinin wrote: > >> >> --- a/mm/slub.c >> >> +++ b/mm/slub.c >> >> @@ -467,13 +467,23 @@ static int slub_debug; >> >> static char *slub_debug_slabs; >> >> static int disable_higher_order_debug; >> >> >> >> +static inline void metadata_access_enable(void) >> >> +{ >> >> +} >> >> + >> >> +static inline void metadata_access_disable(void) >> >> +{ >> >> +} >> > >> > Some code comments here would be useful. What they do, why they exist, >> > etc. The next patch fills them in with >> > kasan_disable_local/kasan_enable_local but that doesn't help the reader >> > to understand what's going on. The fact that >> > kasan_disable_local/kasan_enable_local are also undocumented doesn't >> > help. >> > >> >> Ok, How about this? >> >> /* >> * This hooks separate payload access from metadata access. >> * Useful for memory checkers that have to know when slub >> * accesses metadata. >> */ > > "These hooks". > > I still don't understand :( Maybe I'm having a more-stupid-than-usual > day. I think it's me being stupid today ;) I'll try to explain better. > How can a function "separate access"? What does this mean? More > details, please. I think I've only once seen a comment which had too > much info! > slub could access memory marked by kasan as inaccessible (object's metadata). Kasan shouldn't print report in that case because this access is valid. Disabling instrumentation of slub.c code is not enough to achieve this because slub passes pointer to object's metadata into memchr_inv(). We can't disable instrumentation for memchr_inv() because this is quite generic function. So metadata_access_enable/metadata_access_disable wrap some places in slub.c where access to object's metadata starts/end. And kasan_disable_local/kasan_enable_local just disable/enable error reporting in this places. -- 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