From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id CF65F6B0003 for ; Tue, 10 Apr 2018 12:30:55 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id a6so7185932pfn.3 for ; Tue, 10 Apr 2018 09:30:55 -0700 (PDT) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30111.outbound.protection.outlook.com. [40.107.3.111]) by mx.google.com with ESMTPS id o13-v6si2966941pli.518.2018.04.10.09.30.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 09:30:52 -0700 (PDT) Subject: Re: [RFC PATCH v2 13/15] khwasan: add hooks implementation References: <805d1e85-2d3c-2327-6e6c-f14a56dc0b67@virtuozzo.com> <0c4397da-e231-0044-986f-b8468314be76@virtuozzo.com> <0857f052-a27a-501e-8923-c6f31510e4fe@virtuozzo.com> <0f448799-3a06-a25d-d604-21db3e8577fc@virtuozzo.com> From: Andrey Ryabinin Message-ID: Date: Tue, 10 Apr 2018 19:31:33 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Konovalov Cc: Alexander Potapenko , Dmitry Vyukov , Jonathan Corbet , Catalin Marinas , Will Deacon , Marc Zyngier , Christopher Li , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Masahiro Yamada , Michal Marek , Mark Rutland , Ard Biesheuvel , Yury Norov , Nick Desaulniers , Suzuki K Poulose , Kristina Martsenko , Punit Agrawal , Dave Martin , Michael Weiser , James Morse , Julien Thierry , Steve Capper , Tyler Baicar , "Eric W . Biederman" , Thomas Gleixner , Ingo Molnar , Paul Lawrence , Greg Kroah-Hartman , David Woodhouse , Sandipan Das , Kees Cook , Herbert Xu , Geert Uytterhoeven , Josh Poimboeuf , Arnd Bergmann , kasan-dev , linux-doc@vger.kernel.org, LKML , Linux ARM , kvmarm@lists.cs.columbia.edu, linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Kees Cook , Jann Horn , Mark Brand On 04/10/2018 07:07 PM, Andrey Konovalov wrote: > On Fri, Apr 6, 2018 at 2:27 PM, Andrey Ryabinin wrote: >> On 04/06/2018 03:14 PM, Andrey Konovalov wrote: >>> On Thu, Apr 5, 2018 at 3:02 PM, Andrey Ryabinin wrote: >>>> Nevertheless, this doesn't mean that we should ignore *all* accesses to !slab memory. >>> >>> So you mean we need to find a way to ignore accesses via pointers >>> returned by page_address(), but still check accesses through all other >>> pointers tagged with 0xFF? I don't see an obvious way to do this. I'm >>> open to suggestions though. >>> >> >> I'm saying that we need to ignore accesses to slab objects if pointer >> to slab object obtained via page_address() + offset_in_page() trick, but don't ignore >> anything else. >> >> So, save tag somewhere in page struct and poison shadow with that tag. Make page_address() to >> return tagged address for all !PageSlab() pages. For PageSlab() pages page_address() should return >> 0xff tagged address, so we could ignore such accesses. > > Which pages do you mean by !PageSlab()? Literally the "PageSlab(page) == false" pages. > The ones that are allocated and freed by pagealloc, but mot managed by the slab allocator? Yes. > Perhaps we should then add tagging to the pagealloc hook instead? > Of course the tagging would be in kasan_alloc_pages(), where else that could be? And instead of what?