Message ID | 6dc5e2922cc3d44792d9277be843558892b1b671.1525798754.git.andreyknvl@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0362A602C2 for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 8 May 2018 17:21:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0B6E290B3 for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 8 May 2018 17:21:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D47E4290B9; Tue, 8 May 2018 17:21:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 558A9290B3 for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 8 May 2018 17:21:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E36AA6B02CA; Tue, 8 May 2018 13:21:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DE7A26B02CB; Tue, 8 May 2018 13:21:31 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C11366B02CC; Tue, 8 May 2018 13:21:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id 64BEB6B02CB for <linux-mm@kvack.org>; Tue, 8 May 2018 13:21:31 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id d82so3717759wmd.4 for <linux-mm@kvack.org>; Tue, 08 May 2018 10:21:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:in-reply-to:references; bh=jbkhXrRvTlyGtIhCUyaj6swglIMiFavfzggX8v1LmeQ=; b=Sri/GjoUGLjOU/MRvwtCTLF1QIhpTxnSTR7ckpuhQPwx//jDSqkVDweBOHw5bioOEi W2YBIo4xtVTuOCklDKsg4jfGEeedcYI3woLzw0uOpdwY246bP2S/McU/bfUf87gPqd+z wXiNXD4Vc8ulynvuZpR+G5u1fepXheXxFvmnTgnUVZ0nvj7V2lovo/DMTtjBGrAYYCJk dzTo2i1HkrlNnDIBFwwX/O4dzsV1OrUcVrMI4X+9Kap584yk0ASTxzB6SXplAxlKE7sR oOwNK4HgKequKYlB42oXXgQ3BZLOFNgZk9u/wll+VOsLo4SgpRh5woYycVJlM+ae/8qy kMmg== X-Gm-Message-State: ALQs6tBvfNN/MwG9Tj8+Tk2ianR88k+f5OCmbiLz4HK8iKVdxFuLOztx KMd7PvIpewJkif8lqBgALSbaAD5/dRWAQ5R0UjCjm5a+vnv0DkR5P7M2rsFZhJDRlCL7nry9gMB zsMQ8XN7HB/hCyyp7EsvcFsj4w8bW3rdbJvQmXn29YU5WGheH35xpLBdPlkYXXAIQffazZRRPo3 gVBZSwXYBrr3Oaeg9r7AxCH/qkkT3st0e7G9+yTsCtw48qe2I1Q3A55j1O1C7jNEn+YClPT8bWn j3MEXQD9x9dgWfKv1S5a3R6Js/fuZuswaW29sBkafaQXL04ep0zidGpUhQptzodwb1fQEX0z5kM 0rdsa9DY/ylKkxUzfOpMD4MgGisg9iSZT08TF9HiiSGcovtgjJw8XpbHIl0uggwRHR/S+B44H1T m X-Received: by 2002:adf:879c:: with SMTP id b28-v6mr33509448wrb.119.1525800090952; Tue, 08 May 2018 10:21:30 -0700 (PDT) X-Received: by 2002:adf:879c:: with SMTP id b28-v6mr33509385wrb.119.1525800090159; Tue, 08 May 2018 10:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525800090; cv=none; d=google.com; s=arc-20160816; b=l4KVFd59YQlH90NK6BWjY+ZJxbfgIDzGTVrbYbf/Y8lzGBqgNW2x4UvRfQGfq/0Wbh QmkXTHNksK7zQEDVee8/rABwWR3n/gN/1bL4nQjDuwDH2O4QvChM+M+Yhx01SCzTcxkr BCzTVVU+CJ7nwwj+eOcH3yHhzgq0hpnxnkKTmNxGT/B1Dmapo9CIGGl0tCMtheKG8Oqu H0gyWi/kMVY8dxSsvtUxp8NcYj6EtXV5WSl/F/EL8EsQ7m9anLYbA9RTsktULwwX9Cmz f+wpz3U7pqS1vboNekrO9yV69ihBti05a7G2jkCqz5aNV+fr3dUMp0NP/sGAbbJDugwU tS8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=jbkhXrRvTlyGtIhCUyaj6swglIMiFavfzggX8v1LmeQ=; b=VFm1cfcF+lpHkCkzegyEshbpdbsRWVGwunV6PAOhsKLymcxvwIH4zJx4VTDxN/OaWr UuW7ldvDRsUq+PH14fnvug7yMfMTPzW1NpIf3ui59EcTTA/s0uGL+0IGTpp197v5d5ff q7EnhTVFHsfQ10Rzk4o9Y9PkzYV1ciyfggZXK/aqHoc91WP8IttBzDVb0dsjJV2r6goE mfokzh8fmzpmCbfO4ycjRk0AYEC8NUXPlq3yA+e0k75GbHVYtqPoaTZWgN0crhpo71m+ OVVOxLGnQsOCzOxcWBTrRfDaXRZ2htB4sNGEhUlqK8ZLmg4BP/RlLx8dQTg6Popk/WsU L2Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CvgfYjjR; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w16-v6sor11799428wrc.60.2018.05.08.10.21.30 for <linux-mm@kvack.org> (Google Transport Security); Tue, 08 May 2018 10:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CvgfYjjR; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=jbkhXrRvTlyGtIhCUyaj6swglIMiFavfzggX8v1LmeQ=; b=CvgfYjjRfHX2QPW0OlFdSxgHEOH4DjV6UQzmomLvxbs9t08Awm6kl3hoNQ64/XYF9z DP7Ku3jcLJ6tk71yF/BXf1DwSisKWjlNnPTvlFMpZLGNXjcDkNGGDjVZ7UYX7/OoLUzd FgPTD7srh7/v45T+CfMZ+4d4nutd+GQNxsgh4PY4VZuF6yvx2pU1RGSHENJOBLFTeMBL ml3PpQr/ydq777DTzGf28JeDagkiHpAEQyxaf1IHDAalM0ZomBqA9EQYjEK1XqAXboOh xICqARSOkKd6gjQU2zhvTElfXRsNbyEPx1hdAhwyGkzIyAEn1aiEK4gKKo9JfstxXiaN jFpA== X-Google-Smtp-Source: AB8JxZpYsqKAiJ2z9Ce+h5NOhiZ7W+/cd/jBI8i+zQ6XuExLEkhgnU1s4LhUvW/4vLqG2FuVqGuTwg== X-Received: by 2002:adf:80cd:: with SMTP id 71-v6mr17758042wrl.238.1525800089212; Tue, 08 May 2018 10:21:29 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id m134sm14178311wmg.4.2018.05.08.10.21.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 10:21:28 -0700 (PDT) From: Andrey Konovalov <andreyknvl@google.com> To: Andrey Ryabinin <aryabinin@virtuozzo.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Jonathan Corbet <corbet@lwn.net>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Christopher Li <sparse@chrisli.org>, Christoph Lameter <cl@linux.com>, Pekka Enberg <penberg@kernel.org>, David Rientjes <rientjes@google.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Andrew Morton <akpm@linux-foundation.org>, Masahiro Yamada <yamada.masahiro@socionext.com>, Michal Marek <michal.lkml@markovi.net>, Andrey Konovalov <andreyknvl@google.com>, Mark Rutland <mark.rutland@arm.com>, Nick Desaulniers <ndesaulniers@google.com>, Yury Norov <ynorov@caviumnetworks.com>, Marc Zyngier <marc.zyngier@arm.com>, Kristina Martsenko <kristina.martsenko@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Punit Agrawal <punit.agrawal@arm.com>, Dave Martin <dave.martin@arm.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, James Morse <james.morse@arm.com>, Michael Weiser <michael.weiser@gmx.de>, Julien Thierry <julien.thierry@arm.com>, Tyler Baicar <tbaicar@codeaurora.org>, "Eric W . Biederman" <ebiederm@xmission.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>, Kees Cook <keescook@chromium.org>, Sandipan Das <sandipan@linux.vnet.ibm.com>, David Woodhouse <dwmw@amazon.co.uk>, Paul Lawrence <paullawrence@google.com>, Herbert Xu <herbert@gondor.apana.org.au>, Josh Poimboeuf <jpoimboe@redhat.com>, Geert Uytterhoeven <geert@linux-m68k.org>, Tom Lendacky <thomas.lendacky@amd.com>, Arnd Bergmann <arnd@arndb.de>, Dan Williams <dan.j.williams@intel.com>, Michal Hocko <mhocko@suse.com>, Jan Kara <jack@suse.cz>, Ross Zwisler <ross.zwisler@linux.intel.com>, =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= <jglisse@redhat.com>, Matthew Wilcox <mawilcox@microsoft.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, Souptick Joarder <jrdr.linux@gmail.com>, Hugh Dickins <hughd@google.com>, Davidlohr Bueso <dave@stgolabs.net>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Philippe Ombredanne <pombredanne@nexb.com>, Kate Stewart <kstewart@linuxfoundation.org>, Laura Abbott <labbott@redhat.com>, Boris Brezillon <boris.brezillon@bootlin.com>, Vlastimil Babka <vbabka@suse.cz>, Pintu Agarwal <pintu.ping@gmail.com>, Doug Berger <opendmb@gmail.com>, Anshuman Khandual <khandual@linux.vnet.ibm.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Mel Gorman <mgorman@suse.de>, Pavel Tatashin <pasha.tatashin@oracle.com>, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>, kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kbuild@vger.kernel.org Cc: Kostya Serebryany <kcc@google.com>, Evgeniy Stepanov <eugenis@google.com>, Lee Smith <Lee.Smith@arm.com>, Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>, Jacob Bramley <Jacob.Bramley@arm.com>, Ruben Ayrapetyan <Ruben.Ayrapetyan@arm.com>, Kees Cook <keescook@google.com>, Jann Horn <jannh@google.com>, Mark Brand <markbrand@google.com>, Chintan Pandya <cpandya@codeaurora.org> Subject: [PATCH v1 09/16] khwasan, arm64: enable top byte ignore for the kernel Date: Tue, 8 May 2018 19:20:55 +0200 Message-Id: <6dc5e2922cc3d44792d9277be843558892b1b671.1525798754.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <cover.1525798753.git.andreyknvl@google.com> References: <cover.1525798753.git.andreyknvl@google.com> In-Reply-To: <cover.1525798753.git.andreyknvl@google.com> References: <cover.1525798753.git.andreyknvl@google.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index fd208eac9f2a..483aceedad76 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h @@ -289,6 +289,7 @@ #define TCR_A1 (UL(1) << 22) #define TCR_ASID16 (UL(1) << 36) #define TCR_TBI0 (UL(1) << 37) +#define TCR_TBI1 (UL(1) << 38) #define TCR_HA (UL(1) << 39) #define TCR_HD (UL(1) << 40) #define TCR_NFD1 (UL(1) << 54) diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 5f9a73a4452c..f3dfcd74a285 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -47,6 +47,12 @@ /* PTWs cacheable, inner/outer WBWA */ #define TCR_CACHE_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA +#ifdef CONFIG_KASAN_HW +#define TCR_KASAN_FLAGS TCR_TBI1 +#else +#define TCR_KASAN_FLAGS 0 +#endif + #define MAIR(attr, mt) ((attr) << ((mt) * 8)) /* @@ -439,7 +445,7 @@ ENTRY(__cpu_setup) */ ldr x10, =TCR_TxSZ(VA_BITS) | TCR_CACHE_FLAGS | TCR_SMP_FLAGS | \ TCR_TG_FLAGS | TCR_KASLR_FLAGS | TCR_ASID16 | \ - TCR_TBI0 | TCR_A1 + TCR_TBI0 | TCR_A1 | TCR_KASAN_FLAGS tcr_set_idmap_t0sz x10, x9 /*
KHWASAN uses the Top Byte Ignore feature of arm64 CPUs to store a pointer tag in the top byte of each pointer. This commit enables the TCR_TBI1 bit, which enables Top Byte Ignore for the kernel, when KHWASAN is used. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- arch/arm64/include/asm/pgtable-hwdef.h | 1 + arch/arm64/mm/proc.S | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-)