From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by kanga.kvack.org (Postfix) with ESMTP id 92DEF6B032C for ; Thu, 15 Nov 2018 08:43:04 -0500 (EST) Received: by mail-io1-f69.google.com with SMTP id q26-v6so19087892ioi.21 for ; Thu, 15 Nov 2018 05:43:04 -0800 (PST) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id i7sor30383339iti.27.2018.11.15.05.43.03 for (Google Transport Security); Thu, 15 Nov 2018 05:43:03 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20181107165200.oaou6cx2lmjzmjyl@lakrids.cambridge.arm.com> From: Andrey Konovalov Date: Thu, 15 Nov 2018 14:43:02 +0100 Message-ID: Subject: Re: [PATCH v10 08/22] kasan, arm64: untag address in __kimg_to_phys and _virt_addr_is_linear Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Mark Rutland Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , 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@googlegroups.com, "open list:DOCUMENTATION" , LKML , Linux ARM , 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 , Jann Horn , Mark Brand , Chintan Pandya , Vishwath Mohan On Wed, Nov 14, 2018 at 8:23 PM, Andrey Konovalov wrote: > On Wed, Nov 7, 2018 at 5:52 PM, Mark Rutland wrote: >>> /* >>> @@ -232,7 +241,7 @@ static inline unsigned long kaslr_offset(void) >>> #define __is_lm_address(addr) (!!((addr) & BIT(VA_BITS - 1))) >>> >>> #define __lm_to_phys(addr) (((addr) & ~PAGE_OFFSET) + PHYS_OFFSET) >>> -#define __kimg_to_phys(addr) ((addr) - kimage_voffset) >>> +#define __kimg_to_phys(addr) (KASAN_RESET_TAG(addr) - kimage_voffset) >> >> IIUC You need to adjust __lm_to_phys() too, since that could be passed >> an address from SLAB. >> >> Maybe that's done in a later patch, but if so it's confusing to split it >> out that way. It would be nicer to fix all the *_to_*() helpers in one >> go. > > __lm_to_phys() does & ~PAGE_OFFSET, so it resets the tag by itself. I > can add an explicit __tag_reset() if you think it makes sense. Hi Mark, I think I've addressed all of your comments except for this one. Do you think it makes sense to add explicit __tag_reset() calls to __lm_to_phys() and a few other macros, that already set the tag to 0 by doing & ~PAGE_OFFSET? Thanks!