Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1386166pxx; Fri, 30 Oct 2020 08:50:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB8pc160pQJvuKj/tjOJkO9366BYN/ynxAwo9+jpLZJEgjE0KjVphLFXieBAtFtZ1HmZ+r X-Received: by 2002:aa7:df0c:: with SMTP id c12mr3168054edy.234.1604073001095; Fri, 30 Oct 2020 08:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604073001; cv=none; d=google.com; s=arc-20160816; b=HqpqZJjn1bU2BAMRXMoF+OoxSMD1S8KhTpnHLgAsd/WrmgujSgob9LHSMnpcDmiYXz D+b8ISP9cMuQmNpOcepjKVUULfi46Irp2dRpBIYQMUDApXVMY9MBwKef/CburgTrbVyo ssBKISXg+QqUf5IWkdkkazdWrhQnG2Wg+ggEOviEjlaw7yQ3Mg3zXD5ZZU79/xgQM4Ra P+OlqUsZ09GVR/ljaa5WfC7lafSnScHQ9oDqPTL0jcKgt1552Us69gfqHojzOQbUJ7tj D3f6LR15J7RCVp19/d8vVjeiK5UM4wkbqXtj+cibLWxdfRUtRI5WuRzuvNWwQ4NDyhIc 9z2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=u07wTeCGK2vDy14H9NwZatANJZITfF+Vjhlwyuzb8RQ=; b=TSdbN4eo7WUd4WV2mkGvt4IzjQJVAmlC4ko+3APygRMPJ8Bd5ec+VFyjGQ5kXyoCZf CRLjV/tso9Mnd9yMEUoO9hxXAhvVNDAsi0+1M3Ne19SjrnUB2VqtGlcQNlwA3usXFClz ckaccdm1RVVfZ5UznGKb/cWH3aWcuEMxMUIuCIGodSFxmr8aoA6i0M7uQOE1FKSW/w6S JR+ZnZJbJun63oIvz/Pvn//Z/GqJPcHIoPV9xj4wCLTNdEgYyosVjRXG1g39wuzDQI6N MWmCpojZWRx3n4QEHA6Kxqunfb1ZAqdWzuqGfYvJ4ogxOW4fjo4gJQk1YxBJ1nNLuoZL bcZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si4457130ejn.285.2020.10.30.08.49.35; Fri, 30 Oct 2020 08:50:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726970AbgJ3Prz (ORCPT + 99 others); Fri, 30 Oct 2020 11:47:55 -0400 Received: from foss.arm.com ([217.140.110.172]:38052 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbgJ3Prz (ORCPT ); Fri, 30 Oct 2020 11:47:55 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 70122139F; Fri, 30 Oct 2020 08:47:54 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.53.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 164E83F719; Fri, 30 Oct 2020 08:47:47 -0700 (PDT) Date: Fri, 30 Oct 2020 15:47:45 +0000 From: Mark Rutland To: Marco Elver Cc: akpm@linux-foundation.org, glider@google.com, hpa@zytor.com, paulmck@kernel.org, andreyknvl@google.com, aryabinin@virtuozzo.com, luto@kernel.org, bp@alien8.de, catalin.marinas@arm.com, cl@linux.com, dave.hansen@linux.intel.com, rientjes@google.com, dvyukov@google.com, edumazet@google.com, gregkh@linuxfoundation.org, hdanton@sina.com, mingo@redhat.com, jannh@google.com, Jonathan.Cameron@huawei.com, corbet@lwn.net, iamjoonsoo.kim@lge.com, joern@purestorage.com, keescook@chromium.org, penberg@kernel.org, peterz@infradead.org, sjpark@amazon.com, tglx@linutronix.de, vbabka@suse.cz, will@kernel.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH v6 3/9] arm64, kfence: enable KFENCE for ARM64 Message-ID: <20201030154745.GD50718@C02TD0UTHF1T.local> References: <20201029131649.182037-1-elver@google.com> <20201029131649.182037-4-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201029131649.182037-4-elver@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Otherwise, this patch looks fine to me. Thanks, Mark.