[kernel] Re-apply the rebased utrace

Dave Jones davej at fedoraproject.org
Wed Aug 3 20:05:52 UTC 2011


commit 1aa2339b01b1e13a2a4f660e54656ab0df1ecfb5
Author: Dave Jones <davej at redhat.com>
Date:   Wed Aug 3 16:05:34 2011 -0400

    Re-apply the rebased utrace

 kernel.spec  |    5 +-
 utrace.patch | 2998 +++++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 2049 insertions(+), 954 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index cfff033..2c4ad79 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -1271,7 +1271,7 @@ ApplyPatch ums-realtek-driver-uses-stack-memory-for-DMA.patch
 ApplyPatch dmar-disable-when-ricoh-multifunction.patch
 
 # utrace.
-#ApplyPatch utrace.patch
+ApplyPatch utrace.patch
 
 # END OF PATCH APPLICATIONS
 
@@ -1891,6 +1891,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Wed Aug 03 2011 Dave Jones <davej at redhat.com>
+- Re-apply the rebased utrace
+
 * Wed Aug 03 2011 John W. Linville <linville at redhat.com>
 - Disable CONFIG_BCMA since no driver currently uses it (rhbz 727796)
 
diff --git a/utrace.patch b/utrace.patch
index 55d0b3c..2578b7c 100644
--- a/utrace.patch
+++ b/utrace.patch
@@ -1,41 +1,42 @@
-From davej  Thu Jun 30 20:27:03 2011
+From davej  Wed Aug  3 15:16:11 2011
 Return-Path: oleg at redhat.com
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:03 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:00 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:11 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:15:37 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 10DAED812A;
-	Thu, 30 Jun 2011 20:23:00 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id fiwBBweCuo8A; Thu, 30 Jun 2011 20:22:59 -0400 (EDT)
-Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id E7CA2D810F;
-	Thu, 30 Jun 2011 20:22:59 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 92D6F9D8C5;
+	Wed,  3 Aug 2011 15:12:08 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id RRq2PiCBdMzK; Wed,  3 Aug 2011 15:12:08 -0400 (EDT)
+Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 75C149D898;
+	Wed,  3 Aug 2011 15:12:08 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610MpCP015143;
-	Thu, 30 Jun 2011 20:22:52 -0400
+	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JC01d029136;
+	Wed, 3 Aug 2011 15:12:01 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:20:59 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:20:57 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:28 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:26 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 01/19] utrace core
-Message-ID: <20110701002057.GA25776 at redhat.com>
+Subject: [PATCH 01/31] utrace core
+Message-ID: <20110803190926.GA30903 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
 Status: RO
-Content-Length: 148213
-Lines: 4119
+Content-Length: 139951
+Lines: 3867
 
 From: Roland McGrath <roland at redhat.com>
 
@@ -58,11 +59,11 @@ the next patches try to fix this.
 
 This is is same/old utrace-core patch except:
 
-	- use group_stop/GROUP_STOP_DEQUEUED instead of removed
+	- use task->jobctl/JOBCTL_STOP_DEQUEUED instead of removed
 	  signal->flags/SIGNAL_STOP_DEQUEUED in utrace_get_signal()
 
-	- rediff the changes in tracehook.h against the current code
-	  without PT_PTRACED tweaks which were needed for ptrace-utrace
+	- do not include the tracehook changes, this comes with the
+	  next patches
 
 Signed-off-by: Roland McGrath <roland at redhat.com>
 Signed-off-by: Oleg Nesterov <oleg at redhat.com>
@@ -71,30 +72,28 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  Documentation/DocBook/utrace.tmpl |  589 +++++++++
  fs/proc/array.c                   |    3 +
  include/linux/sched.h             |    5 +
- include/linux/tracehook.h         |   85 ++-
  include/linux/utrace.h            |  692 +++++++++++
  init/Kconfig                      |    9 +
  kernel/Makefile                   |    1 +
- kernel/fork.c                     |    3 +
  kernel/utrace.c                   | 2440 +++++++++++++++++++++++++++++++++++++
- 10 files changed, 3827 insertions(+), 2 deletions(-)
+ 8 files changed, 3740 insertions(+), 1 deletions(-)
  create mode 100644 Documentation/DocBook/utrace.tmpl
  create mode 100644 include/linux/utrace.h
  create mode 100644 kernel/utrace.c
 
 diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
-index 3cebfa0..86c288b 100644
+index 66725a3..08ed954 100644
 --- a/Documentation/DocBook/Makefile
 +++ b/Documentation/DocBook/Makefile
 @@ -14,7 +14,7 @@ DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \
  	    genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
  	    80211.xml debugobjects.xml sh.xml regulator.xml \
  	    alsa-driver-api.xml writing-an-alsa-driver.xml \
--	    tracepoint.xml media.xml drm.xml
-+	    tracepoint.xml utrace.xml media.xml drm.xml
+-	    tracepoint.xml drm.xml media_api.xml
++	    tracepoint.xml utrace.xml drm.xml media_api.xml
+ 
+ include $(srctree)/Documentation/DocBook/media/Makefile
  
- ###
- # The build process is as follows (targets):
 diff --git a/Documentation/DocBook/utrace.tmpl b/Documentation/DocBook/utrace.tmpl
 new file mode 100644
 index 0000000..0c40add
@@ -691,7 +690,7 @@ index 0000000..0c40add
 +
 +</book>
 diff --git a/fs/proc/array.c b/fs/proc/array.c
-index 9b45ee8..496fef3 100644
+index 3a1dafd..f0c0ea2 100644
 --- a/fs/proc/array.c
 +++ b/fs/proc/array.c
 @@ -81,6 +81,7 @@
@@ -712,10 +711,10 @@ index 9b45ee8..496fef3 100644
  	if (p->files)
  		fdt = files_fdtable(p->files);
 diff --git a/include/linux/sched.h b/include/linux/sched.h
-index a837b20..b87de83 100644
+index 20b03bf..c6d79af 100644
 --- a/include/linux/sched.h
 +++ b/include/linux/sched.h
-@@ -1397,6 +1397,11 @@ struct task_struct {
+@@ -1406,6 +1406,11 @@ struct task_struct {
  #endif
  	seccomp_t seccomp;
  
@@ -727,235 +726,6 @@ index a837b20..b87de83 100644
  /* Thread group tracking */
     	u32 parent_exec_id;
     	u32 self_exec_id;
-diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
-index e95f523..7d7bdde 100644
---- a/include/linux/tracehook.h
-+++ b/include/linux/tracehook.h
-@@ -49,6 +49,7 @@
- #include <linux/sched.h>
- #include <linux/ptrace.h>
- #include <linux/security.h>
-+#include <linux/utrace.h>
- struct linux_binprm;
- 
- /**
-@@ -63,6 +64,8 @@ struct linux_binprm;
-  */
- static inline int tracehook_expect_breakpoints(struct task_struct *task)
- {
-+	if (unlikely(task_utrace_flags(task) & UTRACE_EVENT(SIGNAL_CORE)))
-+		return 1;
- 	return (task_ptrace(task) & PT_PTRACED) != 0;
- }
- 
-@@ -111,6 +114,9 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
- static inline __must_check int tracehook_report_syscall_entry(
- 	struct pt_regs *regs)
- {
-+	if ((task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_ENTRY)) &&
-+	    utrace_report_syscall_entry(regs))
-+		return 1;
- 	ptrace_report_syscall(regs);
- 	return 0;
- }
-@@ -134,6 +140,9 @@ static inline __must_check int tracehook_report_syscall_entry(
-  */
- static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
- {
-+	if (task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_EXIT))
-+		utrace_report_syscall_exit(regs);
-+
- 	if (step) {
- 		siginfo_t info;
- 		user_single_step_siginfo(current, regs, &info);
-@@ -201,6 +210,8 @@ static inline void tracehook_report_exec(struct linux_binfmt *fmt,
- 					 struct linux_binprm *bprm,
- 					 struct pt_regs *regs)
- {
-+	if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(EXEC)))
-+		utrace_report_exec(fmt, bprm, regs);
- 	if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) &&
- 	    unlikely(task_ptrace(current) & PT_PTRACED))
- 		send_sig(SIGTRAP, current, 0);
-@@ -218,10 +229,37 @@ static inline void tracehook_report_exec(struct linux_binfmt *fmt,
-  */
- static inline void tracehook_report_exit(long *exit_code)
- {
-+	if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(EXIT)))
-+		utrace_report_exit(exit_code);
- 	ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code);
- }
- 
- /**
-+ * tracehook_init_task - task_struct has just been copied
-+ * @task:		new &struct task_struct just copied from parent
-+ *
-+ * Called from do_fork() when @task has just been duplicated.
-+ * After this, @task will be passed to tracehook_free_task()
-+ * even if the rest of its setup fails before it is fully created.
-+ */
-+static inline void tracehook_init_task(struct task_struct *task)
-+{
-+	utrace_init_task(task);
-+}
-+
-+/**
-+ * tracehook_free_task - task_struct is being freed
-+ * @task:		dead &struct task_struct being freed
-+ *
-+ * Called from free_task() when @task is no longer in use.
-+ */
-+static inline void tracehook_free_task(struct task_struct *task)
-+{
-+	if (task_utrace_struct(task))
-+		utrace_free_task(task);
-+}
-+
-+/**
-  * tracehook_prepare_clone - prepare for new child to be cloned
-  * @clone_flags:	%CLONE_* flags from clone/fork/vfork system call
-  *
-@@ -285,6 +323,8 @@ static inline void tracehook_report_clone(struct pt_regs *regs,
- 					  unsigned long clone_flags,
- 					  pid_t pid, struct task_struct *child)
- {
-+	if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(CLONE)))
-+		utrace_report_clone(clone_flags, child);
- 	if (unlikely(task_ptrace(child))) {
- 		/*
- 		 * It doesn't matter who attached/attaching to this
-@@ -317,6 +357,9 @@ static inline void tracehook_report_clone_complete(int trace,
- 						   pid_t pid,
- 						   struct task_struct *child)
- {
-+	if (unlikely(task_utrace_flags(current) & UTRACE_EVENT(CLONE)) &&
-+	    (clone_flags & CLONE_VFORK))
-+		utrace_finish_vfork(current);
- 	if (unlikely(trace))
- 		ptrace_event(0, trace, pid);
- }
-@@ -351,6 +394,10 @@ static inline void tracehook_report_vfork_done(struct task_struct *child,
-  */
- static inline void tracehook_prepare_release_task(struct task_struct *task)
- {
-+	/* see utrace_add_engine() about this barrier */
-+	smp_mb();
-+	if (task_utrace_flags(task))
-+		utrace_maybe_reap(task, task_utrace_struct(task), true);
- }
- 
- /**
-@@ -365,6 +412,7 @@ static inline void tracehook_prepare_release_task(struct task_struct *task)
- static inline void tracehook_finish_release_task(struct task_struct *task)
- {
- 	ptrace_release_task(task);
-+	BUG_ON(task->exit_state != EXIT_DEAD);
- }
- 
- /**
-@@ -386,6 +434,8 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
- 					    const struct k_sigaction *ka,
- 					    struct pt_regs *regs, int stepping)
- {
-+	if (task_utrace_flags(current))
-+		utrace_signal_handler(current, stepping);
- 	if (stepping)
- 		ptrace_notify(SIGTRAP);
- }
-@@ -403,6 +453,8 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
- static inline int tracehook_consider_ignored_signal(struct task_struct *task,
- 						    int sig)
- {
-+	if (unlikely(task_utrace_flags(task) & UTRACE_EVENT(SIGNAL_IGN)))
-+		return 1;
- 	return (task_ptrace(task) & PT_PTRACED) != 0;
- }
- 
-@@ -422,6 +474,9 @@ static inline int tracehook_consider_ignored_signal(struct task_struct *task,
- static inline int tracehook_consider_fatal_signal(struct task_struct *task,
- 						  int sig)
- {
-+	if (unlikely(task_utrace_flags(task) & (UTRACE_EVENT(SIGNAL_TERM) |
-+						UTRACE_EVENT(SIGNAL_CORE))))
-+		return 1;
- 	return (task_ptrace(task) & PT_PTRACED) != 0;
- }
- 
-@@ -436,6 +491,8 @@ static inline int tracehook_consider_fatal_signal(struct task_struct *task,
-  */
- static inline int tracehook_force_sigpending(void)
- {
-+	if (unlikely(task_utrace_flags(current)))
-+		return utrace_interrupt_pending();
- 	return 0;
- }
- 
-@@ -465,6 +522,8 @@ static inline int tracehook_get_signal(struct task_struct *task,
- 				       siginfo_t *info,
- 				       struct k_sigaction *return_ka)
- {
-+	if (unlikely(task_utrace_flags(task)))
-+		return utrace_get_signal(task, regs, info, return_ka);
- 	return 0;
- }
- 
-@@ -475,6 +534,8 @@ static inline int tracehook_get_signal(struct task_struct *task,
-  */
- static inline void tracehook_finish_jctl(void)
- {
-+	if (task_utrace_flags(current))
-+		utrace_finish_stop();
- }
- 
- #define DEATH_REAP			-1
-@@ -497,6 +558,8 @@ static inline void tracehook_finish_jctl(void)
- static inline int tracehook_notify_death(struct task_struct *task,
- 					 void **death_cookie, int group_dead)
- {
-+	*death_cookie = task_utrace_struct(task);
-+
- 	if (task_detached(task))
- 		return task->ptrace ? SIGCHLD : DEATH_REAP;
- 
-@@ -533,6 +596,15 @@ static inline void tracehook_report_death(struct task_struct *task,
- 					  int signal, void *death_cookie,
- 					  int group_dead)
- {
-+	/*
-+	 * If utrace_set_events() was just called to enable
-+	 * UTRACE_EVENT(DEATH), then we are obliged to call
-+	 * utrace_report_death() and not miss it.  utrace_set_events()
-+	 * checks @task->exit_state under tasklist_lock to synchronize
-+	 * with exit_notify(), the caller.
-+	 */
-+	if (task_utrace_flags(task) & _UTRACE_DEATH_EVENTS)
-+		utrace_report_death(task, death_cookie, group_dead, signal);
- }
- 
- #ifdef TIF_NOTIFY_RESUME
-@@ -562,10 +634,21 @@ static inline void set_notify_resume(struct task_struct *task)
-  * asynchronously, this will be called again before we return to
-  * user mode.
-  *
-- * Called without locks.
-+ * Called without locks.  However, on some machines this may be
-+ * called with interrupts disabled.
-  */
- static inline void tracehook_notify_resume(struct pt_regs *regs)
- {
-+	struct task_struct *task = current;
-+	/*
-+	 * Prevent the following store/load from getting ahead of the
-+	 * caller which clears TIF_NOTIFY_RESUME. This pairs with the
-+	 * implicit mb() before setting TIF_NOTIFY_RESUME in
-+	 * set_notify_resume().
-+	 */
-+	smp_mb();
-+	if (task_utrace_flags(task))
-+		utrace_resume(task, regs);
- }
- #endif	/* TIF_NOTIFY_RESUME */
- 
 diff --git a/include/linux/utrace.h b/include/linux/utrace.h
 new file mode 100644
 index 0000000..f251efe
@@ -1655,7 +1425,7 @@ index 0000000..f251efe
 +
 +#endif	/* linux/utrace.h */
 diff --git a/init/Kconfig b/init/Kconfig
-index 412c21b..a03ae51 100644
+index d627783..7afce1f 100644
 --- a/init/Kconfig
 +++ b/init/Kconfig
 @@ -372,6 +372,15 @@ config AUDIT_TREE
@@ -1675,7 +1445,7 @@ index 412c21b..a03ae51 100644
  
  menu "RCU Subsystem"
 diff --git a/kernel/Makefile b/kernel/Makefile
-index 2d64cfc..4a22e81 100644
+index d06467f..85828da 100644
 --- a/kernel/Makefile
 +++ b/kernel/Makefile
 @@ -68,6 +68,7 @@ obj-$(CONFIG_IKCONFIG) += configs.o
@@ -1686,30 +1456,9 @@ index 2d64cfc..4a22e81 100644
  obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
  obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
  obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o
-diff --git a/kernel/fork.c b/kernel/fork.c
-index 0276c30..62caf3d 100644
---- a/kernel/fork.c
-+++ b/kernel/fork.c
-@@ -168,6 +168,7 @@ void free_task(struct task_struct *tsk)
- 	free_thread_info(tsk->stack);
- 	rt_mutex_debug_task_free(tsk);
- 	ftrace_graph_exit_task(tsk);
-+	tracehook_free_task(tsk);
- 	free_task_struct(tsk);
- }
- EXPORT_SYMBOL(free_task);
-@@ -1095,6 +1096,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
- 	if (!p)
- 		goto fork_out;
- 
-+	tracehook_init_task(p);
-+
- 	ftrace_graph_init_task(p);
- 
- 	rt_mutex_init_task(p);
 diff --git a/kernel/utrace.c b/kernel/utrace.c
 new file mode 100644
-index 0000000..f332d65
+index 0000000..ef856c9
 --- /dev/null
 +++ b/kernel/utrace.c
 @@ -0,0 +1,2440 @@
@@ -3999,7 +3748,7 @@ index 0000000..f332d65
 +		spin_lock_irq(&task->sighand->siglock);
 +
 +	if (sig_kernel_stop(signr))
-+		task->group_stop |= GROUP_STOP_DEQUEUED;
++		task->jobctl |= JOBCTL_STOP_DEQUEUED;
 +
 +	return signr;
 +}
@@ -4157,152 +3906,939 @@ index 0000000..f332d65
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:04 2011
+From davej  Wed Aug  3 15:16:13 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:04 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:03 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:13 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:15:37 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 2259ED812A;
-	Thu, 30 Jun 2011 20:23:03 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id Ex9fFDzwy1Zb; Thu, 30 Jun 2011 20:23:03 -0400 (EDT)
-Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 0EF28D810F;
-	Thu, 30 Jun 2011 20:23:03 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 419B39D8CF;
+	Wed,  3 Aug 2011 15:12:11 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id AmaThyCcp1K4; Wed,  3 Aug 2011 15:12:11 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 2A0B29CE59;
+	Wed,  3 Aug 2011 15:12:11 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p610Mt6X021086;
-	Thu, 30 Jun 2011 20:22:56 -0400
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JC3DW023262;
+	Wed, 3 Aug 2011 15:12:04 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:03 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:01 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:31 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:29 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 02/19] utrace: remove jobctl bits
-Message-ID: <20110701002101.GA25779 at redhat.com>
+Subject: [PATCH 02/31] utrace: add utrace_init_task/utrace_free_task calls
+Message-ID: <20110803190929.GA30907 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
 Status: RO
-Content-Length: 1890
-Lines: 56
+Content-Length: 1295
+Lines: 47
 
-- change utrace_get_signal() to check GROUP_STOP_PENDING instead of
-  signal->group_stop_count. With the recent changes group_stop_count
-  doesn't necessarily mean this task should participate in group stop.
+Add the necessary copy_process()->utrace_init_task() and
+free_task()->utrace_free_task() calls.
 
-- remove the "participate in group stop" code from utrace_wakeup() and
-  utrace_stop(), this is no longer needed and wrong.
+Originally this was the part of "utrace core" patch, but since
+tracehooks are dying it doesn't make sense to reintroduce them.
+Instead, just call the utrace_ helpers directly. This is fine
+even without CONFIG_UTRACE, gcc is smart enough to optimize out
+the code in free_task().
 
 Signed-off-by: Oleg Nesterov <oleg at redhat.com>
 ---
- kernel/utrace.c |   16 ++--------------
- 1 files changed, 2 insertions(+), 14 deletions(-)
+ kernel/fork.c |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
 
-diff --git a/kernel/utrace.c b/kernel/utrace.c
-index f332d65..6e7fafb 100644
---- a/kernel/utrace.c
-+++ b/kernel/utrace.c
-@@ -648,11 +648,7 @@ static void utrace_wakeup(struct task_struct *target, struct utrace *utrace)
- {
- 	lockdep_assert_held(&utrace->lock);
- 	spin_lock_irq(&target->sighand->siglock);
--	if (target->signal->flags & SIGNAL_STOP_STOPPED ||
--	    target->signal->group_stop_count)
--		target->state = TASK_STOPPED;
--	else
--		wake_up_state(target, __TASK_TRACED);
-+	wake_up_state(target, __TASK_TRACED);
- 	spin_unlock_irq(&target->sighand->siglock);
- }
- 
-@@ -805,14 +801,6 @@ relock:
+diff --git a/kernel/fork.c b/kernel/fork.c
+index e7ceaca..a9891da 100644
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -66,6 +66,7 @@
+ #include <linux/user-return-notifier.h>
+ #include <linux/oom.h>
+ #include <linux/khugepaged.h>
++#include <linux/utrace.h>
  
- 	__set_current_state(TASK_TRACED);
+ #include <asm/pgtable.h>
+ #include <asm/pgalloc.h>
+@@ -167,6 +168,8 @@ void free_task(struct task_struct *tsk)
+ 	free_thread_info(tsk->stack);
+ 	rt_mutex_debug_task_free(tsk);
+ 	ftrace_graph_exit_task(tsk);
++	if (task_utrace_struct(tsk))
++		utrace_free_task(tsk);
+ 	free_task_struct(tsk);
+ }
+ EXPORT_SYMBOL(free_task);
+@@ -1096,6 +1099,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
+ 	if (!p)
+ 		goto fork_out;
  
--	/*
--	 * If there is a group stop in progress,
--	 * we must participate in the bookkeeping.
--	 */
--	if (unlikely(task->signal->group_stop_count) &&
--			!--task->signal->group_stop_count)
--		task->signal->flags = SIGNAL_STOP_STOPPED;
--
- 	spin_unlock_irq(&task->sighand->siglock);
- 	spin_unlock(&utrace->lock);
++	utrace_init_task(p);
++
+ 	ftrace_graph_init_task(p);
  
