Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Marco Elver <elver@google.com>
Cc: hdanton@sina.com, linux-doc@vger.kernel.org,
	peterz@infradead.org, catalin.marinas@arm.com,
	dave.hansen@linux.intel.com, linux-mm@kvack.org,
	edumazet@google.com, glider@google.com, hpa@zytor.com,
	cl@linux.com, will@kernel.org, sjpark@amazon.com, corbet@lwn.net,
	x86@kernel.org, kasan-dev@googlegroups.com, mingo@redhat.com,
	vbabka@suse.cz, rientjes@google.com, aryabinin@virtuozzo.com,
	joern@purestorage.com, keescook@chromium.org, paulmck@kernel.org,
	jannh@google.com, andreyknvl@google.com, bp@alien8.de,
	luto@kernel.org, Jonathan.Cameron@huawei.com, tglx@linutronix.de,
	akpm@linux-foundation.org, dvyukov@google.com,
	linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, penberg@kernel.org,
	iamjoonsoo.kim@lge.com
Subject: Re: [PATCH v6 3/9] arm64, kfence: enable KFENCE for ARM64
Date: Fri, 30 Oct 2020 15:47:45 +0000	[thread overview]
Message-ID: <20201030154745.GD50718@C02TD0UTHF1T.local> (raw)
In-Reply-To: <20201029131649.182037-4-elver@google.com>

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 <asm/kfence.h>.
> 
> 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 <dvyukov@google.com>
> Co-developed-by: Alexander Potapenko <glider@google.com>
> Signed-off-by: Alexander Potapenko <glider@google.com>
> Signed-off-by: Marco Elver <elver@google.com>
> ---
> 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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-10-30 15:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 13:16 [PATCH v6 0/9] KFENCE: A low-overhead sampling-based memory safety error detector Marco Elver
2020-10-29 13:16 ` [PATCH v6 1/9] mm: add Kernel Electric-Fence infrastructure Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-30 19:16     ` Marco Elver
2020-10-29 13:16 ` [PATCH v6 2/9] x86, kfence: enable KFENCE for x86 Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-30 13:00     ` Marco Elver
2020-10-30 15:22       ` Jann Horn
2020-10-29 13:16 ` [PATCH v6 3/9] arm64, kfence: enable KFENCE for ARM64 Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-30 16:00     ` Mark Rutland
2020-10-30 15:47   ` Mark Rutland [this message]
2020-10-30 15:54     ` Marco Elver
2020-10-29 13:16 ` [PATCH v6 4/9] mm, kfence: insert KFENCE hooks for SLAB Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-30 15:41     ` Marco Elver
2020-10-29 13:16 ` [PATCH v6 5/9] mm, kfence: insert KFENCE hooks for SLUB Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-29 13:16 ` [PATCH v6 6/9] kfence, kasan: make KFENCE compatible with KASAN Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-30 13:46     ` Marco Elver
2020-10-30 15:08       ` Jann Horn
2020-10-30 15:19         ` Marco Elver
2020-10-29 13:16 ` [PATCH v6 7/9] kfence, Documentation: add KFENCE documentation Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-30  9:59     ` Alexander Potapenko
2020-10-29 13:16 ` [PATCH v6 8/9] kfence: add test suite Marco Elver
2020-10-30  2:49   ` Jann Horn
2020-10-30 10:50     ` Marco Elver
2020-10-29 13:16 ` [PATCH v6 9/9] MAINTAINERS: Add entry for KFENCE Marco Elver
2020-10-30  2:50   ` Jann Horn
2020-10-30  2:49 ` [PATCH v6 0/9] KFENCE: A low-overhead sampling-based memory safety error detector Jann Horn
2020-10-30 10:56   ` Marco Elver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201030154745.GD50718@C02TD0UTHF1T.local \
    --to=mark.rutland@arm.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdanton@sina.com \
    --cc=hpa@zytor.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jannh@google.com \
    --cc=joern@purestorage.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=sjpark@amazon.com \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox