[PATCH for-mm 3/3] arch/arm64: Set HAVE_SHADOW_STACKTRACE depends on SHADOW_CALL_STACK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The arm64 implementation of arch_stack_walk_shadow(), which is
introduced by commit 8cdc580c5ca2 ("arm64: implement
stack_trace_save_shadow") of -mm, uses task_scs(), which depends on
SHADOW_CALL_STACK, but arm64 Kconfig unconditionally sets
HAVE_SHADOW_STACKTRACE.  As a result, below build error happens when
SHADOW_CALL_STACK is unset.

    /linux/arch/arm64/kernel/stacktrace.c: In function 'arch_stack_walk_shadow':
    /linux/arch/arm64/kernel/stacktrace.c:289:13: error: implicit declaration of function 'task_scs'; did you mean 'task_lock'? [-Werror=implicit-function-declaration]
      289 |  scs_base = task_scs(current);
          |             ^~~~~~~~
          |             task_lock

This commit fixes the error by making HAVE_SHADOW_STACKTRACE depends on
SHADOW_CALL_STACK and impelmentation of arch_stack_walk_shadow() depends
on HAVE_SHADOW_STACKTRACE.

Fixes: 8cdc580c5ca2 ("arm64: implement stack_trace_save_shadow") of -mm
Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
---
 arch/arm64/Kconfig             | 2 +-
 arch/arm64/kernel/stacktrace.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d9325dd95eba..67358860d51e 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -201,7 +201,7 @@ config ARM64
 	select HAVE_FUNCTION_ARG_ACCESS_API
 	select MMU_GATHER_RCU_TABLE_FREE
 	select HAVE_RSEQ
-	select HAVE_SHADOW_STACKTRACE
+	select HAVE_SHADOW_STACKTRACE if CONFIG_SHADOW_CALL_STACK
 	select HAVE_STACKPROTECTOR
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_KPROBES
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 89daa710d91b..7e824aeb06f9 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -213,6 +213,8 @@ noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry,
 	walk_stackframe(task, &frame, consume_entry, cookie);
 }
 
+#ifdef CONFIG_HAVE_SHADOW_STACKTRACE
+
 static const struct {
 	unsigned long ** __percpu saved;
 	unsigned long ** __percpu base;
@@ -293,3 +295,5 @@ noinline notrace int arch_stack_walk_shadow(unsigned long *store,
 	preempt_enable();
 	return len;
 }
+
+#endif /* CONFIG_HAVE_SHADOW_STACKTRACE */
-- 
2.17.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux