linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: akpm@linux-foundation.org
Cc: andreyknvl@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, SeongJae Park <sj@kernel.org>
Subject: [PATCH for-mm 3/3] arch/arm64: Set HAVE_SHADOW_STACKTRACE depends on SHADOW_CALL_STACK
Date: Thu, 31 Mar 2022 08:49:39 +0000	[thread overview]
Message-ID: <20220331084939.26749-4-sj@kernel.org> (raw)
In-Reply-To: <20220331084939.26749-1-sj@kernel.org>

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@kernel.org>
---
 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



      parent reply	other threads:[~2022-03-31  8:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31  8:49 [PATCH for-mm 0/3] Trivial fixes for build failures SeongJae Park
2022-03-31  8:49 ` [PATCH for-mm 1/3] arch/arm64/Kconfig: Fix a typo SeongJae Park
2022-03-31  8:49 ` [PATCH for-mm 2/3] arch/arm64/kernel/irq: Include missed header file SeongJae Park
2022-03-31  8:49 ` SeongJae Park [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220331084939.26749-4-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox