From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f69.google.com (mail-it0-f69.google.com [209.85.214.69]) by kanga.kvack.org (Postfix) with ESMTP id 9BEFE6B0007 for ; Fri, 9 Mar 2018 13:15:31 -0500 (EST) Received: by mail-it0-f69.google.com with SMTP id y83so2797956ita.5 for ; Fri, 09 Mar 2018 10:15:31 -0800 (PST) Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id d72sor1244535itb.69.2018.03.09.10.15.30 for (Google Transport Security); Fri, 09 Mar 2018 10:15:30 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20180305142907.uvrvwmtfl7o45myf@lakrids.cambridge.arm.com> References: <739eecf573b6342fc41c4f89d7f64eb8c183e312.1520017438.git.andreyknvl@google.com> <20180305142907.uvrvwmtfl7o45myf@lakrids.cambridge.arm.com> From: Andrey Konovalov Date: Fri, 9 Mar 2018 19:15:29 +0100 Message-ID: Subject: Re: [RFC PATCH 06/14] khwasan: enable top byte ignore for the kernel 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 , 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 , Ard Biesheuvel , Yury Norov , Nick Desaulniers , Marc Zyngier , Bob Picco , 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 , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Kees Cook , Jann Horn , Mark Brand On Mon, Mar 5, 2018 at 3:29 PM, Mark Rutland wrote: > On Fri, Mar 02, 2018 at 08:44:25PM +0100, Andrey Konovalov wrote: >> +#ifdef CONFIG_KASAN_TAGS >> +#define TCR_TBI_FLAGS (TCR_TBI0 | TCR_TBI1) >> +#else >> +#define TCR_TBI_FLAGS TCR_TBI0 >> +#endif > > Rather than pulling TBI0 into this, I think it'd make more sense to > have: > > #ifdef CONFIG_KASAN_TAGS > #define KASAN_TCR_FLAGS TCR_TBI1 > #else > #define KASAN_TCR_FLAGS > #endif > >> + >> #define MAIR(attr, mt) ((attr) << ((mt) * 8)) >> >> /* >> @@ -432,7 +438,7 @@ ENTRY(__cpu_setup) >> * both user and kernel. >> */ >> ldr x10, =TCR_TxSZ(VA_BITS) | TCR_CACHE_FLAGS | TCR_SMP_FLAGS | \ >> - TCR_TG_FLAGS | TCR_ASID16 | TCR_TBI0 | TCR_A1 >> + TCR_TG_FLAGS | TCR_ASID16 | TCR_TBI_FLAGS | TCR_A1 > > ... and just append KASAN_TCR_FLAGS to the flags here. > > That's roughtly what we do with ENDIAN_SET_EL1 for SCTLR_EL1. > OK, will do!