Subject: linux-next: manual merge of the arm64 tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 4 Nov 2021 09:32:08 +1100

Hi all,

Today's linux-next merge of the arm64 tree got conflicts in:

  arch/arm64/include/asm/stacktrace.h
  arch/arm64/kernel/stacktrace.c

between commit:

  cd9bc2c92588 ("arm64: Recover kretprobe modified return address in stacktrace")

from Linus' tree and commit:

  552e196d88e5 ("arm64: ftrace: use HAVE_FUNCTION_GRAPH_RET_ADDR_PTR")

from the arm64 tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/arm64/include/asm/stacktrace.h
index a4e046ef4568,9a319eca5cab..000000000000
--- a/arch/arm64/include/asm/stacktrace.h
+++ b/arch/arm64/include/asm/stacktrace.h
@@@ -57,12 -53,6 +54,9 @@@ struct stackframe 
  	DECLARE_BITMAP(stacks_done, __NR_STACK_TYPES);
  	unsigned long prev_fp;
  	enum stack_type prev_type;
- #ifdef CONFIG_FUNCTION_GRAPH_TRACER
- 	int graph;
- #endif
 +#ifdef CONFIG_KRETPROBES
 +	struct llist_node *kr_cur;
 +#endif
  };
  
  extern int unwind_frame(struct task_struct *tsk, struct stackframe *frame);
diff --cc arch/arm64/kernel/stacktrace.c
index c30624fff6ac,13ea4e4a4d27..000000000000
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@@ -38,12 -38,6 +38,9 @@@ void start_backtrace(struct stackframe 
  {
  	frame->fp = fp;
  	frame->pc = pc;
- #ifdef CONFIG_FUNCTION_GRAPH_TRACER
- 	frame->graph = 0;
- #endif
 +#ifdef CONFIG_KRETPROBES
 +	frame->kr_cur = NULL;
 +#endif
  
  	/*
  	 * Prime the first unwind.
@@@ -126,19 -122,14 +125,18 @@@ int notrace unwind_frame(struct task_st
  		 * to hook a function return.
  		 * So replace it to an original value.
  		 */
- 		ret_stack = ftrace_graph_get_ret_stack(tsk, frame->graph++);
- 		if (WARN_ON_ONCE(!ret_stack))
+ 		orig_pc = ftrace_graph_ret_addr(tsk, NULL, frame->pc,
+ 						(void *)frame->fp);
+ 		if (WARN_ON_ONCE(frame->pc == orig_pc))
  			return -EINVAL;
- 		frame->pc = ret_stack->ret;
+ 		frame->pc = orig_pc;
  	}
  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 +#ifdef CONFIG_KRETPROBES
 +	if (is_kretprobe_trampoline(frame->pc))
 +		frame->pc = kretprobe_find_ret_addr(tsk, (void *)frame->fp, &frame->kr_cur);
 +#endif
  
- 	frame->pc = ptrauth_strip_insn_pac(frame->pc);
- 
  	return 0;
  }
  NOKPROBE_SYMBOL(unwind_frame);