rpms/kernel/devel kernel.spec, 1.993, 1.994 linux-2.6-utrace.patch, 1.99, 1.100

Roland McGrath roland at fedoraproject.org
Tue Sep 30 03:55:05 UTC 2008


Author: roland

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

Modified Files:
	kernel.spec linux-2.6-utrace.patch 
Log Message:
utrace update: fix CLONE_PTRACE (#461552)


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.993
retrieving revision 1.994
diff -u -r1.993 -r1.994
--- kernel.spec	30 Sep 2008 03:24:30 -0000	1.993
+++ kernel.spec	30 Sep 2008 03:54:35 -0000	1.994
@@ -1741,6 +1741,7 @@
 %changelog
 * Mon Sep 29 2008 Roland McGrath <roland at redhat.com>
 - 2.6.27-rc8
+- utrace update: fix CLONE_PTRACE (#461552)
 
 * Mon Sep 29 2008 Dave Jones <davej at redhat.com>
 - Turn off CONFIG_USB_DEBUG. It's noisy, and of no real value right 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.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- linux-2.6-utrace.patch	30 Sep 2008 03:24:30 -0000	1.99
+++ linux-2.6-utrace.patch	30 Sep 2008 03:54:35 -0000	1.100
@@ -7,10 +7,10 @@
  include/linux/utrace.h            |  705 ++++++++++
  init/Kconfig                      |   26 +
  kernel/Makefile                   |    1 +
- kernel/ptrace.c                   |  605 +++++++++-
+ kernel/ptrace.c                   |  609 +++++++++-
  kernel/signal.c                   |   14 +-
  kernel/utrace.c                   | 2538 +++++++++++++++++++++++++++++++++++++
- 12 files changed, 4544 insertions(+), 8 deletions(-)
+ 12 files changed, 4548 insertions(+), 8 deletions(-)
 
 diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
 index 1615350..92ca631 100644  
@@ -1665,7 +1665,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..355297b 100644  
+index 356699a..67ada85 100644  
 --- a/kernel/ptrace.c
 +++ b/kernel/ptrace.c
 @@ -16,6 +16,7 @@
@@ -1754,7 +1754,7 @@
  /*
   * Check that we have indeed attached to the thing..
   */
-@@ -113,6 +165,457 @@ int ptrace_check_attach(struct task_stru
+@@ -113,6 +165,461 @@ int ptrace_check_attach(struct task_stru
  	return ret;
  }
  
@@ -1940,30 +1940,34 @@
 +		event = PTRACE_EVENT_FORK;
 +	}
 +
-+	if (!event)
-+		return UTRACE_RESUME;
-+
 +	/*
 +	 * Any of these reports implies auto-attaching the new child.
++	 * So does CLONE_PTRACE, even with no event to report.
 +	 */
-+	child_engine = utrace_attach_task(child, UTRACE_ATTACH_CREATE |
-+					  UTRACE_ATTACH_EXCLUSIVE |
-+					  UTRACE_ATTACH_MATCH_OPS,
-+					  &ptrace_utrace_ops, NULL);
-+	if (unlikely(IS_ERR(child_engine))) {
-+		WARN_ON(1);	/* XXX */
-+	} else {
-+		/* XXX already set by old ptrace code
-+		task_lock(child);
-+		child->ptrace = parent->ptrace;
-+		child->parent = parent->parent;
-+		task_unlock(child);
-+		*/
-+		ptrace_update_utrace(child, child_engine);
-+		utrace_engine_put(child_engine);
++	if (event || (clone_flags & CLONE_PTRACE)) {
++		child_engine = utrace_attach_task(child, UTRACE_ATTACH_CREATE |
++						  UTRACE_ATTACH_EXCLUSIVE |
++						  UTRACE_ATTACH_MATCH_OPS,
++						  &ptrace_utrace_ops, NULL);
++		if (unlikely(IS_ERR(child_engine))) {
++			WARN_ON(1);	/* XXX */
++		} else {
++			BUG_ON(!child->ptrace);
++			/* XXX already set by old ptrace code
++			   task_lock(child);
++			   child->ptrace = parent->ptrace;
++			   child->parent = parent->parent;
++			   task_unlock(child);
++			*/
++			ptrace_update_utrace(child, child_engine);
++			utrace_engine_put(child_engine);
++		}
 +	}
 +
-+	return utrace_ptrace_event(parent, event, child->pid);
++	if (event)
++		return utrace_ptrace_event(parent, event, child->pid);
++
++	return UTRACE_RESUME;
 +}
 +
 +
@@ -2212,7 +2216,7 @@
  int __ptrace_may_access(struct task_struct *task, unsigned int mode)
  {
  	/* May we inspect the given task?
-@@ -156,6 +659,7 @@ int ptrace_attach(struct task_struct *ta
+@@ -156,6 +663,7 @@ int ptrace_attach(struct task_struct *ta
  {
  	int retval;
  	unsigned long flags;
@@ -2220,7 +2224,7 @@
  
  	audit_ptrace(task);
  
-@@ -163,6 +667,13 @@ int ptrace_attach(struct task_struct *ta
+@@ -163,6 +671,13 @@ int ptrace_attach(struct task_struct *ta
  	if (same_thread_group(task, current))
  		goto out;
  
@@ -2234,7 +2238,7 @@
  repeat:
  	/*
  	 * Nasty, nasty.
-@@ -202,6 +713,11 @@ repeat:
+@@ -202,6 +717,11 @@ repeat:
  bad:
  	write_unlock_irqrestore(&tasklist_lock, flags);
  	task_unlock(task);
@@ -2246,7 +2250,7 @@
  out:
  	return retval;
  }
-@@ -221,9 +737,7 @@ int ptrace_detach(struct task_struct *ch
+@@ -221,9 +741,7 @@ int ptrace_detach(struct task_struct *ch
  	if (!valid_signal(data))
  		return -EIO;
  
@@ -2257,7 +2261,7 @@
  
  	write_lock_irq(&tasklist_lock);
  	/* protect against de_thread()->release_task() */
-@@ -309,6 +823,8 @@ static int ptrace_setoptions(struct task
+@@ -309,6 +827,8 @@ static int ptrace_setoptions(struct task
  	if (data & PTRACE_O_TRACEEXIT)
  		child->ptrace |= PT_TRACE_EXIT;
  
@@ -2266,7 +2270,7 @@
  	return (data & ~PTRACE_O_MASK) ? -EINVAL : 0;
  }
  
-@@ -367,6 +883,7 @@ static int ptrace_setsiginfo(struct task
+@@ -367,6 +887,7 @@ static int ptrace_setsiginfo(struct task
  #define is_sysemu_singlestep(request)	0
  #endif
  
@@ -2274,7 +2278,7 @@
  static int ptrace_resume(struct task_struct *child, long request, long data)
  {
  	if (!valid_signal(data))
-@@ -401,6 +918,76 @@ static int ptrace_resume(struct task_str
+@@ -401,6 +922,76 @@ static int ptrace_resume(struct task_str
  
  	return 0;
  }
@@ -2351,7 +2355,7 @@
  
  int ptrace_request(struct task_struct *child, long request,
  		   long addr, long data)
-@@ -480,6 +1067,11 @@ int ptrace_request(struct task_struct *c
+@@ -480,6 +1071,11 @@ int ptrace_request(struct task_struct *c
  int ptrace_traceme(void)
  {
  	int ret = -EPERM;
@@ -2363,7 +2367,7 @@
  
  	/*
  	 * Are we already being traced?
-@@ -513,6 +1105,9 @@ repeat:
+@@ -513,6 +1109,9 @@ repeat:
  		write_unlock_irqrestore(&tasklist_lock, flags);
  	}
  	task_unlock(current);




More information about the fedora-extras-commits mailing list