-@@ -2036,7 +2024,7 @@ int utrace_get_signal(struct task_struct *task, struct pt_regs *regs,
- 		ka = NULL;
- 		memset(return_ka, 0, sizeof *return_ka);
- 	} else if (!(task->utrace_flags & UTRACE_EVENT_SIGNAL_ALL) ||
--		   unlikely(task->signal->group_stop_count)) {
-+		   unlikely(task->group_stop & GROUP_STOP_PENDING)) {
- 		/*
- 		 * If no engine is interested in intercepting signals or
- 		 * we must stop, let the caller just dequeue them normally
+ 	rt_mutex_init_task(p);
 -- 
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:05 2011
+From davej  Wed Aug  3 15:16:18 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:05 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:06 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:18 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:07 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 6B38AD812A;
-	Thu, 30 Jun 2011 20:23:06 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id f4153Z6E7KGl; Thu, 30 Jun 2011 20:23:06 -0400 (EDT)
-Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 55D4AD810F;
-	Thu, 30 Jun 2011 20:23:06 -0400 (EDT)
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id F28379DE70;
+	Wed,  3 Aug 2011 15:12:13 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id p92IDp0LZ5jX; Wed,  3 Aug 2011 15:12:13 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id D4E339DE68;
+	Wed,  3 Aug 2011 15:12:13 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610Mwi2015168;
-	Thu, 30 Jun 2011 20:22:59 -0400
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JC6IA023283;
+	Wed, 3 Aug 2011 15:12:07 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:06 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:04 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:34 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:32 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 03/19] ptrace: take ->siglock around s/TRACED/RUNNING/
-Message-ID: <20110701002104.GA25787 at redhat.com>
+Subject: [PATCH 03/31] tracehooks: add utrace hooks
+Message-ID: <20110803190932.GA30915 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
 Status: RO
-Content-Length: 1624
-Lines: 56
+Content-Length: 2310
+Lines: 75
 
-change ptrace_resume() and ptrace_stop() to take ->siglock around changing
+Add the necessary utrace hooks in the tracehooks which were not
+removed yet.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ include/linux/tracehook.h |   22 +++++++++++++++++++++-
+ 1 files changed, 21 insertions(+), 1 deletions(-)
+
+diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
+index a71a292..8cc28bc 100644
+--- a/include/linux/tracehook.h
++++ b/include/linux/tracehook.h
+@@ -49,6 +49,7 @@
+ #include <linux/sched.h>
+ #include <linux/ptrace.h>
+ #include <linux/security.h>
++#include <linux/utrace.h>
+ struct linux_binprm;
+ 
+ /*
+@@ -96,6 +97,9 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
+ static inline __must_check int tracehook_report_syscall_entry(
+ 	struct pt_regs *regs)
+ {
++	if ((task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_ENTRY)) &&
++	    utrace_report_syscall_entry(regs))
++		return 1;
+ 	ptrace_report_syscall(regs);
+ 	return 0;
+ }
+@@ -119,6 +123,9 @@ static inline __must_check int tracehook_report_syscall_entry(
+  */
+ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
+ {
++	if (task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_EXIT))
++		utrace_report_syscall_exit(regs);
++
+ 	if (step) {
+ 		siginfo_t info;
+ 		user_single_step_siginfo(current, regs, &info);
+@@ -148,6 +155,8 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
+ 					    const struct k_sigaction *ka,
+ 					    struct pt_regs *regs, int stepping)
+ {
++	if (task_utrace_flags(current))
++		utrace_signal_handler(current, stepping);
+ 	if (stepping)
+ 		ptrace_notify(SIGTRAP);
+ }
+@@ -179,10 +188,21 @@ static inline void set_notify_resume(struct task_struct *task)
+  * asynchronously, this will be called again before we return to
+  * user mode.
+  *
+- * Called without locks.
++ * Called without locks.  However, on some machines this may be
++ * called with interrupts disabled.
+  */
+ static inline void tracehook_notify_resume(struct pt_regs *regs)
+ {
++	struct task_struct *task = current;
++	/*
++	 * Prevent the following store/load from getting ahead of the
++	 * caller which clears TIF_NOTIFY_RESUME. This pairs with the
++	 * implicit mb() before setting TIF_NOTIFY_RESUME in
++	 * set_notify_resume().
++	 */
++	smp_mb();
++	if (task_utrace_flags(task))
++		utrace_resume(task, regs);
+ }
+ #endif	/* TIF_NOTIFY_RESUME */
+ 
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:14 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:14 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:15:37 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 92FCA9D8FA;
+	Wed,  3 Aug 2011 15:12:16 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id lQaZCHUpw8DT; Wed,  3 Aug 2011 15:12:16 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7479B9D8C9;
+	Wed,  3 Aug 2011 15:12:16 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JC91G023308;
+	Wed, 3 Aug 2011 15:12:09 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:37 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:35 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 04/31] tracehooks: reintroduce
+	tracehook_consider_fatal_signal()
+Message-ID: <20110803190935.GA30918 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
+Status: RO
+Content-Length: 3257
+Lines: 90
+
+Add the killed tracehook_consider_fatal_signal() back. It has multiple
+callers and it is not easy add the necessary checks inline.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ arch/s390/kernel/traps.c  |    4 ++--
+ include/linux/tracehook.h |   22 ++++++++++++++++++++++
+ kernel/signal.c           |    4 ++--
+ 3 files changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
+index ffabcd9..1018ab6 100644
+--- a/arch/s390/kernel/traps.c
++++ b/arch/s390/kernel/traps.c
+@@ -329,7 +329,7 @@ void __kprobes do_per_trap(struct pt_regs *regs)
+ 
+ 	if (notify_die(DIE_SSTEP, "sstep", regs, 0, 0, SIGTRAP) == NOTIFY_STOP)
+ 		return;
+-	if (!current->ptrace)
++	if (!tracehook_consider_fatal_signal(current, SIGTRAP))
+ 		return;
+ 	info.si_signo = SIGTRAP;
+ 	info.si_errno = 0;
+@@ -428,7 +428,7 @@ static void __kprobes illegal_op(struct pt_regs *regs, long pgm_int_code,
+ 		if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
+ 			return;
+ 		if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
+-			if (current->ptrace) {
++			if (tracehook_consider_fatal_signal(current, SIGTRAP)) {
+ 				info.si_signo = SIGTRAP;
+ 				info.si_errno = 0;
+ 				info.si_code = TRAP_BRKPT;
+diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
+index 8cc28bc..ec2af67 100644
+--- a/include/linux/tracehook.h
++++ b/include/linux/tracehook.h
+@@ -161,6 +161,28 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
+ 		ptrace_notify(SIGTRAP);
+ }
+ 
++/**
++ * tracehook_consider_fatal_signal - suppress special handling of fatal signal
++ * @task:		task receiving the signal
++ * @sig:		signal number being sent
++ *
++ * Return nonzero to prevent special handling of this termination signal.
++ * Normally handler for signal is %SIG_DFL.  It can be %SIG_IGN if @sig is
++ * ignored, in which case force_sig() is about to reset it to %SIG_DFL.
++ * When this returns zero, this signal might cause a quick termination
++ * that does not give the debugger a chance to intercept the signal.
++ *
++ * Called with or without @task->sighand->siglock held.
++ */
++static inline int tracehook_consider_fatal_signal(struct task_struct *task,
++						  int sig)
++{
++	if (unlikely(task_utrace_flags(task) & (UTRACE_EVENT(SIGNAL_TERM) |
++						UTRACE_EVENT(SIGNAL_CORE))))
++		return 1;
++	return task->ptrace != 0;
++}
++
+ #ifdef TIF_NOTIFY_RESUME
+ /**
+  * set_notify_resume - cause tracehook_notify_resume() to be called
+diff --git a/kernel/signal.c b/kernel/signal.c
+index 291c970..d7ef0da 100644
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -494,7 +494,7 @@ int unhandled_signal(struct task_struct *tsk, int sig)
+ 	if (handler != SIG_IGN && handler != SIG_DFL)
+ 		return 0;
+ 	/* if ptraced, let the tracer determine */
+-	return !tsk->ptrace;
++	return !tracehook_consider_fatal_signal(tsk, sig);
+ }
+ 
+ /*
+@@ -982,7 +982,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
+ 	if (sig_fatal(p, sig) &&
+ 	    !(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) &&
+ 	    !sigismember(&t->real_blocked, sig) &&
+-	    (sig == SIGKILL || !t->ptrace)) {
++	    (sig == SIGKILL || !tracehook_consider_fatal_signal(t, sig))) {
+ 		/*
+ 		 * This signal will be fatal to the whole group.
+ 		 */
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:20 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:20 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:08 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 374FE9DE74;
+	Wed,  3 Aug 2011 15:12:19 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id Sun0Twp72xGV; Wed,  3 Aug 2011 15:12:19 -0400 (EDT)
+Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 223E39DD25;
+	Wed,  3 Aug 2011 15:12:19 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCBgK008326;
+	Wed, 3 Aug 2011 15:12:12 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:39 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:37 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 05/31] add utrace hooks into sig_ignored() and
+	recalc_sigpending()
+Message-ID: <20110803190937.GA30926 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+Status: RO
+Content-Length: 1508
+Lines: 51
+
+Add the necessary and somewhat "special" hooks into sig_ignored() and
+recalc_sigpending(). Basically this restores _force_sigpending() and
+_consider_ignored_signal() tracehook logic.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ include/linux/utrace.h |    2 ++
+ kernel/signal.c        |    7 ++++++-
+ 2 files changed, 8 insertions(+), 1 deletions(-)
+
+diff --git a/include/linux/utrace.h b/include/linux/utrace.h
+index f251efe..1b8da1c 100644
+--- a/include/linux/utrace.h
++++ b/include/linux/utrace.h
+@@ -107,6 +107,8 @@ bool utrace_report_syscall_entry(struct pt_regs *);
+ void utrace_report_syscall_exit(struct pt_regs *);
+ void utrace_signal_handler(struct task_struct *, int);
+ 
++#define UTRACE_FLAG(task, ev)	(task_utrace_flags(task) & UTRACE_EVENT(ev))
++
+ #ifndef CONFIG_UTRACE
+ 
+ /*
+diff --git a/kernel/signal.c b/kernel/signal.c
+index d7ef0da..0f9af0b 100644
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -87,7 +87,7 @@ static int sig_ignored(struct task_struct *t, int sig, int from_ancestor_ns)
+ 	/*
+ 	 * Tracers may want to know about even ignored signals.
+ 	 */
+-	return !t->ptrace;
++	return !t->ptrace && !UTRACE_FLAG(t, SIGNAL_IGN);
+ }
+ 
+ /*
+@@ -150,6 +150,11 @@ void recalc_sigpending_and_wake(struct task_struct *t)
+ 
+ void recalc_sigpending(void)
+ {
++	if (task_utrace_flags(current) && utrace_interrupt_pending()) {
++		set_thread_flag(TIF_SIGPENDING);
++		return;
++	}
++
+ 	if (!recalc_sigpending_tsk(current) && !freezing(current))
+ 		clear_thread_flag(TIF_SIGPENDING);
+ 
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:21 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:21 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:09 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 054279DE7D;
+	Wed,  3 Aug 2011 15:12:22 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id 1BosZIzYSIW0; Wed,  3 Aug 2011 15:12:21 -0400 (EDT)
+Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id E41DC9DE7B;
+	Wed,  3 Aug 2011 15:12:21 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JCEgD022264;
+	Wed, 3 Aug 2011 15:12:15 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:42 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:40 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 06/31] restore the EXEC/EXIT/CLONE utrace hooks
+Message-ID: <20110803190940.GA30929 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
+Status: RO
+Content-Length: 2383
+Lines: 83
+
+Restore the "trivial" EXEC/EXIT/CLONE utrace hooks. Add the
+simple helper, UTRACE_HOOK(), to minimize the changes.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ fs/exec.c              |    5 ++++-
+ include/linux/utrace.h |    6 ++++++
+ kernel/exit.c          |    1 +
+ kernel/fork.c          |    4 ++++
+ 4 files changed, 15 insertions(+), 1 deletions(-)
+
+diff --git a/fs/exec.c b/fs/exec.c
+index da80612..a0814cd 100644
+--- a/fs/exec.c
++++ b/fs/exec.c
+@@ -1401,9 +1401,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
+ 			 */
+ 			bprm->recursion_depth = depth;
+ 			if (retval >= 0) {
+-				if (depth == 0)
++				if (depth == 0) {
++					UTRACE_HOOK(current, EXEC,
++						report_exec(fmt, bprm, regs));
+ 					ptrace_event(PTRACE_EVENT_EXEC,
+ 							old_pid);
++				}
+ 				put_binfmt(fmt);
+ 				allow_write_access(bprm->file);
+ 				if (bprm->file)
+diff --git a/include/linux/utrace.h b/include/linux/utrace.h
+index 1b8da1c..9ac0b1b 100644
+--- a/include/linux/utrace.h
++++ b/include/linux/utrace.h
+@@ -109,6 +109,12 @@ void utrace_signal_handler(struct task_struct *, int);
+ 
+ #define UTRACE_FLAG(task, ev)	(task_utrace_flags(task) & UTRACE_EVENT(ev))
+ 
++#define UTRACE_HOOK(task, ev, callback)			\
++	do {						\
++		if (UTRACE_FLAG(task, ev))		\
++			utrace_ ## callback;		\
++	} while (0)
++
+ #ifndef CONFIG_UTRACE
+ 
+ /*
+diff --git a/kernel/exit.c b/kernel/exit.c
+index 2913b35..c1b0ab6 100644
+--- a/kernel/exit.c
++++ b/kernel/exit.c
+@@ -913,6 +913,7 @@ NORET_TYPE void do_exit(long code)
+ 	 */
+ 	set_fs(USER_DS);
+ 
++	UTRACE_HOOK(current, EXIT, report_exit(&code));
+ 	ptrace_event(PTRACE_EVENT_EXIT, code);
+ 
+ 	validate_creds_for_do_exit(tsk);
+diff --git a/kernel/fork.c b/kernel/fork.c
+index a9891da..37f4a07 100644
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -1539,6 +1539,8 @@ long do_fork(unsigned long clone_flags,
+ 
+ 		audit_finish_fork(p);
+ 
++		UTRACE_HOOK(current, CLONE, report_clone(clone_flags, p));
++
+ 		/*
+ 		 * We set PF_STARTING at creation in case tracing wants to
+ 		 * use this to distinguish a fully live task from one that
+@@ -1550,6 +1552,8 @@ long do_fork(unsigned long clone_flags,
+ 		wake_up_new_task(p);
+ 
+ 		/* forking complete and child started to run, tell ptracer */
++		if (clone_flags & CLONE_VFORK)
++			UTRACE_HOOK(current, CLONE, finish_vfork(current));
+ 		if (unlikely(trace))
+ 			ptrace_event(trace, nr);
+ 
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:23 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:23 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:13 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B36EC9DE82;
+	Wed,  3 Aug 2011 15:12:24 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id 7Qqv+lXfqHw6; Wed,  3 Aug 2011 15:12:24 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 9F8AF9DD25;
+	Wed,  3 Aug 2011 15:12:24 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCH0U023349;
+	Wed, 3 Aug 2011 15:12:17 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:45 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:43 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 07/31] utrace: utrace_report_death() can use
+	task_utrace_struct()
+Message-ID: <20110803190943.GA30936 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
+Status: RO
+Content-Length: 1692
+Lines: 44
+
+utrace_report_death() assumes that the caller (exit_notify) should
+pass task->utrace as an argument. This is no longer needed, it can
+safely do task_utrace_struct(). This way we avoid the nasty changes
+in exit_notify().
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ include/linux/utrace.h |    2 +-
+ kernel/utrace.c        |    5 +++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/include/linux/utrace.h b/include/linux/utrace.h
+index 9ac0b1b..9a2e2f4 100644
+--- a/include/linux/utrace.h
++++ b/include/linux/utrace.h
+@@ -99,7 +99,7 @@ int utrace_get_signal(struct task_struct *, struct pt_regs *,
+ void utrace_report_clone(unsigned long, struct task_struct *);
+ void utrace_finish_vfork(struct task_struct *);
+ void utrace_report_exit(long *exit_code);
+-void utrace_report_death(struct task_struct *, struct utrace *, bool, int);
++void utrace_report_death(struct task_struct *, bool, int);
+ void utrace_report_jctl(int notify, int type);
+ void utrace_report_exec(struct linux_binfmt *, struct linux_binprm *,
+ 			struct pt_regs *regs);
+diff --git a/kernel/utrace.c b/kernel/utrace.c
+index ef856c9..1e750ad 100644
+--- a/kernel/utrace.c
++++ b/kernel/utrace.c
+@@ -1759,9 +1759,10 @@ void utrace_report_exit(long *exit_code)
+  * For this reason, utrace_release_task checks for the event bits that get
+  * us here, and delays its cleanup for us to do.
+  */
+-void utrace_report_death(struct task_struct *task, struct utrace *utrace,
+-			 bool group_dead, int signal)
++void utrace_report_death(struct task_struct *task, bool group_dead, int signal)
+ {
++	struct utrace *utrace = task_utrace_struct(task);
++
+ 	INIT_REPORT(report);
+ 
+ 	BUG_ON(!task->exit_state);
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:15 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:15 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:15:39 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 76DA49D9C7;
+	Wed,  3 Aug 2011 15:12:27 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id 25xHJjCTouA4; Wed,  3 Aug 2011 15:12:27 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 490E79D9AB;
+	Wed,  3 Aug 2011 15:12:27 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCKXo023360;
+	Wed, 3 Aug 2011 15:12:20 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:47 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:45 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 08/31] restore the DEATH/REAP utrace hooks
+Message-ID: <20110803190945.GA30939 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
+Status: RO
+Content-Length: 2346
+Lines: 70
+
+Restore the necessary hooks in release_task() and exit_notify(),
+add the corresponding helpers into utrace.h.
+
+Note: the @signal argument passed to ->report_death() does not
+match the previous behaviour. I think this shouldn't affect the
+current users, and I bet nobody can really understand what this
+magic argument should actually mean anyway.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ include/linux/utrace.h |   22 ++++++++++++++++++++++
+ kernel/exit.c          |    4 ++++
+ 2 files changed, 26 insertions(+), 0 deletions(-)
+
+diff --git a/include/linux/utrace.h b/include/linux/utrace.h
+index 9a2e2f4..cf13839 100644
+--- a/include/linux/utrace.h
++++ b/include/linux/utrace.h
+@@ -697,4 +697,26 @@ static inline __must_check int utrace_barrier_pid(struct pid *pid,
+ 
+ #endif	/* CONFIG_UTRACE */
+ 
++static inline void utrace_release_task(struct task_struct *task)
++{
++	/* see utrace_add_engine() about this barrier */
++	smp_mb();
++	if (task_utrace_flags(task))
++		utrace_maybe_reap(task, task_utrace_struct(task), true);
++}
++
++static inline void utrace_exit_notify(struct task_struct *task,
++					  int signal, int group_dead)
++{
++	/*
++	 * If utrace_set_events() was just called to enable
++	 * UTRACE_EVENT(DEATH), then we are obliged to call
++	 * utrace_report_death() and not miss it.  utrace_set_events()
++	 * checks @task->exit_state under tasklist_lock to synchronize
++	 * with exit_notify(), the caller.
++	 */
++	if (task_utrace_flags(task) & _UTRACE_DEATH_EVENTS)
++		utrace_report_death(task, group_dead, signal);
++}
++
+ #endif	/* linux/utrace.h */
+diff --git a/kernel/exit.c b/kernel/exit.c
+index c1b0ab6..ba5ba22 100644
+--- a/kernel/exit.c
++++ b/kernel/exit.c
+@@ -168,6 +168,8 @@ void release_task(struct task_struct * p)
+ 	struct task_struct *leader;
+ 	int zap_leader;
+ repeat:
++	utrace_release_task(p);
++
+ 	/* don't need to get the RCU readlock here - the process is dead and
+ 	 * can't be modifying its own credentials. But shut RCU-lockdep up */
+ 	rcu_read_lock();
+@@ -860,6 +862,8 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
+ 		wake_up_process(tsk->signal->group_exit_task);
+ 	write_unlock_irq(&tasklist_lock);
+ 
++	utrace_exit_notify(tsk, autoreap ? -1 : SIGCHLD, group_dead);
++
+ 	/* If the process is dead, release it - nobody will wait for it */
+ 	if (autoreap)
+ 		release_task(tsk);
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:22:02 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:22:02 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:17:16 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 26DB69DE8C;
+	Wed,  3 Aug 2011 15:12:30 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id DbxGfmFvtTiR; Wed,  3 Aug 2011 15:12:30 -0400 (EDT)
+Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 0A30A9DE91;
+	Wed,  3 Aug 2011 15:12:30 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCMDQ008389;
+	Wed, 3 Aug 2011 15:12:23 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:50 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:48 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 09/31] utrace: remove jobctl bits
+Message-ID: <20110803190948.GA30942 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+Status: RO
+Content-Length: 1888
+Lines: 56
+
+- change utrace_get_signal() to check JOBCTL_STOP_PENDING instead of
+  signal->group_stop_count. With the recent changes group_stop_count
+  doesn't necessarily mean this task should participate in group stop.
+
+- remove the "participate in group stop" code from utrace_wakeup() and
+  utrace_stop(), this is no longer needed and wrong.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ kernel/utrace.c |   16 ++--------------
+ 1 files changed, 2 insertions(+), 14 deletions(-)
+
+diff --git a/kernel/utrace.c b/kernel/utrace.c
+index 1e750ad..5d3974e 100644
+--- a/kernel/utrace.c
++++ b/kernel/utrace.c
+@@ -648,11 +648,7 @@ static void utrace_wakeup(struct task_struct *target, struct utrace *utrace)
+ {
+ 	lockdep_assert_held(&utrace->lock);
+ 	spin_lock_irq(&target->sighand->siglock);
+-	if (target->signal->flags & SIGNAL_STOP_STOPPED ||
+-	    target->signal->group_stop_count)
+-		target->state = TASK_STOPPED;
+-	else
+-		wake_up_state(target, __TASK_TRACED);
++	wake_up_state(target, __TASK_TRACED);
+ 	spin_unlock_irq(&target->sighand->siglock);
+ }
+ 
+@@ -805,14 +801,6 @@ relock:
+ 
+ 	__set_current_state(TASK_TRACED);
+ 
+-	/*
+-	 * If there is a group stop in progress,
+-	 * we must participate in the bookkeeping.
+-	 */
+-	if (unlikely(task->signal->group_stop_count) &&
+-			!--task->signal->group_stop_count)
+-		task->signal->flags = SIGNAL_STOP_STOPPED;
+-
+ 	spin_unlock_irq(&task->sighand->siglock);
+ 	spin_unlock(&utrace->lock);
+ 
+@@ -2037,7 +2025,7 @@ int utrace_get_signal(struct task_struct *task, struct pt_regs *regs,
+ 		ka = NULL;
+ 		memset(return_ka, 0, sizeof *return_ka);
+ 	} else if (!(task->utrace_flags & UTRACE_EVENT_SIGNAL_ALL) ||
+-		   unlikely(task->signal->group_stop_count)) {
++		   unlikely(task->jobctl & JOBCTL_STOP_PENDING)) {
+ 		/*
+ 		 * If no engine is interested in intercepting signals or
+ 		 * we must stop, let the caller just dequeue them normally
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:17 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:17 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:15:52 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id AB6E39DA46;
+	Wed,  3 Aug 2011 15:12:32 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id LkzmRGslEelr; Wed,  3 Aug 2011 15:12:32 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 959659DA60;
+	Wed,  3 Aug 2011 15:12:32 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCPx7023400;
+	Wed, 3 Aug 2011 15:12:25 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:53 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:51 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 10/31] ptrace: take ->siglock around s/TRACED/RUNNING/
+Message-ID: <20110803190951.GA30949 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
+Status: RO
+Content-Length: 1624
+Lines: 56
+
+change ptrace_resume() and ptrace_stop() to take ->siglock around changing
 task->state from TRACED to RUNNING.
 
 With this patch __TASK_TRACED/STOPPED bits are fully protected by ->siglock,
@@ -4315,10 +4851,10 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  2 files changed, 10 insertions(+), 1 deletions(-)
 
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index 2df1157..9988b13 100644
+index 9de3ecf..56b8fc1 100644
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
-@@ -534,6 +534,8 @@ static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info)
+@@ -589,6 +589,8 @@ static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info)
  static int ptrace_resume(struct task_struct *child, long request,
  			 unsigned long data)
  {
@@ -4327,7 +4863,7 @@ index 2df1157..9988b13 100644
  	if (!valid_signal(data))
  		return -EIO;
  
-@@ -562,7 +564,11 @@ static int ptrace_resume(struct task_struct *child, long request,
+@@ -617,7 +619,11 @@ static int ptrace_resume(struct task_struct *child, long request,
  	}
  
  	child->exit_code = data;
@@ -4341,10 +4877,10 @@ index 2df1157..9988b13 100644
  	return 0;
  }
 diff --git a/kernel/signal.c b/kernel/signal.c
-index ff76786..2138cee 100644
+index 0f9af0b..71f5cca 100644
 --- a/kernel/signal.c
 +++ b/kernel/signal.c
-@@ -1799,7 +1799,10 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
+@@ -1878,7 +1878,10 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
  		if (gstop_done)
  			do_notify_parent_cldstop(current, false, why);
  
@@ -4359,48 +4895,49 @@ index ff76786..2138cee 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:06 2011
+From davej  Wed Aug  3 15:16:37 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:06 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:09 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:37 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:29 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id E1AB7D812A;
-	Thu, 30 Jun 2011 20:23:09 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id QhOnA49nS3Vp; Thu, 30 Jun 2011 20:23:09 -0400 (EDT)
-Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id C5E15D810F;
-	Thu, 30 Jun 2011 20:23:09 -0400 (EDT)
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5034E9DEA4;
+	Wed,  3 Aug 2011 15:12:35 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id 8BhFlmqmXy8l; Wed,  3 Aug 2011 15:12:35 -0400 (EDT)
+Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 31AEE9DEAB;
+	Wed,  3 Aug 2011 15:12:35 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610N2Kd007635;
-	Thu, 30 Jun 2011 20:23:02 -0400
+	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCRCZ008434;
+	Wed, 3 Aug 2011 15:12:28 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:10 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:07 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:55 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:53 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 04/19] introduce wake_up_quiescent()
-Message-ID: <20110701002107.GA25790 at redhat.com>
+Subject: [PATCH 11/31] introduce wake_up_quiescent()
+Message-ID: <20110803190953.GA30952 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
 Status: RO
-Content-Length: 3104
+Content-Length: 3186
 Lines: 93
 
 No functional changes. Add the new helper, wake_up_quiescent(task, state),
@@ -4431,10 +4968,10 @@ index a822300..2be3712 100644
  extern int do_send_sig_info(int sig, struct siginfo *info,
  				struct task_struct *p, bool group);
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index 9988b13..26ae214 100644
+index 56b8fc1..4194664 100644
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
-@@ -566,7 +566,7 @@ static int ptrace_resume(struct task_struct *child, long request,
+@@ -621,7 +621,7 @@ static int ptrace_resume(struct task_struct *child, long request,
  	child->exit_code = data;
  
  	if (lock_task_sighand(child, &flags)) {
@@ -4444,10 +4981,10 @@ index 9988b13..26ae214 100644
  	}
  
 diff --git a/kernel/signal.c b/kernel/signal.c
-index 2138cee..4fcf1c7 100644
+index 71f5cca..3e8e0b1 100644
 --- a/kernel/signal.c
 +++ b/kernel/signal.c
-@@ -652,6 +652,14 @@ void signal_wake_up(struct task_struct *t, int resume)
+@@ -702,6 +702,14 @@ void signal_wake_up(struct task_struct *t, int resume)
  }
  
  /*
@@ -4462,16 +4999,16 @@ index 2138cee..4fcf1c7 100644
   * Remove signals in mask from the pending set and queue.
   * Returns 1 if any signals were found.
   *
-@@ -811,7 +819,7 @@ static int prepare_signal(int sig, struct task_struct *p, int from_ancestor_ns)
- 		do {
- 			task_clear_group_stop_pending(t);
+@@ -888,7 +896,7 @@ static int prepare_signal(int sig, struct task_struct *p, int from_ancestor_ns)
+ 			task_clear_jobctl_pending(t, JOBCTL_STOP_PENDING);
  			rm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending);
--			wake_up_state(t, __TASK_STOPPED);
-+			wake_up_quiescent(t, __TASK_STOPPED);
+ 			if (likely(!(t->ptrace & PT_SEIZED)))
+-				wake_up_state(t, __TASK_STOPPED);
++				wake_up_quiescent(t, __TASK_STOPPED);
+ 			else
+ 				ptrace_trap_notify(t);
  		} while_each_thread(p, t);
- 
- 		/*
-@@ -1800,7 +1808,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
+@@ -1879,7 +1887,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
  			do_notify_parent_cldstop(current, false, why);
  
  		spin_lock_irq(&current->sighand->siglock);
@@ -4481,7 +5018,7 @@ index 2138cee..4fcf1c7 100644
  
  		if (clear_code)
 diff --git a/kernel/utrace.c b/kernel/utrace.c
-index 6e7fafb..d7c547c 100644
+index 5d3974e..cebc390 100644
 --- a/kernel/utrace.c
 +++ b/kernel/utrace.c
 @@ -648,7 +648,7 @@ static void utrace_wakeup(struct task_struct *target, struct utrace *utrace)
@@ -4497,52 +5034,53 @@ index 6e7fafb..d7c547c 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:07 2011
+From davej  Wed Aug  3 15:22:01 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:07 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:22:01 -0400 (EDT)
 Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
  zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:13 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:17:15 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 2CF811287F3;
-	Thu, 30 Jun 2011 20:23:13 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id F2DE19DC07;
+	Wed,  3 Aug 2011 15:12:37 -0400 (EDT)
 Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id dNPA3WxO-7pp; Thu, 30 Jun 2011 20:23:13 -0400 (EDT)
-Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
-	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 154D61287DD;
-	Thu, 30 Jun 2011 20:23:13 -0400 (EDT)
+	with ESMTP id IYfqfx8GhNWc; Wed,  3 Aug 2011 15:12:37 -0400 (EDT)
+Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id D645E9DAF7;
+	Wed,  3 Aug 2011 15:12:37 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p610N5nY021107;
-	Thu, 30 Jun 2011 20:23:06 -0400
+	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCUNh008446;
+	Wed, 3 Aug 2011 15:12:31 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:13 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:11 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:09:58 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:56 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 05/19] introduce ptrace_signal_wake_up()
-Message-ID: <20110701002111.GA25797 at redhat.com>
+Subject: [PATCH 12/31] introduce ptrace_signal_wake_up()
+Message-ID: <20110803190956.GA30959 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
 Status: RO
-Content-Length: 1975
-Lines: 68
+Content-Length: 3667
+Lines: 113
 
-Add the new helper, ptrace_signal_wake_up(), change ptrace.c to use
-it instead of signal_wake_up().
+Add the new helper, ptrace_signal_wake_up(), change ptrace.c/signal.c
+to use it instead of signal_wake_up() to wake up a STOPPED/TRACED task.
 
 The new helper does almost the same, except:
 
@@ -4562,18 +5100,32 @@ wake_up_quiescent().
 
 Signed-off-by: Oleg Nesterov <oleg at redhat.com>
 ---
- kernel/ptrace.c |   16 ++++++++++++++--
- 1 files changed, 14 insertions(+), 2 deletions(-)
+ include/linux/ptrace.h |    1 +
+ kernel/ptrace.c        |   20 ++++++++++++++++----
+ kernel/signal.c        |    2 +-
+ 3 files changed, 18 insertions(+), 5 deletions(-)
 
+diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
+index 800f113..6d9282a 100644
+--- a/include/linux/ptrace.h
++++ b/include/linux/ptrace.h
+@@ -113,6 +113,7 @@
+ #include <linux/compiler.h>		/* For unlikely.  */
+ #include <linux/sched.h>		/* For struct task_struct.  */
+ 
++extern void ptrace_signal_wake_up(struct task_struct *p, int quiescent);
+ 
+ extern long arch_ptrace(struct task_struct *child, long request,
+ 			unsigned long addr, unsigned long data);
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index 26ae214..0b2aba5 100644
+index 4194664..1a50090 100644
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
-@@ -24,6 +24,18 @@
- #include <linux/regset.h>
+@@ -25,6 +25,18 @@
  #include <linux/hw_breakpoint.h>
+ #include <linux/cn_proc.h>
  
-+static void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
++void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
 +{
 +	unsigned int state;
 +
@@ -4586,69 +5138,101 @@ index 26ae214..0b2aba5 100644
 +		kick_process(p);
 +}
  
- /*
-  * ptrace a task: make the debugger its new parent and
-@@ -92,7 +104,7 @@ void __ptrace_unlink(struct task_struct *child)
+ static int ptrace_trapping_sleep_fn(void *flags)
+ {
+@@ -106,7 +118,7 @@ void __ptrace_unlink(struct task_struct *child)
  	 * TASK_KILLABLE sleeps.
  	 */
- 	if (child->group_stop & GROUP_STOP_PENDING || task_is_traced(child))
+ 	if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child))
 -		signal_wake_up(child, task_is_traced(child));
 +		ptrace_signal_wake_up(child, task_is_traced(child));
  
  	spin_unlock(&child->sighand->siglock);
  }
