From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03EF6C55178 for ; Fri, 30 Oct 2020 15:55:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 72BE6206CA for ; Fri, 30 Oct 2020 15:55:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="K0Bt4tbR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72BE6206CA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE51B6B0073; Fri, 30 Oct 2020 11:55:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A947F6B0075; Fri, 30 Oct 2020 11:55:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95D4C6B007B; Fri, 30 Oct 2020 11:55:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id 6AA3C6B0073 for ; Fri, 30 Oct 2020 11:55:04 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 08723180AD804 for ; Fri, 30 Oct 2020 15:55:04 +0000 (UTC) X-FDA: 77429040528.22.twig40_1e0b4a527297 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id DD4AD18038E60 for ; Fri, 30 Oct 2020 15:55:03 +0000 (UTC) X-HE-Tag: twig40_1e0b4a527297 X-Filterd-Recvd-Size: 6462 Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 15:55:03 +0000 (UTC) Received: by mail-ot1-f68.google.com with SMTP id 32so5974063otm.3 for ; Fri, 30 Oct 2020 08:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sCugon9AoPEJ8csYK/QZPsPZOpWR2wJLxLfUDJUrNWA=; b=K0Bt4tbRQHFuGp039wzieHLjfl0FuYhnRx5bfqQwpQXcTVdbCpoeUKNfv5Ij31ox1y Kws5dwUYP+1Z1b0TCvdeeALRVxpVZ1kz8I3/bm1D9orCfONXEhAJUNAdi+s6OVB3SRoB lVG2y3PV1epogTO8AjkZs5Y17FJXXdSHdEeIeROL4OyAiGcGEjXR2mMg6TXOSoqJG7KW 1yJcYhY9GzfGcUdSnVR0oHtCe5c5HEsVjJmA8uwwAESkc9CJT6QnbSn1CPMEwlPWSjQC FWRgCdmSzxorAWWMWF7FZDcGsPLG/FNlKSttzXuCH6+u/MNwmJdJa8wUh6sGnwEcn/uk wxow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sCugon9AoPEJ8csYK/QZPsPZOpWR2wJLxLfUDJUrNWA=; b=AxdaepMbu0MQJwvxHE2SdEKtlQukjA2Ygsb1HHASKWraI+3sUPy5Lz1wyNkqBdx3jP nBvBFQDRDUYeKkXMoukItCvv8i3dsiJwIjCBWu21ZGKm1Q8J15n5M1yTOjfeKSfCIIJe 57/eJi07XqPHzS8Lf/xoo2/5sGV9KWRJ8egZtcZYx3o/2Bs6kUzpQ5vZeHEQpZ5DJ1E4 5WZqCTL8pHCGUCkBH+uln/rPMzE31G3E9FGM3TupN9yD6Y3H6HgSIuFc69eMeVuxcA+W x09U1hmDHik7PlkUwnRqjrxp/eG02szHHIatTSWqpl0RROtKHJx9nVDPMyNo+hWZDo11 puiQ== X-Gm-Message-State: AOAM530Xk46gbJepiXYhx6cUBec0rXqj8PsmbBX/AbJLbJxD6A3Tzky7 q6zKfmPKpOYqcZTbgCYJ2dO+Ur62nZmt3wMZ6/wGug== X-Google-Smtp-Source: ABdhPJwFbGXqi/JUtaO8L3QpxlNT87x8n1E4ITjvXc7fTnDKfS6vdmn4tuvb4bOooP2JLa8nQWHFVlMXtC4HQiPhYYM= X-Received: by 2002:a9d:649:: with SMTP id 67mr2236333otn.233.1604073302210; Fri, 30 Oct 2020 08:55:02 -0700 (PDT) MIME-Version: 1.0 References: <20201029131649.182037-1-elver@google.com> <20201029131649.182037-4-elver@google.com> <20201030154745.GD50718@C02TD0UTHF1T.local> In-Reply-To: <20201030154745.GD50718@C02TD0UTHF1T.local> From: Marco Elver Date: Fri, 30 Oct 2020 16:54:50 +0100 Message-ID: Subject: Re: [PATCH v6 3/9] arm64, kfence: enable KFENCE for ARM64 To: Mark Rutland Cc: Andrew Morton , Alexander Potapenko , "H. Peter Anvin" , "Paul E. McKenney" , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christoph Lameter , Dave Hansen , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Hillf Danton , Ingo Molnar , Jann Horn , Jonathan Cameron , Jonathan Corbet , Joonsoo Kim , =?UTF-8?Q?J=C3=B6rn_Engel?= , Kees Cook , Pekka Enberg , Peter Zijlstra , SeongJae Park , Thomas Gleixner , Vlastimil Babka , Will Deacon , "the arch/x86 maintainers" , "open list:DOCUMENTATION" , LKML , kasan-dev , Linux ARM , Linux Memory Management List Content-Type: text/plain; charset="UTF-8" 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: On Fri, 30 Oct 2020 at 16:47, Mark Rutland wrote: > > On Thu, Oct 29, 2020 at 02:16:43PM +0100, Marco Elver wrote: > > Add architecture specific implementation details for KFENCE and enable > > KFENCE for the arm64 architecture. In particular, this implements the > > required interface in . > > > > KFENCE requires that attributes for pages from its memory pool can > > individually be set. Therefore, force the entire linear map to be mapped > > at page granularity. Doing so may result in extra memory allocated for > > page tables in case rodata=full is not set; however, currently > > CONFIG_RODATA_FULL_DEFAULT_ENABLED=y is the default, and the common case > > is therefore not affected by this change. > > > > Reviewed-by: Dmitry Vyukov > > Co-developed-by: Alexander Potapenko > > Signed-off-by: Alexander Potapenko > > Signed-off-by: Marco Elver > > --- > > v5: > > * Move generic page allocation code to core.c [suggested by Jann Horn]. > > * Remove comment about HAVE_ARCH_KFENCE_STATIC_POOL, since we no longer > > support static pools. > > * Force page granularity for the linear map [suggested by Mark Rutland]. > > --- > > arch/arm64/Kconfig | 1 + > > arch/arm64/include/asm/kfence.h | 19 +++++++++++++++++++ > > arch/arm64/mm/fault.c | 4 ++++ > > arch/arm64/mm/mmu.c | 7 ++++++- > > 4 files changed, 30 insertions(+), 1 deletion(-) > > create mode 100644 arch/arm64/include/asm/kfence.h > > > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > > index f858c352f72a..2f8b32dddd8b 100644 > > --- a/arch/arm64/Kconfig > > +++ b/arch/arm64/Kconfig > > @@ -135,6 +135,7 @@ config ARM64 > > select HAVE_ARCH_JUMP_LABEL_RELATIVE > > select HAVE_ARCH_KASAN if !(ARM64_16K_PAGES && ARM64_VA_BITS_48) > > select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN > > + select HAVE_ARCH_KFENCE if (!ARM64_16K_PAGES && !ARM64_64K_PAGES) > > Why does this depend on the page size? > > If this is functional, but has a larger overhead on 16K or 64K, I'd > suggest removing the dependency, and just updating the Kconfig help text > to explain that. Good point, I don't think anything is requiring us to force 4K pages. Let's remove it. Thanks, -- Marco > Otherwise, this patch looks fine to me. > > Thanks, > Mark.