rpms/kernel/devel kernel.spec, 1.925, 1.926 linux-2.6-utrace.patch, 1.94, 1.95

Roland McGrath roland at fedoraproject.org
Thu Sep 4 04:05:55 UTC 2008


Author: roland

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

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.925
retrieving revision 1.926
diff -u -r1.925 -r1.926
--- kernel.spec	4 Sep 2008 03:11:17 -0000	1.925
+++ kernel.spec	4 Sep 2008 04:05:24 -0000	1.926
@@ -1753,6 +1753,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Wed Sep  3 2008 Roland McGrath <roland at redhat.com>
+- utrace update
+
 * Wed Sep 03 2008 Chuck Ebbert <cebbert at redhat.com>
 - 2.6.27-rc5-git5
 

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.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- linux-2.6-utrace.patch	26 Aug 2008 01:55:23 -0000	1.94
+++ linux-2.6-utrace.patch	4 Sep 2008 04:05:24 -0000	1.95
@@ -4,13 +4,13 @@
  include/linux/ptrace.h            |   21 +
  include/linux/sched.h             |    6 +
  include/linux/tracehook.h         |   65 +-
- include/linux/utrace.h            |  711 +++++++++++
+ include/linux/utrace.h            |  708 +++++++++++
  init/Kconfig                      |   27 +
  kernel/Makefile                   |    1 +
- kernel/ptrace.c                   |  604 +++++++++-
+ kernel/ptrace.c                   |  605 +++++++++-
  kernel/signal.c                   |   14 +-
- kernel/utrace.c                   | 2511 +++++++++++++++++++++++++++++++++++++
- 12 files changed, 4523 insertions(+), 8 deletions(-)
+ kernel/utrace.c                   | 2516 +++++++++++++++++++++++++++++++++++++
+ 12 files changed, 4526 insertions(+), 8 deletions(-)
 
 diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
 index 1615350..92ca631 100644  
@@ -27,7 +27,7 @@
  	    gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
 diff --git a/Documentation/DocBook/utrace.tmpl b/Documentation/DocBook/utrace.tmpl
 new file mode 100644
-index ...396a00d 100644  
+index ...1c37104 100644  
 --- /dev/null
 +++ b/Documentation/DocBook/utrace.tmpl
 @@ -0,0 +1,566 @@
@@ -413,7 +413,7 @@
 +    <function>utrace_set_events</function> call (these do not block), you can
 +    call <function>utrace_barrier</function> to block until callbacks have
 +    finished.  This returns <constant>-ESRCH</constant> only if the engine is
-+    completely detached (finished all callbacks).  Otherwise returns it waits
++    completely detached (finished all callbacks).  Otherwise it waits
 +    until the thread is definitely not in the midst of a callback to this
 +    engine and then returns zero, but can return
 +    <constant>-ERESTARTSYS</constant> if its wait is interrupted.
@@ -906,10 +906,10 @@
  
 diff --git a/include/linux/utrace.h b/include/linux/utrace.h
 new file mode 100644
-index ...1509012 100644  
+index ...4dd29e9 100644  
 --- /dev/null
 +++ b/include/linux/utrace.h
-@@ -0,0 +1,711 @@
+@@ -0,0 +1,708 @@
 +/*
 + * utrace infrastructure interface for debugging user processes
 + *
@@ -950,12 +950,8 @@
 +struct linux_binprm;
 +struct pt_regs;
 +struct utrace;
-+struct utrace_engine_ops;
-+struct utrace_attached_engine;
-+struct utrace_examiner;
 +struct user_regset;
 +struct user_regset_view;
-+enum utrace_resume_action;
 +
 +/*
 + * Event bits passed to utrace_set_events().
@@ -1076,30 +1072,6 @@
 +
 +void task_utrace_proc_status(struct seq_file *m, struct task_struct *p);
 +
-+/*
-+ * These are the exported entry points for tracing engines to use.
-+ * See kernel/utrace.c for their kerneldoc comments with interface details.
-+ */
-+struct utrace_attached_engine *utrace_attach_task(
-+	struct task_struct *, int, const struct utrace_engine_ops *, void *);
-+struct utrace_attached_engine *utrace_attach_pid(
-+	struct pid *, int, const struct utrace_engine_ops *, void *);
-+int __must_check utrace_control(struct task_struct *,
-+				struct utrace_attached_engine *,
-+				enum utrace_resume_action);
-+int __must_check utrace_set_events(struct task_struct *,
-+				   struct utrace_attached_engine *,
-+				   unsigned long eventmask);
-+int __must_check utrace_barrier(struct task_struct *,
-+				struct utrace_attached_engine *);
-+int __must_check utrace_prepare_examine(struct task_struct *,
-+					struct utrace_attached_engine *,
-+					struct utrace_examiner *);
-+int __must_check utrace_finish_examine(struct task_struct *,
-+				       struct utrace_attached_engine *,
-+				       struct utrace_examiner *);
-+void __utrace_engine_release(struct kref *);
-+
 +/**
 + * enum utrace_resume_action - engine's choice of action for a traced task
 + * @UTRACE_STOP:		Stay quiescent after callbacks.
@@ -1262,6 +1234,8 @@
 +	kref_get(&engine->kref);
 +}
 +
++void __utrace_engine_release(struct kref *);
++
 +/**
 + * utrace_engine_put - release a reference on a &struct utrace_attached_engine
 + * @engine:	&struct utrace_attached_engine pointer
@@ -1552,6 +1526,29 @@
 +	struct {} dummy;
 +};
 +
++/*
++ * These are the exported entry points for tracing engines to use.
++ * See kernel/utrace.c for their kerneldoc comments with interface details.
++ */
++struct utrace_attached_engine *utrace_attach_task(
++	struct task_struct *, int, const struct utrace_engine_ops *, void *);
++struct utrace_attached_engine *utrace_attach_pid(
++	struct pid *, int, const struct utrace_engine_ops *, void *);
++int __must_check utrace_control(struct task_struct *,
++				struct utrace_attached_engine *,
++				enum utrace_resume_action);
++int __must_check utrace_set_events(struct task_struct *,
++				   struct utrace_attached_engine *,
++				   unsigned long eventmask);
++int __must_check utrace_barrier(struct task_struct *,
++				struct utrace_attached_engine *);
++int __must_check utrace_prepare_examine(struct task_struct *,
++					struct utrace_attached_engine *,
++					struct utrace_examiner *);
++int __must_check utrace_finish_examine(struct task_struct *,
++				       struct utrace_attached_engine *,
++				       struct utrace_examiner *);
++
 +/**
 + * utrace_control_pid - control a thread being traced by a tracing engine
 + * @pid:		thread to affect
@@ -1672,7 +1669,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..9734661 100644  
+index 356699a..355297b 100644  
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
 @@ -16,6 +16,7 @@
@@ -1691,7 +1688,7 @@
  /*
   * Turn a tracing stop into a normal stop now, since with no tracer there
   * would be no way to wake it up with SIGCONT or SIGKILL.  If there was a
-@@ -58,6 +60,54 @@ void ptrace_untrace(struct task_struct *
+@@ -58,6 +60,55 @@ void ptrace_untrace(struct task_struct *
  	spin_unlock(&child->sighand->siglock);
  }
  
@@ -1723,7 +1720,8 @@
 +				    &ptrace_utrace_ops, NULL);
 +	if (likely(!IS_ERR(engine))) {
 +		int ret = utrace_control(child, engine, UTRACE_DETACH);
-+		WARN_ON(ret && ret != -ESRCH);
++		WARN_ON(ret && ret != -EINPROGRESS &&
++			ret != -ESRCH && ret != -EALREADY);
 +		utrace_engine_put(engine);
 +	}
 +}
@@ -1746,7 +1744,7 @@
  /*
   * unptrace a task: move it back to its original parent and
   * remove it from the ptrace list.
-@@ -72,10 +122,11 @@ void __ptrace_unlink(struct task_struct 
+@@ -72,10 +123,11 @@ void __ptrace_unlink(struct task_struct 
  	child->parent = child->real_parent;
  	list_del_init(&child->ptrace_entry);
  
@@ -1760,7 +1758,7 @@
  /*
   * Check that we have indeed attached to the thing..
   */
