From: Mark Rutland <mark.rutland@arm.com>
To: Miroslav Benes <mbenes@suse.cz>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Mark Brown <broonie@kernel.org>, Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org, jpoimboe@redhat.com
Subject: Re: [RFC PATCH 0/3] arm64: Implement reliable stack trace
Date: Thu, 15 Oct 2020 15:16:12 +0100 [thread overview]
Message-ID: <20201015141612.GC50416@C02TD0UTHF1T.local> (raw)
In-Reply-To: <alpine.LSU.2.21.2010151533490.14094@pobox.suse.cz>
On Thu, Oct 15, 2020 at 03:39:37PM +0200, Miroslav Benes wrote:
> Hi,
Hi all,
> On Mon, 12 Oct 2020, Mark Brown wrote:
>
> > This patch series aims to implement reliable stacktrace for arm64.
> > Reliable stacktrace exists mainly to support live patching, it provides
> > a version of stacktrace that checks for consistency problems in the
> > traces it generates and provides an error code to callers indicating if
> > any problems were detected.
> >
> > This is a first cut of support for arm64, I've not really even started
> > testing it meaningfully at this point. The main thing I'm looking for
> > here is that I'm not sure if there are any more potential indicators of
> > unrelabile stacks that I'm missing tests for or anything about the
> > interfaces that I've misunderstood.
>
> I'll just copy an excerpt from my notes about the required guarantees.
> Written by Josh (CCed, he has better idea about the problem than me
> anyway).
>
> "
> The unwinder needs to be able to detect all stack corruption and return
> an error.
> [ But note that we don't need to worry about unwinding a task's stack
> while the task is running, which can be a common source of
> "corruption". For livepatch we make sure every task is blocked
> (except when checking the current task). ]
>
> It also needs to:
> - detect preemption / page fault frames and return an error
> - only return success if it reaches the end of the task stack; for user
> tasks, that means the syscall barrier; for kthreads/idle tasks, that
> means finding a defined thread entry point
> - make sure it can't get into a recursive loop
> - make sure each return address is a valid text address
> - properly detect generated code hacks like function graph tracing and
> kretprobes
> "
It would be great if we could put something like the above into the
kernel tree, either under Documentation/ or in a comment somewhere for
the reliable stacktrace functions.
AFAICT, existing architectures don't always handle all of the above in
arch_stack_walk_reliable(). For example, it looks like x86 assumes
unwiding through exceptions is reliable for !CONFIG_FRAME_POINTER, but I
think this might not always be true.
I was planning to send a mail once I've finished writing a test, but
IIUC there are some windows where ftrace/kretprobes detection/repainting
may not work, e.g. if preempted after ftrace_return_to_handler()
decrements curr_ret_stack, but before the arch termpoline asm restores
the original return addr. So we might need something like an
in_return_trampoline() to detect and report that reliably.
Thanks,
Mark.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-10-15 14:17 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 17:26 [RFC PATCH 0/3] arm64: Implement reliable stack trace Mark Brown
2020-10-12 17:26 ` [RFC PATCH 1/3] arm64: remove EL0 exception frame record Mark Brown
2020-10-12 17:26 ` [RFC PATCH 2/3] arm64: stacktrace: Report when we reach the end of the stack Mark Brown
2020-10-13 11:07 ` Mark Rutland
2020-10-12 17:26 ` [RFC PATCH 3/3] arm64: stacktrace: Implement reliable stacktrace Mark Brown
2020-10-13 10:42 ` Mark Brown
2020-10-13 11:42 ` Mark Rutland
2020-10-13 16:12 ` Mark Brown
2020-10-15 13:33 ` Miroslav Benes
2020-10-15 15:57 ` Mark Brown
2020-10-16 10:13 ` Miroslav Benes
2020-10-16 12:30 ` Mark Brown
2020-10-15 13:39 ` [RFC PATCH 0/3] arm64: Implement reliable stack trace Miroslav Benes
2020-10-15 14:16 ` Mark Rutland [this message]
2020-10-15 15:49 ` Mark Brown
2020-10-15 21:29 ` Josh Poimboeuf
2020-10-16 11:14 ` Mark Rutland
2020-10-20 10:03 ` Mark Rutland
2020-10-20 15:58 ` Josh Poimboeuf
2020-10-16 12:15 ` Mark Brown
2020-10-19 23:41 ` Josh Poimboeuf
2020-10-20 15:39 ` Mark Brown
2020-10-20 16:28 ` Josh Poimboeuf
2021-01-27 14:02 ` Madhavan T. Venkataraman
2021-01-27 16:40 ` Mark Rutland
2021-01-27 17:11 ` Mark Brown
2021-01-27 17:24 ` Madhavan T. Venkataraman
2021-01-27 19:54 ` Madhavan T. Venkataraman
2021-01-28 14:22 ` Mark Brown
2021-01-28 15:26 ` Josh Poimboeuf
2021-01-29 21:39 ` Madhavan T. Venkataraman
2021-02-01 3:20 ` Madhavan T. Venkataraman
2021-02-01 14:39 ` Mark Brown
2021-01-30 4:38 ` Madhavan T. Venkataraman
2021-02-01 15:21 ` Madhavan T. Venkataraman
2021-02-01 15:46 ` Madhavan T. Venkataraman
2021-02-01 16:02 ` Mark Rutland
2021-02-01 16:22 ` Mark Brown
2021-02-01 21:40 ` Madhavan T. Venkataraman
2021-02-01 21:38 ` Madhavan T. Venkataraman
2021-02-01 23:00 ` Josh Poimboeuf
2021-02-02 2:29 ` Madhavan T. Venkataraman
2021-02-02 3:36 ` Josh Poimboeuf
2021-02-02 10:05 ` Mark Rutland
2021-02-02 13:33 ` Madhavan T. Venkataraman
2021-02-02 13:35 ` Madhavan T. Venkataraman
2021-02-02 23:32 ` Madhavan T. Venkataraman
2021-02-03 16:53 ` Mark Rutland
2021-02-03 19:03 ` Madhavan T. Venkataraman
2021-02-05 2:36 ` Madhavan T. Venkataraman
2021-02-01 21:59 ` Madhavan T. Venkataraman
2021-02-02 13:36 ` Mark Brown
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=20201015141612.GC50416@C02TD0UTHF1T.local \
--to=mark.rutland@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jpoimboe@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mbenes@suse.cz \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).