-@@ -245,7 +257,7 @@ static int ptrace_attach(struct task_struct *task)
+@@ -296,7 +308,7 @@ static int ptrace_attach(struct task_struct *task, long request,
  	 */
- 	if (task_is_stopped(task)) {
- 		task->group_stop |= GROUP_STOP_PENDING | GROUP_STOP_TRAPPING;
+ 	if (task_is_stopped(task) &&
+ 	    task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING))
 -		signal_wake_up(task, 1);
 +		ptrace_signal_wake_up(task, 1);
- 		wait_trap = true;
- 	}
  
+ 	spin_unlock(&task->sighand->siglock);
+ 
+@@ -731,7 +743,7 @@ int ptrace_request(struct task_struct *child, long request,
+ 		 * tracee into STOP.
+ 		 */
+ 		if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP)))
+-			signal_wake_up(child, child->jobctl & JOBCTL_LISTENING);
++			ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING);
+ 
+ 		unlock_task_sighand(child, &flags);
+ 		ret = 0;
+@@ -760,7 +772,7 @@ int ptrace_request(struct task_struct *child, long request,
+ 		 * of this trap and now.  Trigger re-trap immediately.
+ 		 */
+ 		if (child->jobctl & JOBCTL_TRAP_NOTIFY)
+-			signal_wake_up(child, true);
++			ptrace_signal_wake_up(child, true);
+ 
+ 		unlock_task_sighand(child, &flags);
+ 		ret = 0;
+diff --git a/kernel/signal.c b/kernel/signal.c
+index 3e8e0b1..0dc6abb 100644
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -854,7 +854,7 @@ static void ptrace_trap_notify(struct task_struct *t)
+ 	assert_spin_locked(&t->sighand->siglock);
+ 
+ 	task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY);
+-	signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);
++	ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);
+ }
+ 
+ /*
 -- 
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:08 2011
+From davej  Wed Aug  3 15:15:58 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:08 -0400 (EDT)
-Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
- zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:16 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:15:58 -0400 (EDT)
+Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
+ zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:13:17 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 6FB379C0CB;
-	Thu, 30 Jun 2011 20:23:16 -0400 (EDT)
-Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id IYB64KKErOyI; Thu, 30 Jun 2011 20:23:16 -0400 (EDT)
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 8FF88DA558;
+	Wed,  3 Aug 2011 15:12:40 -0400 (EDT)
+Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id 1cOfIyuaRoO3; Wed,  3 Aug 2011 15:12:40 -0400 (EDT)
 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 597119C0C5;
-	Thu, 30 Jun 2011 20:23:16 -0400 (EDT)
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7B6E8DA4A9;
+	Wed,  3 Aug 2011 15:12:40 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610N8bE032569;
-	Thu, 30 Jun 2011 20:23:09 -0400
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCXpn023459;
+	Wed, 3 Aug 2011 15:12:33 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:16 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:14 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:01 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:09:59 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 06/19] wait_task_inactive: treat task->state and
+Subject: [PATCH 13/31] wait_task_inactive: treat task->state and
 	match_state as bitmasks
-Message-ID: <20110701002114.GA25804 at redhat.com>
+Message-ID: <20110803190959.GA30962 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
 Status: RO
@@ -4679,10 +5263,10 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/kernel/sched.c b/kernel/sched.c
-index 3f2e502..ade7997 100644
+index ccacdbd..66ef2fb 100644
 --- a/kernel/sched.c
 +++ b/kernel/sched.c
-@@ -2277,7 +2277,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
+@@ -2289,7 +2289,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
  		 * is actually now running somewhere else!
  		 */
  		while (task_running(rq, p)) {
@@ -4695,46 +5279,47 @@ index 3f2e502..ade7997 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:09 2011
+From davej  Wed Aug  3 15:16:24 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:09 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:19 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:24 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:21 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A6BD4D810F;
-	Thu, 30 Jun 2011 20:23:19 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id 2ovLSk6W1SGg; Thu, 30 Jun 2011 20:23:19 -0400 (EDT)
-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 8DBABD812A;
-	Thu, 30 Jun 2011 20:23:19 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 34C189DC30;
+	Wed,  3 Aug 2011 15:12:43 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id RHggq6bqo+Q9; Wed,  3 Aug 2011 15:12:43 -0400 (EDT)
+Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 210D59DC14;
+	Wed,  3 Aug 2011 15:12:43 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p610NCUq026299;
-	Thu, 30 Jun 2011 20:23:12 -0400
+	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JCZsD022395;
+	Wed, 3 Aug 2011 15:12:36 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:19 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:17 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:03 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:01 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 07/19] introduce TASK_UTRACED state
-Message-ID: <20110701002117.GA25807 at redhat.com>
+Subject: [PATCH 14/31] introduce TASK_UTRACED state
+Message-ID: <20110803191001.GA30969 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
 Status: RO
 Content-Length: 2913
 Lines: 84
