linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 0/3] arm64: stacktrace: improve robustness
@ 2019-07-02 13:07 Mark Rutland
  2019-07-02 13:07 ` [PATCHv3 1/3] arm64: stacktrace: Constify stacktrace.h functions Mark Rutland
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Mark Rutland @ 2019-07-02 13:07 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: mark.rutland, tengfeif, catalin.marinas, will.deacon, james.morse,
	dave.martin

The arm64 stacktrace code is careful to only access valid stack
locations, but in the presence of a corrupted stack where frame records
form a loop, it will never terminate.

This series updates the stacktrace code to terminate in finite time even
when a stack is corrupted. A stacktrace will be terminated if the next
record is at a lower (or equal) address on the current stack, or when
the next record is on a stack we've already completed unwinding.

The first couple of patches come from Dave's prior attempt to fix this
[1], with the final patch relying on infrastructure which has been
introduced in the mean time.

I've given this a quick spin with magic-sysrq L in a KVM guest, and
things look fine, but further testing would be appreciated.

This series (based on v5.2-rc1) can also be found in my
arm64/robust-stracktrace branch on kernel.org [2].

Since v1 [3]:
* Use start_backtrace() consistently
* Don't use tsk in start_backtrace()
* Track the previous FP and type explicitly

Since v2 [4]:
* Move graph to end of stuct stackframe
* Remove prev_info, fix stacks_done
* Accumulate acks
* Add comments

Thanks,
Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-April/572685.html
[2] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/robust-stacktrace
[3] https://lore.kernel.org/linux-arm-kernel/20190606125402.10229-1-mark.rutland@arm.com/
[4] https://lore.kernel.org/linux-arm-kernel/20190628154639.5308-1-mark.rutland@arm.com/

Dave Martin (2):
  arm64: stacktrace: Constify stacktrace.h functions
  arm64: stacktrace: Factor out backtrace initialisation

Mark Rutland (1):
  arm64: stacktrace: better handle corrupted stacks

 arch/arm64/include/asm/stacktrace.h | 78 ++++++++++++++++++++++++++++++-------
 arch/arm64/kernel/perf_callchain.c  |  7 +---
 arch/arm64/kernel/process.c         |  7 +---
 arch/arm64/kernel/return_address.c  |  9 ++---
 arch/arm64/kernel/stacktrace.c      | 59 +++++++++++++++++++++-------
 arch/arm64/kernel/time.c            |  7 +---
 arch/arm64/kernel/traps.c           | 13 +++----
 7 files changed, 124 insertions(+), 56 deletions(-)

-- 
2.11.0


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-22 10:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-02 13:07 [PATCHv3 0/3] arm64: stacktrace: improve robustness Mark Rutland
2019-07-02 13:07 ` [PATCHv3 1/3] arm64: stacktrace: Constify stacktrace.h functions Mark Rutland
2019-07-02 13:07 ` [PATCHv3 2/3] arm64: stacktrace: Factor out backtrace initialisation Mark Rutland
2019-07-02 13:07 ` [PATCHv3 3/3] arm64: stacktrace: better handle corrupted stacks Mark Rutland
2019-07-03  9:13   ` Dave Martin
2019-07-22 10:41 ` [PATCHv3 0/3] arm64: stacktrace: improve robustness Catalin Marinas

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).