From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758247AbbA3XQq (ORCPT ); Fri, 30 Jan 2015 18:16:46 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48322 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752720AbbA3XQp (ORCPT ); Fri, 30 Jan 2015 18:16:45 -0500 Date: Fri, 30 Jan 2015 15:16:43 -0800 From: Andrew Morton To: Andrey Ryabinin 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 Subject: Re: [PATCH v10 06/17] mm: slub: introduce metadata_access_enable()/metadata_access_disable() Message-Id: <20150130151643.400b369ba4fc3c50a1353ddf@linux-foundation.org> In-Reply-To: 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> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 31 Jan 2015 03:11:55 +0400 Andrey Ryabinin wrote: > >> > 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. ooh, I see. Something like this? /* * slub is about to manipulate internal object metadata. This memory lies * outside the range of the allocated object, so accessing it would normally * be reported by kasan as a bounds error. metadata_access_enable() is used * to tell kasan that these accesses are OK. */