linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call
@ 2018-11-10  3:20 Elvira Khabirova
  2018-11-10 12:06 ` kbuild test robot
  2018-11-10 13:49 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Elvira Khabirova @ 2018-11-10  3:20 UTC (permalink / raw)
  To: benh, paulus, mpe; +Cc: linuxppc-dev, linux-kernel, leitao, oleg, luto, ldv

Arch code should use tracehook_*() helpers, as documented
in include/linux/tracehook.h.

Signed-off-by: Elvira Khabirova <lineprinter@altlinux.org>
---
 arch/powerpc/kernel/ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index afb819f4ca68..f73f8ea402e9 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -3266,7 +3266,7 @@ long do_syscall_trace_enter(struct pt_regs *regs)
 	user_exit();
 
 	if (test_thread_flag(TIF_SYSCALL_EMU)) {
-		ptrace_report_syscall(regs);
+		tracehook_report_syscall_entry(regs);
 		/*
 		 * Returning -1 will skip the syscall execution. We want to
 		 * avoid clobbering any register also, thus, not 'gotoing'
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call
  2018-11-10  3:20 [PATCH] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call Elvira Khabirova
@ 2018-11-10 12:06 ` kbuild test robot
  2018-11-10 13:49 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-11-10 12:06 UTC (permalink / raw)
  To: Elvira Khabirova
  Cc: kbuild-all, benh, paulus, mpe, linuxppc-dev, linux-kernel,
	leitao, oleg, luto, ldv

[-- Attachment #1: Type: text/plain, Size: 3528 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59489 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call
  2018-11-10  3:20 [PATCH] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call Elvira Khabirova
  2018-11-10 12:06 ` kbuild test robot
@ 2018-11-10 13:49 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-11-10 13:49 UTC (permalink / raw)
  To: Elvira Khabirova
  Cc: kbuild-all, benh, paulus, mpe, linuxppc-dev, linux-kernel,
	leitao, oleg, luto, ldv

[-- Attachment #1: Type: text/plain, Size: 3564 bytes --]

Hi Elvira,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR 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-defconfig (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 errors (new ones prefixed by >>):

   arch/powerpc/kernel/ptrace.c: In function 'do_syscall_trace_enter':
>> arch/powerpc/kernel/ptrace.c:3269:3: error: ignoring return value of 'tracehook_report_syscall_entry', declared with attribute warn_unused_result [-Werror=unused-result]
      tracehook_report_syscall_entry(regs);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24071 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-10 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-10  3:20 [PATCH] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call Elvira Khabirova
2018-11-10 12:06 ` kbuild test robot
2018-11-10 13:49 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).