@@ -4751,7 +5336,7 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  2 files changed, 17 insertions(+), 14 deletions(-)
 
 diff --git a/fs/proc/array.c b/fs/proc/array.c
-index 496fef3..bfaa998 100644
+index f0c0ea2..e0daec4 100644
 --- a/fs/proc/array.c
 +++ b/fs/proc/array.c
 @@ -138,11 +138,12 @@ static const char * const task_state_array[] = {
@@ -4773,7 +5358,7 @@ index 496fef3..bfaa998 100644
  
  static inline const char *get_task_state(struct task_struct *tsk)
 diff --git a/include/linux/sched.h b/include/linux/sched.h
-index b87de83..7a0008c 100644
+index c6d79af..f3f0a77 100644
 --- a/include/linux/sched.h
 +++ b/include/linux/sched.h
 @@ -184,16 +184,17 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
@@ -4824,46 +5409,47 @@ index b87de83..7a0008c 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:10 2011
+From davej  Wed Aug  3 15:16:02 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:10 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:02 -0400 (EDT)
 Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
  zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:23 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:13:18 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 1A66AD812A;
-	Thu, 30 Jun 2011 20:23:23 -0400 (EDT)
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id D7FFADA44E;
+	Wed,  3 Aug 2011 15:12:45 -0400 (EDT)
 Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id fctUcQ+-lYpk; Thu, 30 Jun 2011 20:23:23 -0400 (EDT)
-Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id F2D35D810F;
-	Thu, 30 Jun 2011 20:23:22 -0400 (EDT)
+	with ESMTP id LFGdvSMswLJT; Wed,  3 Aug 2011 15:12:45 -0400 (EDT)
+Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id BA46CDA441;
+	Wed,  3 Aug 2011 15:12:45 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610NF1u015200;
-	Thu, 30 Jun 2011 20:23:15 -0400
+	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCcpZ029424;
+	Wed, 3 Aug 2011 15:12:39 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:23 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:20 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:06 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:04 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 08/19] utrace: use TASK_UTRACED instead of TASK_TRACED
-Message-ID: <20110701002120.GA25814 at redhat.com>
+Subject: [PATCH 15/31] utrace: use TASK_UTRACED instead of TASK_TRACED
+Message-ID: <20110803191004.GA30972 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
 Status: RO
 Content-Length: 4316
 Lines: 130
@@ -4886,7 +5472,7 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  1 files changed, 14 insertions(+), 12 deletions(-)
 
 diff --git a/kernel/utrace.c b/kernel/utrace.c
-index d7c547c..be98607 100644
+index cebc390..2097103 100644
 --- a/kernel/utrace.c
 +++ b/kernel/utrace.c
 @@ -462,6 +462,8 @@ static void put_detached_list(struct list_head *list)
@@ -4999,58 +5585,56 @@ index d7c547c..be98607 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:12 2011
+From davej  Wed Aug  3 15:21:40 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:12 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:21:40 -0400 (EDT)
 Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
  zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:26 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:42 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 289969C0C5;
-	Thu, 30 Jun 2011 20:23:26 -0400 (EDT)
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7035E9DECC;
+	Wed,  3 Aug 2011 15:12:48 -0400 (EDT)
 Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id q99JSaVz2X1O; Thu, 30 Jun 2011 20:23:26 -0400 (EDT)
-Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 143F89C0C3;
-	Thu, 30 Jun 2011 20:23:26 -0400 (EDT)
+	with ESMTP id rmRalMQFlNua; Wed,  3 Aug 2011 15:12:48 -0400 (EDT)
+Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5CC809DEC9;
+	Wed,  3 Aug 2011 15:12:48 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p610NI9T021133;
-	Thu, 30 Jun 2011 20:23:19 -0400
+	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JCfwv010344;
+	Wed, 3 Aug 2011 15:12:41 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:26 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:24 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:09 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:07 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 09/19] tracehooks: kill tracehook_finish_jctl(), add
-	tracehook_finish_stop()
-Message-ID: <20110701002124.GA25817 at redhat.com>
+Subject: [PATCH 16/31] reintroduce tracehook_finish_jctl() as
+	utrace_end_stop()
+Message-ID: <20110803191007.GA30979 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
 Status: RO
-Content-Length: 2782
-Lines: 86
+Content-Length: 2401
+Lines: 77
 
-tracehook_finish_jctl() is needed to avoid the races with SIGKILL
-which wakes up UTRACED task, and thus it should be called every time
-after the STOPPED/TRACED/UTRACED returns from schedule(), remember
-that TASK_UTRACED can be added while the task is STOPPED/UTRACED.
-
-- rename it to tracehook_finish_stop(),jctl no longer matches the
-  reality.
+utrace_finish_stop() is needed to avoid the races with SIGKILL which
+wakes up UTRACED task, and thus it should be called every time after
+the STOPPED/TRACED/UTRACED returns from schedule(), remember that
+TASK_UTRACED can be added while the task is STOPPED/UTRACED.
 
 - change do_signal_state() to call this helper right after schedule(),
   otherwise this logic is broken by the upstream changes
@@ -5060,62 +5644,56 @@ that TASK_UTRACED can be added while the task is STOPPED/UTRACED.
 
 Signed-off-by: Oleg Nesterov <oleg at redhat.com>
 ---
- include/linux/tracehook.h |    6 +++---
- kernel/signal.c           |    5 +++--
- kernel/utrace.c           |    2 +-
- 3 files changed, 7 insertions(+), 6 deletions(-)
+ include/linux/utrace.h |   11 +++++++++++
+ kernel/signal.c        |    5 +++++
+ kernel/utrace.c        |    2 +-
+ 3 files changed, 17 insertions(+), 1 deletions(-)
 
-diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
-index 7d7bdde..3c7b6b3 100644
---- a/include/linux/tracehook.h
-+++ b/include/linux/tracehook.h
-@@ -528,11 +528,11 @@ static inline int tracehook_get_signal(struct task_struct *task,
+diff --git a/include/linux/utrace.h b/include/linux/utrace.h
+index cf13839..0279c74 100644
+--- a/include/linux/utrace.h
++++ b/include/linux/utrace.h
+@@ -719,4 +719,15 @@ static inline void utrace_exit_notify(struct task_struct *task,
+ 		utrace_report_death(task, group_dead, signal);
  }
  
- /**
-- * tracehook_finish_jctl - report about return from job control stop
-+ * tracehook_finish_stop - report about return from STOPPED/TRACED
-  *
-- * This is called by do_signal_stop() after wakeup.
++/**
++ * utrace_end_stop - report about return from STOPPED/TRACED
++ *
 + * This is called by do_signal_stop() and ptrace_stop after wakeup.
-  */
--static inline void tracehook_finish_jctl(void)
-+static inline void tracehook_finish_stop(void)
- {
- 	if (task_utrace_flags(current))
- 		utrace_finish_stop();
++ */
++static inline void utrace_end_stop(void)
++{
++	if (task_utrace_flags(current))
++		utrace_finish_stop();
++}
++
+ #endif	/* linux/utrace.h */
 diff --git a/kernel/signal.c b/kernel/signal.c
-index 4fcf1c7..a7979ad 100644
+index 0dc6abb..a625309 100644
 --- a/kernel/signal.c
 +++ b/kernel/signal.c
-@@ -1816,6 +1816,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
+@@ -1895,6 +1895,8 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
  		read_unlock(&tasklist_lock);
  	}
  
-+	tracehook_finish_stop();
++	utrace_end_stop();
++
  	/*
  	 * While in TASK_TRACED, we were considered "frozen enough".
  	 * Now that we woke up, it's crucial if we're supposed to be
-@@ -1952,6 +1953,8 @@ retry:
+@@ -2059,6 +2061,9 @@ static bool do_signal_stop(int signr)
+ 
  		/* Now we don't run again until woken by SIGCONT or SIGKILL */
  		schedule();
- 
-+		tracehook_finish_stop();
 +
- 		spin_lock_irq(&current->sighand->siglock);
++		utrace_end_stop();
++
+ 		return true;
  	} else {
- 		ptrace_stop(current->group_stop & GROUP_STOP_SIGMASK,
-@@ -1974,8 +1977,6 @@ retry:
- 
- 	spin_unlock_irq(&current->sighand->siglock);
- 
--	tracehook_finish_jctl();
--
- 	return 1;
- }
- 
+ 		/*
 diff --git a/kernel/utrace.c b/kernel/utrace.c
-index be98607..daa96b9 100644
+index 2097103..d41b982 100644
 --- a/kernel/utrace.c
 +++ b/kernel/utrace.c
 @@ -741,7 +741,7 @@ static bool utrace_reset(struct task_struct *task, struct utrace *utrace)
@@ -5131,46 +5709,47 @@ index be98607..daa96b9 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:13 2011
+From davej  Wed Aug  3 15:21:41 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:13 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:29 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:21:41 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:42 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A748FD813B;
-	Thu, 30 Jun 2011 20:23:29 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id EwbxGxAU7ASi; Thu, 30 Jun 2011 20:23:29 -0400 (EDT)
-Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 72761D810F;
-	Thu, 30 Jun 2011 20:23:29 -0400 (EDT)
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 153719DD18;
+	Wed,  3 Aug 2011 15:12:51 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id ffM0oM8RRtgL; Wed,  3 Aug 2011 15:12:51 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 0253E9DEC9;
+	Wed,  3 Aug 2011 15:12:51 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610NMAW015213;
-	Thu, 30 Jun 2011 20:23:22 -0400
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCh9Z023559;
+	Wed, 3 Aug 2011 15:12:44 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:29 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:27 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:11 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:09 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 10/19] teach wake_up_quiescent() to do "selective" wake_up
-Message-ID: <20110701002127.GA25824 at redhat.com>
+Subject: [PATCH 17/31] teach wake_up_quiescent() to do "selective" wake_up
+Message-ID: <20110803191009.GA30982 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
 Status: RO
 Content-Length: 1335
 Lines: 46
@@ -5188,10 +5767,10 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  1 files changed, 15 insertions(+), 0 deletions(-)
 
 diff --git a/kernel/signal.c b/kernel/signal.c
-index a7979ad..57552e6 100644
+index a625309..0d1675a 100644
 --- a/kernel/signal.c
 +++ b/kernel/signal.c
-@@ -651,11 +651,26 @@ void signal_wake_up(struct task_struct *t, int resume)
+@@ -701,11 +701,26 @@ void signal_wake_up(struct task_struct *t, int resume)
  		kick_process(t);
  }
  
@@ -5222,49 +5801,50 @@ index a7979ad..57552e6 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:14 2011
+From davej  Wed Aug  3 15:21:43 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:14 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:21:43 -0400 (EDT)
 Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
  zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:32 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:43 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id C94CF9C0C5;
-	Thu, 30 Jun 2011 20:23:32 -0400 (EDT)
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B0E899DECF;
+	Wed,  3 Aug 2011 15:12:53 -0400 (EDT)
 Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id 9R-z4gQXQITf; Thu, 30 Jun 2011 20:23:32 -0400 (EDT)
-Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B55759C0C3;
-	Thu, 30 Jun 2011 20:23:32 -0400 (EDT)
+	with ESMTP id s0bDFhAmsQWN; Wed,  3 Aug 2011 15:12:53 -0400 (EDT)
+Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 9DC6E9DEC9;
+	Wed,  3 Aug 2011 15:12:53 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p610NPe5021144;
-	Thu, 30 Jun 2011 20:23:25 -0400
+	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCkUr029453;
+	Wed, 3 Aug 2011 15:12:46 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:33 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:30 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:14 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:12 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 11/19] ptrace_stop: do not assume the task is running after
+Subject: [PATCH 18/31] ptrace_stop: do not assume the task is running after
 	wake_up_quiescent()
-Message-ID: <20110701002130.GA25827 at redhat.com>
+Message-ID: <20110803191012.GA30985 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
 Status: RO
-Content-Length: 962
+Content-Length: 956
 Lines: 31
 
 If ptrace_stop() sets TASK_TRACED and then detects we should not stop,
@@ -5277,10 +5857,10 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  1 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/kernel/signal.c b/kernel/signal.c
-index 57552e6..89e691d 100644
+index 0d1675a..249760f 100644
 --- a/kernel/signal.c
 +++ b/kernel/signal.c
-@@ -1829,6 +1829,14 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
+@@ -1908,6 +1908,14 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
  		if (clear_code)
  			current->exit_code = 0;
  		read_unlock(&tasklist_lock);
@@ -5294,172 +5874,296 @@ index 57552e6..89e691d 100644
 +		schedule();
  	}
  
- 	tracehook_finish_stop();
+ 	utrace_end_stop();
 -- 
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:17 2011
+From davej  Wed Aug  3 15:16:26 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:17 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:26 -0400 (EDT)
 Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
  zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:36 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:22 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 4390F1287F3;
-	Thu, 30 Jun 2011 20:23:36 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 69B489DC62;
+	Wed,  3 Aug 2011 15:12:56 -0400 (EDT)
 Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id v5mzxCjpefBI; Thu, 30 Jun 2011 20:23:36 -0400 (EDT)
+	with ESMTP id 4BNNeoYSdCTc; Wed,  3 Aug 2011 15:12:56 -0400 (EDT)
 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
-	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 283B21287DD;
-	Thu, 30 Jun 2011 20:23:36 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 4A9899DC14;
+	Wed,  3 Aug 2011 15:12:56 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610NSc9032626;
-	Thu, 30 Jun 2011 20:23:29 -0400
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCnRf023575;
+	Wed, 3 Aug 2011 15:12:49 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:36 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:34 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:16 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:14 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 12/19] get_signal_to_deliver: restructure utrace/ptrace
-	signal reporting
-Message-ID: <20110701002134.GA25834 at redhat.com>
+Subject: [PATCH 19/31] get_signal_to_deliver: restore/restructure
+	utrace/ptrace signal reporting
+Message-ID: <20110803191014.GA30992 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
 Status: RO
-Content-Length: 2012
-Lines: 73
+Content-Length: 3556
+Lines: 115
 
-get_signal_to_deliver() assumes that either tracehook_get_signal() does
-nothing (without CONFIG_UTRACE), or it also reports the signal to ptrace
-engine implemented on top of utrace. Now that ptrace works independently
-this doesn't work.
+- Reintroduce tracehook_get_signal() as utrace_hook_signal().
 
-Change the code to call ptrace_signal() after tracehook_get_signal().
+- Change get_signal_to_deliver() to call utrace_hook_signal() first,
+  before dequeue_signal()
 
-Move ->ptrace check from ptrace_signal() to get_signal_to_deliver(),
-we do not want to change *return_ka if it was initialized by utrace
-and the task is not traced.
+- Always call ptrace_signal() if signal != SIGKILL, no matter whether
+  this signal comes from utrace or not.
+
+  Since this can change signr again, update "struct k_sigaction *ka"
+  in this case.
 
 IOW, roughly, ptrace acts as if it is the last attached engine, it
 takes the final decision about the signal.
 
 Signed-off-by: Oleg Nesterov <oleg at redhat.com>
 ---
- kernel/signal.c |   24 +++++++++++-------------
- 1 files changed, 11 insertions(+), 13 deletions(-)
+ include/linux/utrace.h |   31 +++++++++++++++++++++++++++++++
+ kernel/signal.c        |   30 ++++++++++++++++++++----------
+ 2 files changed, 51 insertions(+), 10 deletions(-)
 
+diff --git a/include/linux/utrace.h b/include/linux/utrace.h
+index 0279c74..63103e2 100644
+--- a/include/linux/utrace.h
++++ b/include/linux/utrace.h
+@@ -730,4 +730,35 @@ static inline void utrace_end_stop(void)
+ 		utrace_finish_stop();
+ }
+ 
++/**
++ * utrace_hook_signal - deliver synthetic signal to traced task
++ * @task:		@current
++ * @regs:		task_pt_regs(@current)
++ * @info:		details of synthetic signal
++ * @return_ka:		sigaction for synthetic signal
++ *
++ * Return zero to check for a real pending signal normally.
++ * Return -1 after releasing the siglock to repeat the check.
++ * Return a signal number to induce an artificial signal delivery,
++ * setting *@info and *@return_ka to specify its details and behavior.
++ *
++ * The @return_ka->sa_handler value controls the disposition of the
++ * signal, no matter the signal number.  For %SIG_DFL, the return value
++ * is a representative signal to indicate the behavior (e.g. %SIGTERM
++ * for death, %SIGQUIT for core dump, %SIGSTOP for job control stop,
++ * %SIGTSTP for stop unless in an orphaned pgrp), but the signal number
++ * reported will be @info->si_signo instead.
++ *
++ * Called with @task->sighand->siglock held, before dequeuing pending signals.
++ */
++static inline int utrace_hook_signal(struct task_struct *task,
++				       struct pt_regs *regs,
++				       siginfo_t *info,
++				       struct k_sigaction *return_ka)
++{
++	if (unlikely(task_utrace_flags(task)))
++		return utrace_get_signal(task, regs, info, return_ka);
++	return 0;
++}
++
+ #endif	/* linux/utrace.h */
 diff --git a/kernel/signal.c b/kernel/signal.c
-index 89e691d..d0e0c67 100644
+index 249760f..3c783d3 100644
 --- a/kernel/signal.c
 +++ b/kernel/signal.c
-@@ -2006,9 +2006,6 @@ retry:
- static int ptrace_signal(int signr, siginfo_t *info,
- 			 struct pt_regs *regs, void *cookie)
- {
--	if (!task_ptrace(current))
--		return signr;
--
- 	ptrace_signal_deliver(regs, cookie);
+@@ -2234,17 +2234,27 @@ relock:
+ 	for (;;) {
+ 		struct k_sigaction *ka;
  
- 	/* Let the debugger run.  */
-@@ -2110,6 +2107,7 @@ relock:
- 		signr = tracehook_get_signal(current, regs, info, return_ka);
- 		if (unlikely(signr < 0))
+-		if (unlikely(current->jobctl & JOBCTL_STOP_PENDING) &&
+-		    do_signal_stop(0))
++		signr = utrace_hook_signal(current, regs, info, return_ka);
++		if (unlikely(signr < 0))
  			goto relock;
-+
- 		if (unlikely(signr != 0))
- 			ka = return_ka;
- 		else {
-@@ -2117,18 +2115,18 @@ relock:
- 				     GROUP_STOP_PENDING) && do_signal_stop(0))
- 				goto relock;
  
--			signr = dequeue_signal(current, &current->blocked,
--					       info);
+-		if (unlikely(current->jobctl & JOBCTL_TRAP_MASK)) {
+-			do_jobctl_trap();
+-			spin_unlock_irq(&sighand->siglock);
+-			goto relock;
+-		}
++		if (unlikely(signr != 0))
++			ka = return_ka;
++		else {
++			if (unlikely(current->jobctl & JOBCTL_STOP_PENDING) &&
++			    do_signal_stop(0))
++				goto relock;
+ 
+-		signr = dequeue_signal(current, &current->blocked, info);
++			if (unlikely(current->jobctl & JOBCTL_TRAP_MASK)) {
++				do_jobctl_trap();
++				spin_unlock_irq(&sighand->siglock);
++				goto relock;
++			}
++
 +			signr = dequeue_signal(current, &current->blocked, info);
++
++			ka = &sighand->action[signr-1];
++		}
+ 
+ 		if (!signr)
+ 			break; /* will return 0 */
+@@ -2254,9 +2264,9 @@ relock:
+ 					      regs, cookie);
+ 			if (!signr)
+ 				continue;
+-		}
  
