From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f198.google.com (mail-yw0-f198.google.com [209.85.161.198]) by kanga.kvack.org (Postfix) with ESMTP id 03C176B002D for ; Fri, 16 Mar 2018 16:21:04 -0400 (EDT) Received: by mail-yw0-f198.google.com with SMTP id w134so6090514ywa.21 for ; Fri, 16 Mar 2018 13:21:03 -0700 (PDT) Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id s140-v6sor803696ybc.54.2018.03.16.13.21.02 for (Google Transport Security); Fri, 16 Mar 2018 13:21:02 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <06a4d0c483fba8babd01fe23727fe4a79482d309.1520017438.git.andreyknvl@google.com> <7f8e8f46-791e-7e8f-551b-f93aa64bcf6e@virtuozzo.com> From: Evgenii Stepanov Date: Fri, 16 Mar 2018 13:21:01 -0700 Message-ID: Subject: Re: [RFC PATCH 09/14] khwasan: add hooks implementation Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Konovalov Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Jonathan Corbet , Catalin Marinas , Will Deacon , Theodore Ts'o , Jan Kara , Christopher Li , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Masahiro Yamada , Michal Marek , Mark Rutland , Ard Biesheuvel , Yury Norov , Nick Desaulniers , Marc Zyngier , Suzuki K Poulose , Kristina Martsenko , Punit Agrawal , Dave Martin , James Morse , Julien Thierry , Michael Weiser , Steve Capper , Ingo Molnar , Thomas Gleixner , Sandipan Das , Paul Lawrence , David Woodhouse , Kees Cook , Geert Uytterhoeven , Josh Poimboeuf , Arnd Bergmann , kasan-dev , linux-doc@vger.kernel.org, LKML , Linux ARM , linux-ext4@vger.kernel.org, linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Kostya Serebryany , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Kees Cook , Jann Horn , Mark Brand On Fri, Mar 16, 2018 at 12:06 PM, Andrey Konovalov wrote: > On Fri, Mar 16, 2018 at 7:45 PM, Evgenii Stepanov wrote: >> On Fri, Mar 16, 2018 at 11:24 AM, Andrey Konovalov >> wrote: >>> Right, by redzones in this case I meant the metadata that is stored >>> right after the object (which includes alloc and free stack handles >>> and perhaps some other allocator stuff). >> >> Oh, I did not realize we have free (as in beer, not as in >> use-after-free) redzones between allocations. Yes, reserving a color >> sounds >> like a good idea. > > OK, I'll do that then. > >> >>> >>>> As for use-after-free, to catch it with >>>> 100% probability one would need infinite memory for the quarantine. > > As for the second part of Andrey's suggestion (as far as I understand > it): reserve a color for freed objects. Without quarantine, this > should give us a precise > use-after-free-but-without-someone-else-allocating-the-same-object > detection. What do you think about that? Still non-deterministic, but we can use the same color we reserved for the redzones, why not. > >>>> It >>>> is possible to guarantee 100% detection of linear buffer overflow by >>>> giving live adjacent chunks distinct tags. > > I'll add that to the TODO list as well.