All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] arm64: stacktrace: Report when we reach the end of the stack
@ 2021-02-24 16:50 Mark Brown
  2021-02-25 11:02 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2021-02-24 16:50 UTC (permalink / raw)
  To: Madhavan T . Venkataraman, Catalin Marinas, Will Deacon
  Cc: Mark Rutland, Mark Brown, linux-arm-kernel

Currently the arm64 unwinder code returns -EINVAL whenever it can't find
the next stack frame, not distinguishing between cases where the stack has
been corrupted or is otherwise in a state it shouldn't be and cases
where we have reached the end of the stack. At the minute none of the
callers care what error code is returned but this will be important for
reliable stack trace which needs to be sure that the stack is intact.

Change to return -ENOENT in the case where we reach the bottom of the
stack. The error codes from this function are only used in kernel, this
particular code is chosen as we are indicating that we know there is no
frame there.

Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
---

Resending this separately from the wider series it was originally sent
in as it came up in discussion of Madhavan's series earlier today - we
could probably just apply this as is since it seems like we'll want it
regardless of how reliable stacktrace ends up being implemented.

 arch/arm64/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 0fb42129b469..ad20981dfda4 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -46,7 +46,7 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
 
 	/* Terminal record; nothing to unwind */
 	if (!fp)
-		return -EINVAL;
+		return -ENOENT;
 
 	if (fp & 0xf)
 		return -EINVAL;
-- 
2.20.1


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

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

* Re: [PATCH RESEND] arm64: stacktrace: Report when we reach the end of the stack
  2021-02-24 16:50 [PATCH RESEND] arm64: stacktrace: Report when we reach the end of the stack Mark Brown
@ 2021-02-25 11:02 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2021-02-25 11:02 UTC (permalink / raw)
  To: Madhavan T . Venkataraman, Mark Brown, Catalin Marinas
  Cc: Mark Rutland, Will Deacon, kernel-team, linux-arm-kernel

On Wed, 24 Feb 2021 16:50:37 +0000, Mark Brown wrote:
> Currently the arm64 unwinder code returns -EINVAL whenever it can't find
> the next stack frame, not distinguishing between cases where the stack has
> been corrupted or is otherwise in a state it shouldn't be and cases
> where we have reached the end of the stack. At the minute none of the
> callers care what error code is returned but this will be important for
> reliable stack trace which needs to be sure that the stack is intact.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: stacktrace: Report when we reach the end of the stack
      https://git.kernel.org/arm64/c/3c02600144bd

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2021-02-25 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 16:50 [PATCH RESEND] arm64: stacktrace: Report when we reach the end of the stack Mark Brown
2021-02-25 11:02 ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.