lkml.org 
[lkml]   [2017]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 25/26] signal: In ptrace_stop use CLD_TRAPPED in all ptrace signals
If the only job of the signal is to report a ptrace level event set
si_code to CLD_TRAPPED instead of possibly CLD_STOPPED.

This causes the siginfo of the signals that are sent to match the
signinfo of the signals returned by waitid.

This is a user visible difference but I don't expect anything will
care.

In fact this is a return to historical linux behavior. In linux 2.4.0
all ptrace stops were reported through do_notify_parent with
CLD_TRAPPED. When do_notify_parent_cldstop was added the CLD_TRAPPED
logic was not included and CLD_TRAPPED for ptrace stops was lost. As
nothing was said about this case I assume it was an oversight.

When waitid was added a little earlier all stops were being
reported with do_notify_parent and all ptrace stops were setting
CLD_TRAPPED. So initially signals and waitid were in sync with
respect to setting CLD_TRAPPED.

It is also worth knowing that posix uses documents CLD_TRAPPED
as "Traced child has trapped."

History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
Ref: ca3f74aa7baa ("[PATCH] waitid system call")
Fixes: Fixes: ebf5ebe31d2c ("[PATCH] signal-fixes-2.5.59-A4")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
kernel/signal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index ff41e6ee2b5e..0d4ca87f1fee 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1886,9 +1886,9 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
* separately unless they are going to be identical.
*/
if (!identical)
- do_notify_parent_cldstop(current, true, why);
+ do_notify_parent_cldstop(current, true, CLD_TRAPPED);
if (gstop_done)
- do_notify_parent_cldstop(current, false, why);
+ do_notify_parent_cldstop(current, false, CLD_STOPPED);

/*
* Don't want to allow preemption here, because
@@ -1912,7 +1912,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
* the real parent of the group stop completion is enough.
*/
if (gstop_done)
- do_notify_parent_cldstop(current, false, why);
+ do_notify_parent_cldstop(current, false, CLD_STOPPED);

/* tasklist protects us from ptrace_freeze_traced() */
__set_current_state(TASK_RUNNING);
--
2.10.1
\
 
 \ /
  Last update: 2017-06-12 00:53    [W:0.228 / U:17.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site