[PATCH] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call

kbuild test robot lkp at intel.com
Sat Nov 10 23:06:01 AEDT 2018


Hi Elvira,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v4.20-rc1 next-20181109]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Elvira-Khabirova/powerpc-ptrace-replace-ptrace_report_syscall-with-a-tracehook-call/20181110-192337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

   arch/powerpc/kernel/ptrace.c: In function 'do_syscall_trace_enter':
>> arch/powerpc/kernel/ptrace.c:3269:3: warning: ignoring return value of 'tracehook_report_syscall_entry', declared with attribute warn_unused_result [-Wunused-result]
      tracehook_report_syscall_entry(regs);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/tracehook_report_syscall_entry +3269 arch/powerpc/kernel/ptrace.c

  3244	
  3245	/**
  3246	 * do_syscall_trace_enter() - Do syscall tracing on kernel entry.
  3247	 * @regs: the pt_regs of the task to trace (current)
  3248	 *
  3249	 * Performs various types of tracing on syscall entry. This includes seccomp,
  3250	 * ptrace, syscall tracepoints and audit.
  3251	 *
  3252	 * The pt_regs are potentially visible to userspace via ptrace, so their
  3253	 * contents is ABI.
  3254	 *
  3255	 * One or more of the tracers may modify the contents of pt_regs, in particular
  3256	 * to modify arguments or even the syscall number itself.
  3257	 *
  3258	 * It's also possible that a tracer can choose to reject the system call. In
  3259	 * that case this function will return an illegal syscall number, and will put
  3260	 * an appropriate return value in regs->r3.
  3261	 *
  3262	 * Return: the (possibly changed) syscall number.
  3263	 */
  3264	long do_syscall_trace_enter(struct pt_regs *regs)
  3265	{
  3266		user_exit();
  3267	
  3268		if (test_thread_flag(TIF_SYSCALL_EMU)) {
> 3269			tracehook_report_syscall_entry(regs);
  3270			/*
  3271			 * Returning -1 will skip the syscall execution. We want to
  3272			 * avoid clobbering any register also, thus, not 'gotoing'
  3273			 * skip label.
  3274			 */
  3275			return -1;
  3276		}
  3277	
  3278		/*
  3279		 * The tracer may decide to abort the syscall, if so tracehook
  3280		 * will return !0. Note that the tracer may also just change
  3281		 * regs->gpr[0] to an invalid syscall number, that is handled
  3282		 * below on the exit path.
  3283		 */
  3284		if (test_thread_flag(TIF_SYSCALL_TRACE) &&
  3285		    tracehook_report_syscall_entry(regs))
  3286			goto skip;
  3287	
  3288		/* Run seccomp after ptrace; allow it to set gpr[3]. */
  3289		if (do_seccomp(regs))
  3290			return -1;
  3291	
  3292		/* Avoid trace and audit when syscall is invalid. */
  3293		if (regs->gpr[0] >= NR_syscalls)
  3294			goto skip;
  3295	
  3296		if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
  3297			trace_sys_enter(regs, regs->gpr[0]);
  3298	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 59489 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20181110/8ca017ed/attachment-0001.gz>


More information about the Linuxppc-dev mailing list