From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f71.google.com (mail-it0-f71.google.com [209.85.214.71]) by kanga.kvack.org (Postfix) with ESMTP id 6277F6B000A for ; Tue, 31 Jul 2018 11:21:38 -0400 (EDT) Received: by mail-it0-f71.google.com with SMTP id 136-v6so3049881itw.5 for ; Tue, 31 Jul 2018 08:21:38 -0700 (PDT) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 185-v6sor4625332ioy.49.2018.07.31.08.21.37 for (Google Transport Security); Tue, 31 Jul 2018 08:21:37 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <8240d4f9-c8df-cfe9-119d-6e933f8b13df@virtuozzo.com> References: <09cb5553-d84a-0e62-5174-315c14b88833@arm.com> <8240d4f9-c8df-cfe9-119d-6e933f8b13df@virtuozzo.com> From: Andrey Konovalov Date: Tue, 31 Jul 2018 17:21:35 +0200 Message-ID: Subject: Re: [PATCH v4 13/17] khwasan: add hooks implementation Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Ryabinin Cc: vincenzo.frascino@arm.com, Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev , linux-doc@vger.kernel.org, LKML , Linux ARM , linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Chintan Pandya , Jacob Bramley , Jann Horn , Ruben Ayrapetyan , Lee Smith , Kostya Serebryany , Mark Brand , Ramana Radhakrishnan , Evgeniy Stepanov On Tue, Jul 31, 2018 at 4:50 PM, Andrey Ryabinin wrote: > On 07/31/2018 04:05 PM, Andrey Konovalov wrote: >> We can assign tags to objects with constructors when a slab is >> allocated and call constructors once as usual. The downside is that >> such object would always have the same tag when it is reallocated, so >> we won't catch use-after-frees. > > Actually you should do this for SLAB_TYPESAFE_BY_RCU slabs. Usually they are with ->ctors but there > are few without constructors. > We can't reinitialize or even retag them. The latter will definitely cause false-positive use-after-free reports. > > As for non-SLAB_TYPESAFE_BY_RCU caches with constructors, it's probably ok to reinitialize and retag such objects. > I don't see how could any code rely on the current ->ctor() behavior in non-SLAB_TYPESAFE_BY_RCU case, > unless it does something extremely stupid or weird. > But let's not do it now. If you care, you cand do it later, with a separate patch, so we could just revert > it if anything goes wrong. OK, will do it then when there's either a constructor or the slab is SLAB_TYPESAFE_BY_RCU.