Re: [PATCH] MIPS: Add basic support for ptrace single step

From: kernel test robot
Date: Tue Feb 09 2021 - 09:55:06 EST


Hi Tiezhu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.11-rc6 next-20210125]
[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]

url: https://github.com/0day-ci/linux/commits/Tiezhu-Yang/MIPS-Add-basic-support-for-ptrace-single-step/20210209-083755
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 61556703b610a104de324e4f061dc6cf7b218b46
config: mips-randconfig-r036-20210209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/67449dfde58fecf3a9e68bec9de5211788fbe22a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tiezhu-Yang/MIPS-Add-basic-support-for-ptrace-single-step/20210209-083755
git checkout 67449dfde58fecf3a9e68bec9de5211788fbe22a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> arch/mips/kernel/ptrace.c:1127:25: warning: variable 'mips_insn' is uninitialized when used here [-Wuninitialized]
if (insn_has_delayslot(mips_insn)) {
^~~~~~~~~
arch/mips/kernel/ptrace.c:1114:2: note: variable 'mips_insn' is declared here
union mips_instruction mips_insn;
^
1 warning generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SSB_EMBEDDED
Depends on SSB && SSB_DRIVER_MIPS && SSB_PCICORE_HOSTMODE
Selected by
- BCM47XX_SSB && BCM47XX


vim +/mips_insn +1127 arch/mips/kernel/ptrace.c

1111
1112 static void ptrace_set_bpt(struct task_struct *child)
1113 {
1114 union mips_instruction mips_insn;
1115 struct pt_regs *regs;
1116 unsigned long pc;
1117 unsigned int insn;
1118 int i, ret, nsaved = 0;
1119
1120 regs = task_pt_regs(child);
1121 pc = regs->cp0_epc;
1122
1123 ret = read_insn(child, pc, &insn);
1124 if (ret < 0)
1125 return;
1126
> 1127 if (insn_has_delayslot(mips_insn)) {
1128 pr_info("executing branch insn\n");
1129 ret = __compute_return_epc(regs);
1130 if (ret < 0)
1131 return;
1132 task_thread_info(child)->bpt_addr[nsaved++] = regs->cp0_epc;
1133 } else {
1134 pr_info("executing normal insn\n");
1135 task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
1136 }
1137
1138 /* install breakpoints */
1139 for (i = 0; i < nsaved; i++) {
1140 ret = read_insn(child, task_thread_info(child)->bpt_addr[i], &insn);
1141 if (ret < 0)
1142 return;
1143
1144 task_thread_info(child)->bpt_insn[i] = insn;
1145
1146 ret = write_insn(child, task_thread_info(child)->bpt_addr[i], BREAKINST);
1147 if (ret < 0)
1148 return;
1149 }
1150
1151 task_thread_info(child)->bpt_nsaved = nsaved;
1152 }
1153

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip