Re: [PATCH] arm64: Add user stacktrace support

From: kernel test robot
Date: Sat Nov 18 2023 - 15:41:45 EST


Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on linus/master v6.7-rc1 next-20231117]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/qiwuchen55-gmail-com/arm64-Add-user-stacktrace-support/20231118-214756
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
patch link: https://lore.kernel.org/r/20231118134504.154842-1-qiwu.chen%40transsion.com
patch subject: [PATCH] arm64: Add user stacktrace support
config: arm64-randconfig-r071-20231119 (https://download.01.org/0day-ci/archive/20231119/202311190405.QUvoF0b3-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311190405.QUvoF0b3-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311190405.QUvoF0b3-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> arch/arm64/kernel/stacktrace.c:393: warning: expecting prototype for stack_trace_save_user(). Prototype was for arch_stack_walk_user() instead


vim +393 arch/arm64/kernel/stacktrace.c

384
385 /**
386 * stack_trace_save_user - Save user space stack traces into a storage array
387 * @consume_entry: Callback for save a user space stack trace
388 * @cookie: Caller supplied pointer handed back by arch_stack_walk()
389 * @regs: The pt_regs pointer of current task
390 */
391 void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
392 const struct pt_regs *regs)
> 393 {
394 struct stack_frame_user frame;
395 struct vm_area_struct *vma;
396 unsigned long userstack_start, userstack_end;
397 struct task_struct *tsk = current;
398
399 /* TODO: support stack unwind for compat user mode */
400 if (!regs || !user_mode(regs) || compat_user_mode(regs))
401 return;
402
403 userstack_start = regs->user_regs.sp;
404 vma = find_user_stack_vma(tsk, userstack_start);
405 if (!vma)
406 return;
407
408 userstack_end = vma->vm_end;
409 frame.fp = regs->user_regs.regs[29];
410 frame.sp = userstack_start;
411 frame.pc = regs->user_regs.pc;
412
413 while (1) {
414 unsigned long where = frame.pc;
415
416 /* Sanity check: ABI requires pc to be aligned 4 bytes. */
417 if (!where || where & 0x3)
418 break;
419 if (!consume_entry(cookie, where))
420 break;
421 if (arch_unwind_user_frame(tsk, userstack_end, &frame) < 0)
422 break;
423 }
424 }
425

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki