[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210315165800.5948-7-madvenka@linux.microsoft.com>
Date: Mon, 15 Mar 2021 11:57:58 -0500
From: madvenka@...ux.microsoft.com
To: broonie@...nel.org, mark.rutland@....com, jpoimboe@...hat.com,
jthierry@...hat.com, catalin.marinas@....com, will@...nel.org,
linux-arm-kernel@...ts.infradead.org,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
madvenka@...ux.microsoft.com
Subject: [RFC PATCH v2 6/8] arm64: Check the return PC of every stack frame
From: "Madhavan T. Venkataraman" <madvenka@...ux.microsoft.com>
If a function encountered in a stack trace is not a valid kernel text
address, the stack trace is considered unreliable. Mark the stack trace
as not reliable.
Signed-off-by: Madhavan T. Venkataraman <madvenka@...ux.microsoft.com>
---
arch/arm64/kernel/stacktrace.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 594806a0c225..358aae3906d7 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -101,6 +101,16 @@ static void check_if_reliable(unsigned long fp, struct stackframe *frame,
}
}
#endif
+
+ /*
+ * A NULL or invalid return address probably means there's some
+ * generated code which __kernel_text_address() doesn't know about.
+ * Mark the stack trace as not reliable.
+ */
+ if (!__kernel_text_address(frame->pc)) {
+ frame->reliable = false;
+ return;
+ }
}
/*
--
2.25.1
Powered by blists - more mailing lists