-@@ -113,6 +164,457 @@ int ptrace_check_attach(struct task_stru
+@@ -113,6 +165,457 @@ int ptrace_check_attach(struct task_stru
  	return ret;
  }
  
@@ -2218,7 +2216,7 @@
  int __ptrace_may_access(struct task_struct *task, unsigned int mode)
  {
  	/* May we inspect the given task?
-@@ -156,6 +658,7 @@ int ptrace_attach(struct task_struct *ta
+@@ -156,6 +659,7 @@ int ptrace_attach(struct task_struct *ta
  {
  	int retval;
  	unsigned long flags;
@@ -2226,7 +2224,7 @@
  
  	audit_ptrace(task);
  
-@@ -163,6 +666,13 @@ int ptrace_attach(struct task_struct *ta
+@@ -163,6 +667,13 @@ int ptrace_attach(struct task_struct *ta
  	if (same_thread_group(task, current))
  		goto out;
  
@@ -2240,7 +2238,7 @@
  repeat:
  	/*
  	 * Nasty, nasty.
-@@ -202,6 +712,11 @@ repeat:
+@@ -202,6 +713,11 @@ repeat:
  bad:
  	write_unlock_irqrestore(&tasklist_lock, flags);
  	task_unlock(task);
@@ -2252,7 +2250,7 @@
  out:
  	return retval;
  }
-@@ -221,9 +736,7 @@ int ptrace_detach(struct task_struct *ch
+@@ -221,9 +737,7 @@ int ptrace_detach(struct task_struct *ch
  	if (!valid_signal(data))
  		return -EIO;
  
@@ -2263,7 +2261,7 @@
  
  	write_lock_irq(&tasklist_lock);
  	/* protect against de_thread()->release_task() */
-@@ -309,6 +822,8 @@ static int ptrace_setoptions(struct task
+@@ -309,6 +823,8 @@ static int ptrace_setoptions(struct task
  	if (data & PTRACE_O_TRACEEXIT)
  		child->ptrace |= PT_TRACE_EXIT;
  
@@ -2272,7 +2270,7 @@
  	return (data & ~PTRACE_O_MASK) ? -EINVAL : 0;
  }
  
-@@ -367,6 +882,7 @@ static int ptrace_setsiginfo(struct task
+@@ -367,6 +883,7 @@ static int ptrace_setsiginfo(struct task
  #define is_sysemu_singlestep(request)	0
  #endif
  
@@ -2280,7 +2278,7 @@
  static int ptrace_resume(struct task_struct *child, long request, long data)
  {
  	if (!valid_signal(data))
-@@ -401,6 +917,76 @@ static int ptrace_resume(struct task_str
+@@ -401,6 +918,76 @@ static int ptrace_resume(struct task_str
  
  	return 0;
  }
@@ -2357,7 +2355,7 @@
  
  int ptrace_request(struct task_struct *child, long request,
  		   long addr, long data)
-@@ -480,6 +1066,11 @@ int ptrace_request(struct task_struct *c
+@@ -480,6 +1067,11 @@ int ptrace_request(struct task_struct *c
  int ptrace_traceme(void)
  {
  	int ret = -EPERM;
@@ -2369,7 +2367,7 @@
  
  	/*
  	 * Are we already being traced?
-@@ -513,6 +1104,9 @@ repeat:
+@@ -513,6 +1105,9 @@ repeat:
  		write_unlock_irqrestore(&tasklist_lock, flags);
  	}
  	task_unlock(current);
@@ -2434,10 +2432,10 @@
  			  struct pt_regs *regs, void *cookie)
 diff --git a/kernel/utrace.c b/kernel/utrace.c
 new file mode 100644
-index ...aad2181 100644  
+index ...5ef8fcd 100644  
 --- /dev/null
 +++ b/kernel/utrace.c
-@@ -0,0 +1,2511 @@
+@@ -0,0 +1,2516 @@
 +/*
 + * utrace infrastructure interface for debugging user processes
 + *
@@ -2540,7 +2538,7 @@
 +	utrace_engine_cachep = KMEM_CACHE(utrace_attached_engine, SLAB_PANIC);
 +	return 0;
 +}
-+subsys_initcall(utrace_init);
++module_init(utrace_init);
 +
 +
 +/*
@@ -2635,7 +2633,6 @@
 +{
 +	CHECK_DEAD(utrace);
 +	spin_unlock(&utrace->lock);
-+	INIT_RCU_HEAD(&utrace->u.dead);
 +	call_rcu(&utrace->u.dead, utrace_free);
 +}
 +
@@ -2923,8 +2920,8 @@
 +	spin_lock_irq(&task->sighand->siglock);
 +
 +	if (unlikely(sigismember(&task->pending.signal, SIGKILL))) {
-+		spin_unlock(&utrace->lock);
 +		spin_unlock_irq(&task->sighand->siglock);
++		spin_unlock(&utrace->lock);
 +		return true;
 +	}
 +
@@ -3291,7 +3288,7 @@
 +		set_tsk_thread_flag(target, TIF_SYSCALL_TRACE);
 +
 +	ret = 0;
-+	if (!utrace->stopped) {
++	if (!utrace->stopped && target != current) {
 +		smp_mb();
 +		if (utrace->reporting == engine)
 +			ret = -EINPROGRESS;
@@ -3400,18 +3397,21 @@
 + * some stale bits in @task->utrace_flags.  Clean them up and recompute the
 + * flags.
 + *
-+ * @wake is false when @task is current.  @wake is true when @task is
-+ * stopped and @utrace->stopped is set; wake it up if it should not be.
++ * @action is NULL when @task is stopped and @utrace->stopped is set; wake
++ * it up if it should not be.  @action is set when @task is current; if
++ * we're fully detached, reset *@action to UTRACE_RESUME.
 + *
 + * Called with @utrace->lock held, returns with it released.
++ * Returns true if
 + */
 +static void utrace_reset(struct task_struct *task, struct utrace *utrace,
-+			 bool wake)
++			 enum utrace_resume_action *action)
 +	__releases(utrace->lock)
 +{
 +	struct utrace_attached_engine *engine, *next;
 +	unsigned long flags = 0;
 +	LIST_HEAD(detached);
++	bool wake = !action;
 +
 +	splice_attaching(utrace);
 +
@@ -3453,6 +3453,9 @@
 +		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
@@ -3753,7 +3756,7 @@
 +	 * there is nothing more we need to do.
 +	 */
 +	if (resume)
-+		utrace_reset(target, utrace, true);
++		utrace_reset(target, utrace, NULL);
 +	else
 +		spin_unlock(&utrace->lock);
 +
@@ -3868,7 +3871,7 @@
 +	if (clean)
 +		spin_unlock(&utrace->lock);
 +	else
-+		utrace_reset(task, utrace, false);
++		utrace_reset(task, utrace, &report->action);
 +}
 +
 +/*
@@ -4227,7 +4230,7 @@
 +		 */
 +		utrace_reap(task, utrace);
 +	else
-+		utrace_reset(task, utrace, false);
++		utrace_reset(task, utrace, &report.action);
 +}
 +
 +/*
@@ -4243,7 +4246,7 @@
 +{
 +	if (report->detaches || !report->takers) {
 +		spin_lock(&utrace->lock);
-+		utrace_reset(task, utrace, false);
++		utrace_reset(task, utrace, &report->action);
 +	}
 +
 +	switch (report->action) {




More information about the fedora-extras-commits mailing list