Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752377AbcD1Lij (ORCPT ); Thu, 28 Apr 2016 07:38:39 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:33514 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbcD1Lii convert rfc822-to-8bit (ORCPT ); Thu, 28 Apr 2016 07:38:38 -0400 MIME-Version: 1.0 In-Reply-To: <20160422143259.b2d2c253da7ea6fa4b425269@linux-foundation.org> References: <2126fe9ca8c3a4698c0ad7aae652dce28e261182.1460545373.git.glider@google.com> <20160422143259.b2d2c253da7ea6fa4b425269@linux-foundation.org> Date: Thu, 28 Apr 2016 13:31:14 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] mm, kasan: don't call kasan_krealloc() from ksize(). From: Alexander Potapenko To: Andrew Morton Cc: Andrey Konovalov , Dmitriy Vyukov , Christoph Lameter , Andrey Ryabinin , Kostya Serebryany , kasan-dev , LKML , Linux Memory Management List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1157 Lines: 42 On Fri, Apr 22, 2016 at 11:32 PM, Andrew Morton wrote: > On Wed, 13 Apr 2016 13:20:09 +0200 Alexander Potapenko wrote: > >> Instead of calling kasan_krealloc(), which replaces the memory allocation >> stack ID (if stack depot is used), just unpoison the whole memory chunk. > > I don't understand why these two patches exist. Bugfix? Cleanup? > Optimization? It's incorrect to call kasan_krealloc() from ksize(), because the former may touch the allocation metadata (it does so for the SLAB allocator). Yes, this is a bugfix. > > I had to change kmalloc_tests_init() a bit due to > mm-kasan-initial-memory-quarantine-implementation.patch: > > kasan_stack_oob(); > kasan_global_oob(); > #ifdef CONFIG_SLAB > kasan_quarantine_cache(); > #endif > + ksize_unpoisons_memory(); > return -EAGAIN; > } > > Please check. Ack. -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Straße, 33 80636 München Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg