rpms/kernel/devel kernel.spec, 1.1048, 1.1049 linux-2.6-utrace.patch, 1.101, 1.102

Roland McGrath roland at fedoraproject.org
Wed Oct 15 05:16:16 UTC 2008


Author: roland

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31868

Modified Files:
	kernel.spec linux-2.6-utrace.patch 
Log Message:
utrace update


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1048
retrieving revision 1.1049
diff -u -r1.1048 -r1.1049
--- kernel.spec	15 Oct 2008 05:14:26 -0000	1.1048
+++ kernel.spec	15 Oct 2008 05:15:44 -0000	1.1049
@@ -1819,6 +1819,9 @@
 * Wed Oct 15 2008 Dave Airlie <airlied at redhat.com>
 - fix cantiga hopefully.
 
+* Tue Oct 14 2008 Roland McGrath <roland at redhat.com>
+- utrace update
+
 * Tue Oct 14 2008 Kyle McMartin <kyle at redhat.com>
 - nuke iwlwifi-use-dma_alloc_coherent.patch, should be fixed properly now.
 

linux-2.6-utrace.patch:

Index: linux-2.6-utrace.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace.patch,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- linux-2.6-utrace.patch	30 Sep 2008 04:49:05 -0000	1.101
+++ linux-2.6-utrace.patch	15 Oct 2008 05:15:44 -0000	1.102
@@ -7,10 +7,10 @@
  include/linux/utrace.h            |  707 ++++++++++
  init/Kconfig                      |   26 +
  kernel/Makefile                   |    1 +
- kernel/ptrace.c                   |  609 +++++++++-
+ kernel/ptrace.c                   |  612 +++++++++-
  kernel/signal.c                   |   14 +-
- kernel/utrace.c                   | 2570 +++++++++++++++++++++++++++++++++++++
- 12 files changed, 4585 insertions(+), 8 deletions(-)
+ kernel/utrace.c                   | 2586 +++++++++++++++++++++++++++++++++++++
+ 12 files changed, 4604 insertions(+), 8 deletions(-)
 
 diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
 index 1615350..92ca631 100644  
@@ -598,7 +598,7 @@
 +
 +</book>
 diff --git a/fs/proc/array.c b/fs/proc/array.c
-index 71c9be5..adc7a53 100644  
+index f4bc0e7..469903f 100644  
 --- a/fs/proc/array.c
 +++ b/fs/proc/array.c
 @@ -81,6 +81,7 @@
@@ -609,7 +609,7 @@
  
  #include <asm/pgtable.h>
  #include <asm/processor.h>
-@@ -190,6 +191,8 @@ static inline void task_state(struct seq
+@@ -185,6 +186,8 @@ static inline void task_state(struct seq
  		p->uid, p->euid, p->suid, p->fsuid,
  		p->gid, p->egid, p->sgid, p->fsgid);
  
@@ -658,10 +658,10 @@
   * ptrace_init_task - initialize ptrace state for a new child
   * @child:		new child task
 diff --git a/include/linux/sched.h b/include/linux/sched.h
-index 3d9120c..e063c78 100644  
+index c226c7b..97e3606 100644  
 --- a/include/linux/sched.h
 +++ b/include/linux/sched.h
-@@ -1196,6 +1196,11 @@ struct task_struct {
+@@ -1199,6 +1199,11 @@ struct task_struct {
  #endif
  	seccomp_t seccomp;
  
@@ -673,7 +673,7 @@
  /* Thread group tracking */
     	u32 parent_exec_id;
     	u32 self_exec_id;
-@@ -1772,6 +1777,7 @@ extern int kill_pgrp(struct pid *pid, in
+@@ -1775,6 +1780,7 @@ extern int kill_pgrp(struct pid *pid, in
  extern int kill_pid(struct pid *pid, int sig, int priv);
  extern int kill_proc_info(int, struct siginfo *, pid_t);
  extern int do_notify_parent(struct task_struct *, int);
@@ -1628,10 +1628,10 @@
 +
 +#endif	/* linux/utrace.h */
 diff --git a/init/Kconfig b/init/Kconfig
-index c11da38..9ca2a8f 100644  
+index 8a8e2d0..e52678f 100644  
 --- a/init/Kconfig
 +++ b/init/Kconfig
-@@ -898,6 +898,32 @@ config STOP_MACHINE
+@@ -888,6 +888,32 @@ config STOP_MACHINE
  	help
  	  Need stop_machine() primitive.
  
@@ -1677,7 +1677,7 @@
  obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
  obj-$(CONFIG_AUDIT_TREE) += audit_tree.o
 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
-index 356699a..67ada85 100644  
+index 356699a..29c60d1 100644  
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
 @@ -16,6 +16,7 @@
@@ -1766,7 +1766,7 @@
  /*
   * Check that we have indeed attached to the thing..
   */
-@@ -113,6 +165,461 @@ int ptrace_check_attach(struct task_stru
+@@ -113,6 +165,464 @@ int ptrace_check_attach(struct task_stru
  	return ret;
  }
  
@@ -2022,7 +2022,10 @@
 +		WARN_ON(ret);
 +		WARN_ON(!(task->ptrace & PT_VFORKING));
 +		task->ptrace &= ~PT_VFORKING;
-+		return utrace_ptrace_event(task, PTRACE_EVENT_VFORK_DONE, 0);
++		if (task->ptrace & PT_TRACE_VFORK_DONE)
++			return utrace_ptrace_event(task,
++						   PTRACE_EVENT_VFORK_DONE, 0);
++		return UTRACE_RESUME;
 +	}
 +
 +	if (task->ptrace & PT_VFORKING) {
@@ -2174,7 +2177,7 @@
 +				 struct utrace_attached_engine *engine)
 +{
 +	int ret = utrace_control(task, engine, UTRACE_DETACH);
-+	WARN_ON(ret && ret != -ESRCH);
++	WARN_ON(ret && ret != -ESRCH && ret != -EALREADY);
 +}
 +
 +/*
@@ -2228,7 +2231,7 @@
  int __ptrace_may_access(struct task_struct *task, unsigned int mode)
  {
  	/* May we inspect the given task?
-@@ -156,6 +663,7 @@ int ptrace_attach(struct task_struct *ta
+@@ -156,6 +666,7 @@ int ptrace_attach(struct task_struct *ta
  {
  	int retval;
  	unsigned long flags;
@@ -2236,7 +2239,7 @@
  
  	audit_ptrace(task);
  
-@@ -163,6 +671,13 @@ int ptrace_attach(struct task_struct *ta
+@@ -163,6 +674,13 @@ int ptrace_attach(struct task_struct *ta
  	if (same_thread_group(task, current))
  		goto out;
  
@@ -2250,7 +2253,7 @@
  repeat:
  	/*
  	 * Nasty, nasty.
-@@ -202,6 +717,11 @@ repeat:
+@@ -202,6 +720,11 @@ repeat:
  bad:
  	write_unlock_irqrestore(&tasklist_lock, flags);
  	task_unlock(task);
@@ -2262,7 +2265,7 @@
  out:
  	return retval;
  }
-@@ -221,9 +741,7 @@ int ptrace_detach(struct task_struct *ch
+@@ -221,9 +744,7 @@ int ptrace_detach(struct task_struct *ch
  	if (!valid_signal(data))
  		return -EIO;
  
@@ -2273,7 +2276,7 @@
  
  	write_lock_irq(&tasklist_lock);
  	/* protect against de_thread()->release_task() */
-@@ -309,6 +827,8 @@ static int ptrace_setoptions(struct task
+@@ -309,6 +830,8 @@ static int ptrace_setoptions(struct task
  	if (data & PTRACE_O_TRACEEXIT)
  		child->ptrace |= PT_TRACE_EXIT;
  
@@ -2282,7 +2285,7 @@
  	return (data & ~PTRACE_O_MASK) ? -EINVAL : 0;
  }
  
-@@ -367,6 +887,7 @@ static int ptrace_setsiginfo(struct task
+@@ -367,6 +890,7 @@ static int ptrace_setsiginfo(struct task
  #define is_sysemu_singlestep(request)	0
  #endif
  
@@ -2290,7 +2293,7 @@
  static int ptrace_resume(struct task_struct *child, long request, long data)
  {
  	if (!valid_signal(data))
-@@ -401,6 +922,76 @@ static int ptrace_resume(struct task_str
+@@ -401,6 +925,76 @@ static int ptrace_resume(struct task_str
  
  	return 0;
  }
@@ -2367,7 +2370,7 @@
  
  int ptrace_request(struct task_struct *child, long request,
  		   long addr, long data)
-@@ -480,6 +1071,11 @@ int ptrace_request(struct task_struct *c
+@@ -480,6 +1074,11 @@ int ptrace_request(struct task_struct *c
  int ptrace_traceme(void)
  {
  	int ret = -EPERM;
@@ -2379,7 +2382,7 @@
  
  	/*
  	 * Are we already being traced?
-@@ -513,6 +1109,9 @@ repeat:
+@@ -513,6 +1112,9 @@ repeat:
  		write_unlock_irqrestore(&tasklist_lock, flags);
  	}
  	task_unlock(current);
@@ -2444,10 +2447,10 @@
  			  struct pt_regs *regs, void *cookie)
 diff --git a/kernel/utrace.c b/kernel/utrace.c
 new file mode 100644
-index ...22640e5 100644  
+index ...ff58017 100644  
 --- /dev/null
 +++ b/kernel/utrace.c
-@@ -0,0 +1,2570 @@
+@@ -0,0 +1,2586 @@
 +/*
 + * utrace infrastructure interface for debugging user processes
 + *
@@ -2940,6 +2943,8 @@
 + */
 +static bool utrace_stop(struct task_struct *task, struct utrace *utrace)
 +{
++	bool killed;
++
 +	/*
 +	 * @utrace->stopped is the flag that says we are safely
 +	 * inside this function.  It should never be set on entry.
@@ -2997,21 +3002,31 @@
 +	 */
 +	try_to_freeze();
 +
-+	/*
-+	 * utrace_wakeup() clears @utrace->stopped before waking us up.
-+	 * We're officially awake if it's clear.
-+	 */
-+	if (likely(!utrace->stopped))
-+		return false;
++	killed = false;
++	rcu_read_lock();
++	utrace = rcu_dereference(task->utrace);
++	if (utrace) {
++		/*
++		 * utrace_wakeup() clears @utrace->stopped before waking us up.
++		 * We're officially awake if it's clear.
++		 */
++		spin_lock(&utrace->lock);
++		if (unlikely(utrace->stopped)) {
++			/*
++			 * If we're here with it still set, it must have been
++			 * signal_wake_up() instead, waking us up for a SIGKILL.
++			 */
++			spin_lock_irq(&task->sighand->siglock);
++			WARN_ON(!sigismember(&task->pending.signal, SIGKILL));
++			spin_unlock_irq(&task->sighand->siglock);
++			utrace->stopped = 0;
++			killed = true;
++		}
++		spin_unlock(&utrace->lock);
++	}
++	rcu_read_unlock();
 +
-+	/*
-+	 * If we're here with it still set, it must have been
-+	 * signal_wake_up() instead, waking us up for a SIGKILL.
-+	 */
-+	spin_lock(&utrace->lock);
-+	utrace->stopped = 0;
-+	spin_unlock(&utrace->lock);
-+	return true;
++	return killed;
 +}
 +
 +/*
@@ -3437,7 +3452,7 @@
 + * we're fully detached, reset *@action to UTRACE_RESUME.
 + *
 + * Called with @utrace->lock held, returns with it released.
-+ * Returns true if
++ * After this returns, @utrace might be freed if everything detached.
 + */
 +static void utrace_reset(struct task_struct *task, struct utrace *utrace,
 +			 enum utrace_resume_action *action)
@@ -3447,6 +3462,7 @@
 +	unsigned long flags = 0;
 +	LIST_HEAD(detached);
 +	bool wake = !action;
++	BUG_ON(wake != (task != current));
 +
 +	splice_attaching(utrace);
 +
@@ -3485,33 +3501,27 @@
 +	 */
 +	if (flags) {
 +		spin_unlock(&utrace->lock);
-+		goto done;
-+	}
-+
-+	if (action)
-+		*action = UTRACE_RESUME;
-+
-+	/*
-+	 * No more engines, clear out the utrace.  Here we can race with
-+	 * utrace_release_task().  If it gets task_lock() first, then it
-+	 * cleans up this struct for us.
-+	 */
++	} else {
++		/*
++		 * No more engines, clear out the utrace.  Here we can race
++		 * with utrace_release_task().  If it gets task_lock()
++		 * first, then it cleans up this struct for us.
++		 */
 +
-+	task_lock(task);
++		task_lock(task);
++		if (unlikely(task->utrace != utrace)) {
++			task_unlock(task);
++			spin_unlock(&utrace->lock);
++		} else {
++			rcu_assign_pointer(task->utrace, NULL);
++			task_unlock(task);
++			rcu_utrace_free(utrace);
++		}
 +
-+	if (unlikely(task->utrace != utrace)) {
-+		task_unlock(task);
-+		spin_unlock(&utrace->lock);
-+		goto done;
++		if (action)
++			*action = UTRACE_RESUME;
 +	}
 +
-+	rcu_assign_pointer(task->utrace, NULL);
-+
-+	task_unlock(task);
-+
-+	rcu_utrace_free(utrace);
-+
-+done:
 +	put_detached_list(&detached);
 +}
 +
@@ -4121,12 +4131,21 @@
 +	struct utrace *utrace = task->utrace;
 +	INIT_REPORT(report);
 +
++	/*
++	 * We don't use the REPORT() macro here, because we need
++	 * to clear utrace->u.live.cloning before finish_report().
++	 * After finish_report(), utrace can be a stale pointer
++	 * in cases when report.action is still UTRACE_RESUME.
++	 */
++	start_report(utrace);
 +	utrace->u.live.cloning = child;
 +
-+	REPORT(task, utrace, &report, UTRACE_EVENT(CLONE),
-+	       report_clone, clone_flags, child);
++	REPORT_CALLBACKS(task, utrace, &report,
++			 UTRACE_EVENT(CLONE), report_clone,
++			 report.action, engine, task, clone_flags, child);
 +
 +	utrace->u.live.cloning = NULL;
++	finish_report(&report, task, utrace);
 +
 +	/*
 +	 * For a vfork, we will go into an uninterruptible block waiting




More information about the scm-commits mailing list