linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Marco Elver <elver@google.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"Alexander Potapenko" <glider@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	"Andrey Konovalov" <andreyknvl@google.com>,
	"Andrey Ryabinin" <aryabinin@virtuozzo.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Christoph Lameter" <cl@linux.com>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"David Rientjes" <rientjes@google.com>,
	"Dmitry Vyukov" <dvyukov@google.com>,
	"Eric Dumazet" <edumazet@google.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Hillf Danton" <hdanton@sina.com>,
	"Ingo Molnar" <mingo@redhat.com>, "Jann Horn" <jannh@google.com>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Joonsoo Kim" <iamjoonsoo.kim@lge.com>,
	"Jörn Engel" <joern@purestorage.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Pekka Enberg" <penberg@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"SeongJae Park" <sjpark@amazon.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Will Deacon" <will@kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	"Linux Memory Management List" <linux-mm@kvack.org>
Subject: Re: [PATCH v7 3/9] arm64, kfence: enable KFENCE for ARM64
Date: Wed, 4 Nov 2020 14:56:01 +0000	[thread overview]
Message-ID: <20201104145601.GB7577@C02TD0UTHF1T.local> (raw)
In-Reply-To: <CANpmjNNyY+Myv12P-iou80LhQ0aG5UFudLbVWmRBcM3V=G540A@mail.gmail.com>

On Wed, Nov 04, 2020 at 03:23:48PM +0100, Marco Elver wrote:
> On Wed, 4 Nov 2020 at 14:06, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Tue, Nov 03, 2020 at 06:58:35PM +0100, Marco Elver wrote:
> > There is one thing that I thing we should improve as a subsequent
> > cleanup, but I don't think that should block this as-is.
> >
> > > +#define KFENCE_SKIP_ARCH_FAULT_HANDLER "el1_sync"
> >
> > IIUC, the core kfence code is using this to figure out where to trace
> > from when there's a fault taken on an access to a protected page.
> 
> Correct.
> 
> > It would be better if the arch code passed the exception's pt_regs into
> > the kfence fault handler, and the kfence began the trace began from
> > there. That would also allow for dumping the exception registers which
> > can help with debugging (e.g. figuring out how the address was derived
> > when it's calculated from multiple source registers). That would also be
> > a bit more robust to changes in an architectures' exception handling
> > code.
> 
> Good idea, thanks. I guess there's no reason to not want to always
> skip to instruction_pointer(regs)?

I don't think we need the exception handling gunk in the trace, but note
that you'd need to use stack_trace_save_regs(regs, ...) directly, rather
than using stack_trace_save() and skipping based on
instruction_pointer(regs). Otherwise, if the fault was somewhere in an
exception handler, and we invoked the same function on the path to the
kfence fault handler we might cut the trace at the wrong point.

> In which case I can prepare a patch to make this change. If this
> should go into a v8, please let me know. But it'd be easier as a
> subsequent patch as you say, given it'll be easier to review and these
> patches are in -mm now.

I think it'd make more sense as a subsequent change, since it's liable
to need a cycle or two of review, and I don't think it should block the
rest of the series.

Thanks,
Mark.


  reply	other threads:[~2020-11-04 14:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 17:58 [PATCH v7 0/9] KFENCE: A low-overhead sampling-based memory safety error detector Marco Elver
2020-11-03 17:58 ` [PATCH v7 1/9] mm: add Kernel Electric-Fence infrastructure Marco Elver
2020-11-03 22:17   ` Jann Horn
2020-11-03 17:58 ` [PATCH v7 2/9] x86, kfence: enable KFENCE for x86 Marco Elver
2020-11-03 22:17   ` Jann Horn
2020-11-03 17:58 ` [PATCH v7 3/9] arm64, kfence: enable KFENCE for ARM64 Marco Elver
2020-11-03 22:17   ` Jann Horn
2020-11-04 13:06   ` Mark Rutland
2020-11-04 14:23     ` Marco Elver
2020-11-04 14:56       ` Mark Rutland [this message]
2020-11-03 17:58 ` [PATCH v7 4/9] mm, kfence: insert KFENCE hooks for SLAB Marco Elver
2020-11-03 17:58 ` [PATCH v7 5/9] mm, kfence: insert KFENCE hooks for SLUB Marco Elver
2020-11-03 17:58 ` [PATCH v7 6/9] kfence, kasan: make KFENCE compatible with KASAN Marco Elver
2020-11-03 17:58 ` [PATCH v7 7/9] kfence, Documentation: add KFENCE documentation Marco Elver
2020-11-03 22:17   ` Jann Horn
2020-11-03 17:58 ` [PATCH v7 8/9] kfence: add test suite Marco Elver
2020-11-03 22:17   ` Jann Horn
2020-11-03 17:58 ` [PATCH v7 9/9] MAINTAINERS: add entry for KFENCE Marco Elver
2020-11-04  0:31 ` [PATCH v7 0/9] KFENCE: A low-overhead sampling-based memory safety error detector Andrew Morton
2020-11-04 12:36   ` Marco Elver
2020-11-04 15:16     ` Alexander Potapenko

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=20201104145601.GB7577@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