[PATCH 6.12 169/242] Revert "LoongArch: Remove unnecessary checks for ORC unwinder"

Greg Kroah-Hartman
2026-04-08T18:46:39Z

This reverts commit 5d8e3b81aee2c18610c5f440936f0bf3b6426e56.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/loongarch/kernel/unwind_orc.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/loongarch/kernel/unwind_orc.c b/arch/loongarch/kernel/unwind_orc.c
index 4924d1ecc4579..59809c3406c03 100644
--- a/arch/loongarch/kernel/unwind_orc.c
+++ b/arch/loongarch/kernel/unwind_orc.c
@@ -359,6 +359,12 @@ static inline unsigned long bt_address(unsigned long ra)
{
extern unsigned long eentry;

+ if (__kernel_text_address(ra))
+ return ra;
+
+ if (__module_text_address(ra))
+ return ra;
+
if (ra >= eentry && ra < eentry + EXCCODE_INT_END * VECSIZE) {
unsigned long func;
unsigned long type = (ra - eentry) / VECSIZE;
@@ -376,13 +382,10 @@ static inline unsigned long bt_address(unsigned long ra)
break;
}

- ra = func + offset;
+ return func + offset;
}

- if (__kernel_text_address(ra))
- return ra;
-
- return 0;
+ return ra;
}

bool unwind_next_frame(struct unwind_state *state)
@@ -508,6 +511,9 @@ bool unwind_next_frame(struct unwind_state *state)
goto err;
}

+ if (!__kernel_text_address(state->pc))
+ goto err;
+
return true;

err:
--
2.53.0