--			if (!signr)
--				break; /* will return 0 */
+-		ka = &sighand->action[signr-1];
 +			ka = &sighand->action[signr-1];
 +		}
  
--			if (signr != SIGKILL) {
--				signr = ptrace_signal(signr, info,
--						      regs, cookie);
--				if (!signr)
--					continue;
--			}
-+		if (!signr)
-+			break; /* will return 0 */
-+
-+		if (signr != SIGKILL && current->ptrace) {
-+			signr = ptrace_signal(signr, info, regs, cookie);
-+			if (!signr)
-+				continue;
- 
- 			ka = &sighand->action[signr-1];
- 		}
+ 		/* Trace actually delivered signals. */
+ 		trace_signal_deliver(signr, info, ka);
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:27 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:27 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:22 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 119589DC72;
+	Wed,  3 Aug 2011 15:12:59 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id Vxp8fnt8hEcf; Wed,  3 Aug 2011 15:12:59 -0400 (EDT)
+Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id F22049DCAE;
+	Wed,  3 Aug 2011 15:12:58 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JCpO4010401;
+	Wed, 3 Aug 2011 15:12:52 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:19 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:17 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 20/31] utrace_get_signal:
+	s/JOBCTL_STOP_PENDING/JOBCTL_PENDING_MASK/
+Message-ID: <20110803191017.GA30995 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
+Status: RO
+Content-Length: 1204
+Lines: 33
+
+utrace_get_signal() checks JOBCTL_STOP_PENDING to detect the
+case when we should not try to dequeue the signal but should
+try to participate in the group-stop.
+
+With the recent changes this is not enough, everything which
+contrbutes to recalc_sigpending_tsk() should be respected.
+
+Check JOBCTL_PENDING_MASK instead. This matches the
+JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK code in the caller,
+get_signal_to_deliver(). Note that this code won't run if
+utrace_get_signal() returns signr > 0.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ kernel/utrace.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/kernel/utrace.c b/kernel/utrace.c
+index d41b982..0bb0a06 100644
+--- a/kernel/utrace.c
++++ b/kernel/utrace.c
+@@ -2027,7 +2027,7 @@ int utrace_get_signal(struct task_struct *task, struct pt_regs *regs,
+ 		ka = NULL;
+ 		memset(return_ka, 0, sizeof *return_ka);
+ 	} else if (!(task->utrace_flags & UTRACE_EVENT_SIGNAL_ALL) ||
+-		   unlikely(task->jobctl & JOBCTL_STOP_PENDING)) {
++		   unlikely(task->jobctl & JOBCTL_PENDING_MASK)) {
+ 		/*
+ 		 * If no engine is interested in intercepting signals or
+ 		 * we must stop, let the caller just dequeue them normally
 -- 
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:18 2011
+From davej  Wed Aug  3 15:16:03 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:18 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:03 -0400 (EDT)
 Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
  zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:39 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:13:19 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 74BDFD813B;
-	Thu, 30 Jun 2011 20:23:39 -0400 (EDT)
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A9253DA3CB;
+	Wed,  3 Aug 2011 15:13:01 -0400 (EDT)
 Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id tAGkG+GCPdeN; Thu, 30 Jun 2011 20:23:39 -0400 (EDT)
-Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5B728D812A;
-	Thu, 30 Jun 2011 20:23:39 -0400 (EDT)
+	with ESMTP id HLlRhTJ2MbYS; Wed,  3 Aug 2011 15:13:01 -0400 (EDT)
+Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 9582C4C43B;
+	Wed,  3 Aug 2011 15:13:01 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610NWY1032629;
-	Thu, 30 Jun 2011 20:23:32 -0400
+	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCsFX008586;
+	Wed, 3 Aug 2011 15:12:54 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:39 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:37 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:22 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:20 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 13/19] introduce ptrace_set_syscall_trace()
-Message-ID: <20110701002137.GA25837 at redhat.com>
+Subject: [PATCH 21/31] introduce ptrace_set_syscall_trace()
+Message-ID: <20110803191020.GA31002 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
 Status: RO
-Content-Length: 1581
+Content-Length: 1549
 Lines: 52
 
 No functional changes. Add the new helper, ptrace_set_syscall_trace(),
@@ -5472,10 +6176,10 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  1 files changed, 10 insertions(+), 5 deletions(-)
 
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index 0b2aba5..b6fd922 100644
+index 1a50090..dc2ad34 100644
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
-@@ -37,6 +37,14 @@ static void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
+@@ -38,6 +38,14 @@ void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
  		kick_process(p);
  }
  
@@ -5487,10 +6191,10 @@ index 0b2aba5..b6fd922 100644
 +		clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
 +}
 +
- /*
-  * ptrace a task: make the debugger its new parent and
-  * move it to the ptrace list.
-@@ -364,7 +372,7 @@ static int ptrace_detach(struct task_struct *child, unsigned int data)
+ static int ptrace_trapping_sleep_fn(void *flags)
+ {
+ 	schedule();
+@@ -418,7 +426,7 @@ static int ptrace_detach(struct task_struct *child, unsigned int data)
  
  	/* Architecture-specific hardware disable .. */
  	ptrace_disable(child);
@@ -5499,7 +6203,7 @@ index 0b2aba5..b6fd922 100644
  
  	write_lock_irq(&tasklist_lock);
  	/*
-@@ -551,10 +559,7 @@ static int ptrace_resume(struct task_struct *child, long request,
+@@ -606,10 +614,7 @@ static int ptrace_resume(struct task_struct *child, long request,
  	if (!valid_signal(data))
  		return -EIO;
  
@@ -5515,48 +6219,49 @@ index 0b2aba5..b6fd922 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:20 2011
+From davej  Wed Aug  3 15:21:45 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:20 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:21:45 -0400 (EDT)
 Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
  zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:42 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:43 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id CFC3F9C0C5;
-	Thu, 30 Jun 2011 20:23:42 -0400 (EDT)
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5C4889DEE6;
+	Wed,  3 Aug 2011 15:13:04 -0400 (EDT)
 Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id vS4KlM5ek+bt; Thu, 30 Jun 2011 20:23:42 -0400 (EDT)
-Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B28CA9C0C3;
-	Thu, 30 Jun 2011 20:23:42 -0400 (EDT)
+	with ESMTP id eXIPU4nVv+7Z; Wed,  3 Aug 2011 15:13:04 -0400 (EDT)
+Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 3F82C9DED6;
+	Wed,  3 Aug 2011 15:13:04 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610NZvo015255;
-	Thu, 30 Jun 2011 20:23:35 -0400
+	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCueo029507;
+	Wed, 3 Aug 2011 15:12:57 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:43 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:40 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:24 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:22 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 14/19] introduce PT_SYSCALL_TRACE flag
-Message-ID: <20110701002140.GA25844 at redhat.com>
+Subject: [PATCH 22/31] introduce PT_SYSCALL_TRACE flag
+Message-ID: <20110803191022.GA31005 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
 Status: RO
-Content-Length: 2236
+Content-Length: 2268
 Lines: 73
 
 Currently tracehooks assume that if the ptraced task has
@@ -5576,33 +6281,33 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  3 files changed, 9 insertions(+), 3 deletions(-)
 
 diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
-index 9178d5c..98d995d 100644
+index 6d9282a..c10f610 100644
 --- a/include/linux/ptrace.h
 +++ b/include/linux/ptrace.h
-@@ -90,6 +90,8 @@
+@@ -104,6 +104,8 @@
  
  #define PT_TRACE_MASK	0x000003f4
  
-+#define PT_SYSCALL_TRACE	0x00010000
++#define PT_SYSCALL_TRACE	0x00020000
 +
  /* single stepping state bits (used on ARM and PA-RISC) */
  #define PT_SINGLESTEP_BIT	31
  #define PT_SINGLESTEP		(1<<PT_SINGLESTEP_BIT)
-@@ -187,6 +189,7 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
- 	child->ptrace = 0;
- 	if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) {
+@@ -227,6 +229,7 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
+ 
+ 	if (unlikely(ptrace) && current->ptrace) {
  		child->ptrace = current->ptrace;
 +		child->ptrace &= ~PT_SYSCALL_TRACE;
  		__ptrace_link(child, current->parent);
- 	}
  
+ 		if (child->ptrace & PT_SEIZED)
 diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
-index 3c7b6b3..6ce7a37 100644
+index ec2af67..eb9fe30 100644
 --- a/include/linux/tracehook.h
 +++ b/include/linux/tracehook.h
-@@ -76,7 +76,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
+@@ -59,7 +59,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
  {
- 	int ptrace = task_ptrace(current);
+ 	int ptrace = current->ptrace;
  
 -	if (!(ptrace & PT_PTRACED))
 +	if (!(ptrace & PT_SYSCALL_TRACE))
@@ -5610,10 +6315,10 @@ index 3c7b6b3..6ce7a37 100644
  
  	ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index b6fd922..0825a01 100644
+index dc2ad34..7deb292 100644
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
-@@ -39,10 +39,13 @@ static void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
+@@ -40,10 +40,13 @@ void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
  
  static void ptrace_set_syscall_trace(struct task_struct *p, bool on)
  {
@@ -5628,50 +6333,51 @@ index b6fd922..0825a01 100644
 +	}
  }
  
- /*
+ static int ptrace_trapping_sleep_fn(void *flags)
 -- 
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:21 2011
+From davej  Wed Aug  3 15:16:05 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:21 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:05 -0400 (EDT)
 Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
  zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:46 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:13:20 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 35A70D812A;
-	Thu, 30 Jun 2011 20:23:46 -0400 (EDT)
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id E516ADA488;
+	Wed,  3 Aug 2011 15:13:06 -0400 (EDT)
 Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id L06hkGLA8FQs; Thu, 30 Jun 2011 20:23:46 -0400 (EDT)
+	with ESMTP id rP7Um8DZjclX; Wed,  3 Aug 2011 15:13:06 -0400 (EDT)
 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 21C2BD810F;
-	Thu, 30 Jun 2011 20:23:46 -0400 (EDT)
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id D155EDA3F8;
+	Wed,  3 Aug 2011 15:13:06 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610Nc7k007721;
-	Thu, 30 Jun 2011 20:23:39 -0400
+	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JCxfF029532;
+	Wed, 3 Aug 2011 15:13:00 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:46 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:44 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:27 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:25 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 15/19] utrace: don't clear TIF_SYSCALL_TRACE if it is
+Subject: [PATCH 23/31] utrace: don't clear TIF_SYSCALL_TRACE if it is
 	needed by ptrace
-Message-ID: <20110701002144.GA25847 at redhat.com>
+Message-ID: <20110803191025.GA31012 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
 Status: RO
@@ -5688,7 +6394,7 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/kernel/utrace.c b/kernel/utrace.c
-index daa96b9..a824ac3 100644
+index 0bb0a06..bebf6de 100644
 --- a/kernel/utrace.c
 +++ b/kernel/utrace.c
 @@ -697,6 +697,7 @@ static bool utrace_reset(struct task_struct *task, struct utrace *utrace)
@@ -5703,46 +6409,47 @@ index daa96b9..a824ac3 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:22 2011
+From davej  Wed Aug  3 15:16:08 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:22 -0400 (EDT)
-Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
- zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:49 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:08 -0400 (EDT)
+Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
+ zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:15:29 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 72E0C9C0C3;
-	Thu, 30 Jun 2011 20:23:49 -0400 (EDT)
-Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id o3ezwgloxuCS; Thu, 30 Jun 2011 20:23:49 -0400 (EDT)
-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5DD6A9C0C5;
-	Thu, 30 Jun 2011 20:23:49 -0400 (EDT)
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 80872DA4B2;
+	Wed,  3 Aug 2011 15:13:09 -0400 (EDT)
+Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id AbpC0Wk1ZhtT; Wed,  3 Aug 2011 15:13:09 -0400 (EDT)
+Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 6D97DDA3F8;
+	Wed,  3 Aug 2011 15:13:09 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p610NglX026379;
-	Thu, 30 Jun 2011 20:23:42 -0400
+	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JD2RU022591;
+	Wed, 3 Aug 2011 15:13:02 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:49 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:47 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:30 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:28 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 16/19] introduce task_utrace_lock/task_utrace_unlock
-Message-ID: <20110701002147.GA25854 at redhat.com>
+Subject: [PATCH 24/31] introduce task_utrace_lock/task_utrace_unlock
+Message-ID: <20110803191028.GA31015 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
 Status: RO
 Content-Length: 2190
 Lines: 81
@@ -5762,10 +6469,10 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  2 files changed, 35 insertions(+), 0 deletions(-)
 
 diff --git a/include/linux/utrace.h b/include/linux/utrace.h
-index f251efe..5176f5f 100644
+index 63103e2..f37373b 100644
 --- a/include/linux/utrace.h
 +++ b/include/linux/utrace.h
-@@ -109,6 +109,12 @@ void utrace_signal_handler(struct task_struct *, int);
+@@ -117,6 +117,12 @@ void utrace_signal_handler(struct task_struct *, int);
  
  #ifndef CONFIG_UTRACE
  
@@ -5778,7 +6485,7 @@ index f251efe..5176f5f 100644
  /*
   * <linux/tracehook.h> uses these accessors to avoid #ifdef CONFIG_UTRACE.
   */
-@@ -131,6 +137,9 @@ static inline void task_utrace_proc_status(struct seq_file *m,
+@@ -139,6 +145,9 @@ static inline void task_utrace_proc_status(struct seq_file *m,
  
  #else  /* CONFIG_UTRACE */
  
@@ -5789,7 +6496,7 @@ index f251efe..5176f5f 100644
  {
  	return task->utrace_flags;
 diff --git a/kernel/utrace.c b/kernel/utrace.c
-index a824ac3..508c13c 100644
+index bebf6de..960dd9e 100644
 --- a/kernel/utrace.c
 +++ b/kernel/utrace.c
 @@ -79,6 +79,32 @@ static int __init utrace_init(void)
@@ -5829,49 +6536,50 @@ index a824ac3..508c13c 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:24 2011
+From davej  Wed Aug  3 15:21:46 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:24 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:52 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:21:46 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:43 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id DB8D8D812A;
-	Thu, 30 Jun 2011 20:23:52 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id 74TDLZXBCl6s; Thu, 30 Jun 2011 20:23:52 -0400 (EDT)
-Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id C6776D810F;
-	Thu, 30 Jun 2011 20:23:52 -0400 (EDT)
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 24B3E9DEF6;
+	Wed,  3 Aug 2011 15:13:12 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id 2jg9j3-p4bHL; Wed,  3 Aug 2011 15:13:12 -0400 (EDT)
+Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 119759DEF9;
+	Wed,  3 Aug 2011 15:13:12 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610NjAl015271;
-	Thu, 30 Jun 2011 20:23:45 -0400
+	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JD485022603;
+	Wed, 3 Aug 2011 15:13:05 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:53 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:50 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:32 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:30 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 17/19] teach ptrace_set_syscall_trace() to play well with
+Subject: [PATCH 25/31] teach ptrace_set_syscall_trace() to play well with
 	utrace
-Message-ID: <20110701002150.GA25861 at redhat.com>
+Message-ID: <20110803191030.GA31018 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
 Status: RO
-Content-Length: 1513
+Content-Length: 1545
 Lines: 49
 
 1. ptrace_set_syscall_trace(true)->set_tsk_thread_flag(TIF_SYSCALL_TRACE)
@@ -5891,18 +6599,18 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  1 files changed, 5 insertions(+), 1 deletions(-)
 
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index 0825a01..209ea2d 100644
+index 7deb292..69850e9 100644
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
-@@ -23,6 +23,7 @@
- #include <linux/uaccess.h>
+@@ -24,6 +24,7 @@
  #include <linux/regset.h>
  #include <linux/hw_breakpoint.h>
+ #include <linux/cn_proc.h>
 +#include <linux/utrace.h>
  
- static void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
+ void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
  {
-@@ -39,13 +40,16 @@ static void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
+@@ -40,13 +41,16 @@ void ptrace_signal_wake_up(struct task_struct *p, int quiescent)
  
  static void ptrace_set_syscall_trace(struct task_struct *p, bool on)
  {
@@ -5919,53 +6627,54 @@ index 0825a01..209ea2d 100644
 +	task_utrace_unlock(p);
  }
  
- /*
+ static int ptrace_trapping_sleep_fn(void *flags)
 -- 
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:24 2011
+From davej  Wed Aug  3 15:16:29 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:24 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:28 -0400 (EDT)
 Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
  zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:56 -0400 (EDT)
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:24 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 6CD231287F3;
-	Thu, 30 Jun 2011 20:23:56 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 062709DE55;
+	Wed,  3 Aug 2011 15:13:15 -0400 (EDT)
 Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
 	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id XX9YNcTcP1Ny; Thu, 30 Jun 2011 20:23:56 -0400 (EDT)
-Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
-	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 504BF1287DD;
-	Thu, 30 Jun 2011 20:23:56 -0400 (EDT)
+	with ESMTP id lhwVoEywGaPJ; Wed,  3 Aug 2011 15:13:14 -0400 (EDT)
+Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id E4C139DE11;
+	Wed,  3 Aug 2011 15:13:14 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p610NmjB032686;
-	Thu, 30 Jun 2011 20:23:49 -0400
+	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JD7Go010523;
+	Wed, 3 Aug 2011 15:13:08 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:56 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:54 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:35 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:33 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 18/19] introduce PT_SINGLE_STEP and PT_SINGLE_BLOCK
-Message-ID: <20110701002154.GA25864 at redhat.com>
+Subject: [PATCH 26/31] introduce PT_SINGLE_STEP and PT_SINGLE_BLOCK
+Message-ID: <20110803191033.GA31025 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
 Status: RO
-Content-Length: 3725
+Content-Length: 3723
 Lines: 108
 
 Add the new internal ptrace flags, PT_SINGLE_STEP and PT_SINGLE_BLOCK.
@@ -5986,10 +6695,10 @@ Signed-off-by: Oleg Nesterov <oleg at redhat.com>
  4 files changed, 13 insertions(+), 3 deletions(-)
 
 diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
-index 807c2a2..7ab475f 100644
+index 8252879..d1557dc 100644
 --- a/arch/x86/kernel/ptrace.c
 +++ b/arch/x86/kernel/ptrace.c
-@@ -807,6 +807,7 @@ static int ioperm_get(struct task_struct *target,
+@@ -808,6 +808,7 @@ static int ioperm_get(struct task_struct *target,
   */
  void ptrace_disable(struct task_struct *child)
  {
@@ -5998,33 +6707,33 @@ index 807c2a2..7ab475f 100644
  #ifdef TIF_SYSCALL_EMU
  	clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
 diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
-index 98d995d..65b1e4f 100644
+index c10f610..2743315 100644
 --- a/include/linux/ptrace.h
 +++ b/include/linux/ptrace.h
-@@ -91,6 +91,8 @@
+@@ -105,6 +105,8 @@
  #define PT_TRACE_MASK	0x000003f4
  
- #define PT_SYSCALL_TRACE	0x00010000
-+#define PT_SINGLE_STEP		0x00020000
-+#define PT_SINGLE_BLOCK		0x00040000
+ #define PT_SYSCALL_TRACE	0x00020000
++#define PT_SINGLE_STEP		0x00040000
++#define PT_SINGLE_BLOCK		0x00080000
  
  /* single stepping state bits (used on ARM and PA-RISC) */
  #define PT_SINGLESTEP_BIT	31
-@@ -189,7 +191,8 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
- 	child->ptrace = 0;
- 	if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) {
+@@ -229,7 +231,8 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
+ 
+ 	if (unlikely(ptrace) && current->ptrace) {
  		child->ptrace = current->ptrace;
 -		child->ptrace &= ~PT_SYSCALL_TRACE;
 +		child->ptrace &=
 +			~(PT_SYSCALL_TRACE | PT_SINGLE_STEP | PT_SINGLE_BLOCK);
  		__ptrace_link(child, current->parent);
- 	}
  
+ 		if (child->ptrace & PT_SEIZED)
 diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
-index 6ce7a37..06edb52 100644
+index eb9fe30..21c8ca2 100644
 --- a/include/linux/tracehook.h
 +++ b/include/linux/tracehook.h
-@@ -121,6 +121,9 @@ static inline __must_check int tracehook_report_syscall_entry(
+@@ -104,6 +104,9 @@ static inline __must_check int tracehook_report_syscall_entry(
  	return 0;
  }
  
@@ -6034,7 +6743,7 @@ index 6ce7a37..06edb52 100644
  /**
   * tracehook_report_syscall_exit - task has just finished a system call
   * @regs:		user register state of current task
-@@ -143,7 +146,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
+@@ -126,7 +129,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
  	if (task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_EXIT))
  		utrace_report_syscall_exit(regs);
  
@@ -6043,7 +6752,7 @@ index 6ce7a37..06edb52 100644
  		siginfo_t info;
  		user_single_step_siginfo(current, regs, &info);
  		force_sig_info(SIGTRAP, &info, current);
-@@ -436,7 +439,7 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
+@@ -157,7 +160,7 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
  {
  	if (task_utrace_flags(current))
  		utrace_signal_handler(current, stepping);
@@ -6053,10 +6762,10 @@ index 6ce7a37..06edb52 100644
  }
  
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index 209ea2d..44908d0 100644
+index 69850e9..d250a71 100644
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
-@@ -575,13 +575,16 @@ static int ptrace_resume(struct task_struct *child, long request,
+@@ -630,13 +630,16 @@ static int ptrace_resume(struct task_struct *child, long request,
  		clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
  #endif
  
@@ -6077,85 +6786,129 @@ index 209ea2d..44908d0 100644
 1.5.5.1
 
 
-From davej  Thu Jun 30 20:27:26 2011
+From davej  Wed Aug  3 15:16:30 2011
 Return-Path: oleg at redhat.com
 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 	gelk.kernelslacker.org
 X-Spam-Level: 
 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
 	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.51]
+Received: from mail.corp.redhat.com [10.5.5.52]
 	by gelk with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Thu, 30 Jun 2011 20:27:26 -0400 (EDT)
-Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
- zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- mail04.corp.redhat.com with LMTP; Thu, 30 Jun 2011 20:23:59 -0400 (EDT)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:30 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:25 -0400 (EDT)
 Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 8FF6B9C0C5;
-	Thu, 30 Jun 2011 20:23:59 -0400 (EDT)
-Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id pNFtYrppMjXf; Thu, 30 Jun 2011 20:23:59 -0400 (EDT)
-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7C2B89C0C3;
-	Thu, 30 Jun 2011 20:23:59 -0400 (EDT)
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B3BF49DE11;
+	Wed,  3 Aug 2011 15:13:17 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id zC72ecV9Jz07; Wed,  3 Aug 2011 15:13:17 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 98ACE9DE59;
+	Wed,  3 Aug 2011 15:13:17 -0400 (EDT)
 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
-	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p610Nqpd026408;
-	Thu, 30 Jun 2011 20:23:52 -0400
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JDATh023726;
+	Wed, 3 Aug 2011 15:13:10 -0400
 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
-	oleg at redhat.com; Fri,  1 Jul 2011 02:21:59 +0200 (CEST)
-Date: Fri, 1 Jul 2011 02:21:57 +0200
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:38 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:36 +0200
 From: Oleg Nesterov <oleg at redhat.com>
-To: "Frank Ch. Eigler" <fche at redhat.com>, Kyle McMartin <kmcmartin at redhat.com>,
-        Dave Jones <davej at redhat.com>, Josh Stone <jistone at redhat.com>,
-        Matthew Garrett <mjg at redhat.com>, David Smith <dsmith at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
 Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
-Subject: [PATCH 19/19] utrace: consult PT_SINGLE_STEP/PT_SINGLE_BLOCK
-	before user_disable_single_step()
-Message-ID: <20110701002157.GA25871 at redhat.com>
+Subject: [PATCH 27/31] utrace: finish_resume_report: don't do
+	user_xxx_step() if ptrace_wants_step()
+Message-ID: <20110803191036.GA31028 at redhat.com>
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
 User-Agent: Mutt/1.5.18 (2008-05-17)
-X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
 Status: RO
-Content-Length: 1150
-Lines: 41
-
-- do not do user_enable_block_step() if PT_SINGLE_STEP is set, in this
-  case ptrace has already called user_enable_single_step()
+Content-Length: 2741
+Lines: 84
 
-- do not do user_disable_single_step() if PT_*_STEP is set, ptrace needs
-  the stepping
+finish_resume_report() should not enable/disable the stepping if
+ptrace_wants_step() == T. If ptrace wants block_step while utrace
+wants single_step we could "promote" the stepping, but I do not
+think this really makes sense.
 
-Unless the tracee is killed this can't race with ptrace, this is called
-by the tracee itself.
+Unless the tracee is killed this can't race with ptrace, this is
+called by the tracee itself. If it is killed we do not care.
 
 Signed-off-by: Oleg Nesterov <oleg at redhat.com>
 ---
- kernel/utrace.c |    6 ++++--
- 1 files changed, 4 insertions(+), 2 deletions(-)
+ include/linux/tracehook.h |    8 ++++----
+ kernel/utrace.c           |    9 ++++++---
+ 2 files changed, 10 insertions(+), 7 deletions(-)
 
+diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
+index 21c8ca2..b6812d4 100644
+--- a/include/linux/tracehook.h
++++ b/include/linux/tracehook.h
+@@ -104,8 +104,8 @@ static inline __must_check int tracehook_report_syscall_entry(
+ 	return 0;
+ }
+ 
+-#define ptrace_wants_step()	\
+-	(current->ptrace & (PT_SINGLE_STEP | PT_SINGLE_BLOCK))
++#define ptrace_wants_step(task)	\
++	((task)->ptrace & (PT_SINGLE_STEP | PT_SINGLE_BLOCK))
+ 
+ /**
+  * tracehook_report_syscall_exit - task has just finished a system call
+@@ -129,7 +129,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
+ 	if (task_utrace_flags(current) & UTRACE_EVENT(SYSCALL_EXIT))
+ 		utrace_report_syscall_exit(regs);
+ 
+-	if (step && ptrace_wants_step()) {
++	if (step && ptrace_wants_step(current)) {
+ 		siginfo_t info;
+ 		user_single_step_siginfo(current, regs, &info);
+ 		force_sig_info(SIGTRAP, &info, current);
+@@ -160,7 +160,7 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
+ {
+ 	if (task_utrace_flags(current))
+ 		utrace_signal_handler(current, stepping);
+-	if (stepping && ptrace_wants_step())
++	if (stepping && ptrace_wants_step(current))
+ 		ptrace_notify(SIGTRAP);
+ }
+ 
 diff --git a/kernel/utrace.c b/kernel/utrace.c
-index 508c13c..d6607cb 100644
+index 960dd9e..05e8532 100644
 --- a/kernel/utrace.c
 +++ b/kernel/utrace.c
-@@ -1828,7 +1828,8 @@ static void finish_resume_report(struct task_struct *task,
+@@ -1829,7 +1829,8 @@ static void finish_resume_report(struct task_struct *task,
  
  	case UTRACE_BLOCKSTEP:
  		if (likely(arch_has_block_step())) {
 -			user_enable_block_step(task);
-+			if (!(current->ptrace & PT_SINGLE_STEP))
++			if (!ptrace_wants_step(task))
 +				user_enable_block_step(task);
  			break;
  		}
  
-@@ -1856,7 +1857,8 @@ static void finish_resume_report(struct task_struct *task,
+@@ -1842,7 +1843,8 @@ static void finish_resume_report(struct task_struct *task,
+ 
+ 	case UTRACE_SINGLESTEP:
+ 		if (likely(arch_has_single_step())) {
+-			user_enable_single_step(task);
++			if (!ptrace_wants_step(task))
++				user_enable_single_step(task);
+ 		} else {
+ 			/*
+ 			 * This means some callback is to blame for failing
+@@ -1857,7 +1859,8 @@ static void finish_resume_report(struct task_struct *task,
  	case UTRACE_REPORT:
  	case UTRACE_RESUME:
  	default:
 -		user_disable_single_step(task);
-+		if (!(current->ptrace & (PT_SINGLE_STEP | PT_SINGLE_BLOCK)))
++		if (!ptrace_wants_step(task))
 +			user_disable_single_step(task);
  		break;
  	}
@@ -6164,3 +6917,342 @@ index 508c13c..d6607cb 100644
 1.5.5.1
 
 
+From davej  Wed Aug  3 15:16:32 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:32 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:25 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 614CD9DE73;
+	Wed,  3 Aug 2011 15:13:20 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id jcWOXzUaaIYu; Wed,  3 Aug 2011 15:13:20 -0400 (EDT)
+Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 438889DE59;
+	Wed,  3 Aug 2011 15:13:20 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JDDZ7029595;
+	Wed, 3 Aug 2011 15:13:13 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:40 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:38 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 28/31] ptrace: shift user_*_step() from ptrace_resume() to
+	ptrace_stop()
+Message-ID: <20110803191038.GA31035 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
+Status: RO
+Content-Length: 2374
+Lines: 70
+
+1. ptrace_resume() plays with the stopped task which can be also
+   task_is_utraced(). In this case user_enable_xxx_step() can race
+   with utrace_reset()->user_disable_single_step().
+
+   We could change utrace_reset() to check ptrace_wants_step() and
+   add the task_utrace_lock + unlock barrier after ptrace_resume()
+   sets PT_SINGLE_STEP.
+
+   But it is better to reassign enable/desable from the tracer to
+   the tracee, it can check its PT_SINGLE_ bits after wakeup. This
+   also makes sense because enable_step(task) can be faster if
+   task == current.
+
+2. ptrace can do user_disable_single_step() while utrace needs the
+   stepping.
+
+   Set TIF_NOTIFY_RESUME after user_disable_single_step() to ensure
+   the tracee can't return to the user-space without utrace_resume().
+   Any correct engine which wants the stepping should reassert it.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ kernel/ptrace.c |    4 ----
+ kernel/signal.c |   11 +++++++++++
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/kernel/ptrace.c b/kernel/ptrace.c
+index d250a71..d1ef124 100644
+--- a/kernel/ptrace.c
++++ b/kernel/ptrace.c
+@@ -635,14 +635,10 @@ static int ptrace_resume(struct task_struct *child, long request,
+ 		if (unlikely(!arch_has_block_step()))
+ 			return -EIO;
+ 		child->ptrace |= PT_SINGLE_BLOCK;
+-		user_enable_block_step(child);
+ 	} else if (is_singlestep(request) || is_sysemu_singlestep(request)) {
+ 		if (unlikely(!arch_has_single_step()))
+ 			return -EIO;
+ 		child->ptrace |= PT_SINGLE_STEP;
+-		user_enable_single_step(child);
+-	} else {
+-		user_disable_single_step(child);
+ 	}
+ 
+ 	child->exit_code = data;
+diff --git a/kernel/signal.c b/kernel/signal.c
+index 3c783d3..43a3e77 100644
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -1920,6 +1920,17 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
+ 
+ 	utrace_end_stop();
+ 
++	if (current->ptrace & PT_SINGLE_BLOCK)
++		user_enable_block_step(current);
++	else if (current->ptrace & PT_SINGLE_STEP)
++		user_enable_single_step(current);
++	else {
++		user_disable_single_step(current);
++		/* if utrace needs the stepping it should reassert */
++		if (task_utrace_flags(current))
++			set_thread_flag(TIF_NOTIFY_RESUME);
++	}
++
+ 	/*
+ 	 * While in TASK_TRACED, we were considered "frozen enough".
+ 	 * Now that we woke up, it's crucial if we're supposed to be
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:16:34 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:16:34 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:25 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 1A6019DE59;
+	Wed,  3 Aug 2011 15:13:23 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id db2hhAqFwsPu; Wed,  3 Aug 2011 15:13:23 -0400 (EDT)
+Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
+	by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 034739DE83;
+	Wed,  3 Aug 2011 15:13:23 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JDFNp008715;
+	Wed, 3 Aug 2011 15:13:16 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:43 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:41 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 29/31] ptrace_disable: no need to disable stepping
+Message-ID: <20110803191041.GA31039 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
+Status: RO
+Content-Length: 945
+Lines: 29
+
+ptrace_disable() is called when the tracee is quiescent and we
+are going to untrace. This means we are going to clear ->ptrace
+and wake up the tracee. Now that ptrace_stop() checks PT_ bits
+and does user_disable_single_step() we can remove this code from
+ptrace_disable(), it is unneeded and not utrace-friendly.
+
+TODO: change !x86 code.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ arch/x86/kernel/ptrace.c |    2 --
+ 1 files changed, 0 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
+index d1557dc..96d315a 100644
+--- a/arch/x86/kernel/ptrace.c
++++ b/arch/x86/kernel/ptrace.c
+@@ -808,8 +808,6 @@ static int ioperm_get(struct task_struct *target,
+  */
+ void ptrace_disable(struct task_struct *child)
+ {
+-	child->ptrace &= ~(PT_SINGLE_STEP | PT_SINGLE_BLOCK);
+-	user_disable_single_step(child);
+ #ifdef TIF_SYSCALL_EMU
+ 	clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+ #endif
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:21:48 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:21:48 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:52 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 95706917AF;
+	Wed,  3 Aug 2011 15:13:25 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id ctq4DF3wXncJ; Wed,  3 Aug 2011 15:13:25 -0400 (EDT)
+Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7FD14914AF;
+	Wed,  3 Aug 2011 15:13:25 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p73JDIRO010579;
+	Wed, 3 Aug 2011 15:13:18 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:46 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:44 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 30/31] ptrace_report_syscall: check TIF_SYSCALL_EMU
+Message-ID: <20110803191044.GA31046 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
+Status: RO
+Content-Length: 858
+Lines: 28
+
+4d16a64 "introduce PT_SYSCALL_TRACE flag" breaks PTRACE_SYSEMU
+which doesn't set PT_SYSCALL_TRACE.
+
+Change ptrace_report_syscall() to check TIF_SYSCALL_EMU as well.
+This can't conflict with utrace, this flag can only be set by
+ptrace.
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ include/linux/tracehook.h |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
+index b6812d4..90ca578 100644
+--- a/include/linux/tracehook.h
++++ b/include/linux/tracehook.h
+@@ -59,7 +59,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
+ {
+ 	int ptrace = current->ptrace;
+ 
+-	if (!(ptrace & PT_SYSCALL_TRACE))
++	if (!(ptrace & PT_SYSCALL_TRACE) && !test_thread_flag(TIF_SYSCALL_EMU))
+ 		return;
+ 
+ 	ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
+-- 
+1.5.5.1
+
+
+From davej  Wed Aug  3 15:21:49 2011
+Return-Path: oleg at redhat.com
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
+	gelk.kernelslacker.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
+	UNPARSEABLE_RELAY autolearn=ham version=3.3.2
+Received: from mail.corp.redhat.com [10.5.5.52]
+	by gelk with IMAP (fetchmail-6.3.20)
+	for <davej at localhost> (single-drop); Wed, 03 Aug 2011 15:21:49 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
+ zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
+ mail04.corp.redhat.com with LMTP; Wed, 3 Aug 2011 15:16:52 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 400F49191F;
+	Wed,  3 Aug 2011 15:13:28 -0400 (EDT)
+Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+	with ESMTP id UeLOLM29JRc7; Wed,  3 Aug 2011 15:13:28 -0400 (EDT)
+Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
+	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 2D05C903F6;
+	Wed,  3 Aug 2011 15:13:28 -0400 (EDT)
+Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232])
+	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p73JDKCA023784;
+	Wed, 3 Aug 2011 15:13:21 -0400
+Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500
+	oleg at redhat.com; Wed,  3 Aug 2011 21:10:48 +0200 (CEST)
+Date: Wed, 3 Aug 2011 21:10:46 +0200
+From: Oleg Nesterov <oleg at redhat.com>
+To: Dave Jones <davej at redhat.com>, "Frank Ch. Eigler" <fche at redhat.com>,
+        Josh Boyer <jwboyer at redhat.com>, Josh Stone <jistone at redhat.com>,
+        Kyle McMartin <kmcmartin at redhat.com>
+Cc: kernel at lists.fedoraproject.org, utrace-devel at redhat.com
+Subject: [PATCH 31/31] utrace_resume: check irqs_disabled() to shut up
+	lockdep
+Message-ID: <20110803191046.GA31049 at redhat.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20110803190806.GA30619 at redhat.com>
+User-Agent: Mutt/1.5.18 (2008-05-17)
+X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
+Status: RO
+Content-Length: 823
+Lines: 26
+
+utrace_resume() enables irqs unconditionally. With the recent changes
+in lockdep.c this triggers the warning. Check irqs_disabled() before
+local_irq_enable().
+
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+---
+ kernel/utrace.c |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/kernel/utrace.c b/kernel/utrace.c
+index 05e8532..c817a46 100644
+--- a/kernel/utrace.c
++++ b/kernel/utrace.c
+@@ -1881,7 +1881,8 @@ void utrace_resume(struct task_struct *task, struct pt_regs *regs)
+ 	 * code path leads to calling into get_signal_to_deliver(), which
+ 	 * implicitly reenables them by virtue of spin_unlock_irq.
+ 	 */
+-	local_irq_enable();
++	if (irqs_disabled())	/* make trace_hardirqs_on() happy */
++		local_irq_enable();
+ 
+ 	/*
+ 	 * If this flag is still set it's because there was a signal
+-- 
+1.5.5.1
+
+


More information about the scm-commits mailing list