rpms/kernel/devel kernel-2.6.spec, 1.2987, 1.2988 linux-2.6-utrace.patch, 1.55, 1.56

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Mar 15 01:01:07 UTC 2007


Author: roland

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv13273

Modified Files:
	kernel-2.6.spec linux-2.6-utrace.patch 
Log Message:
utrace update: fix wait for clone threads of ptracer's own child (#232236)


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2987
retrieving revision 1.2988
diff -u -r1.2987 -r1.2988
--- kernel-2.6.spec	14 Mar 2007 21:44:27 -0000	1.2987
+++ kernel-2.6.spec	15 Mar 2007 01:01:05 -0000	1.2988
@@ -2074,6 +2074,9 @@
 #  - tux.
 
 %changelog
+* Wed Mar 14 2007 Roland McGrath <roland at redhat.com>
+- utrace update: fix wait for clone threads of ptracer's own child (#232236)
+
 * Wed Mar 14 2007 Kristian Høgsberg <krh at redhat.com>
 - Update firewire patch with latest fixes from the kernel.org linux1394 tree.
 

linux-2.6-utrace.patch:
 Documentation/utrace.txt            |  579 +++++++++++
 arch/alpha/kernel/asm-offsets.c     |    2 
 arch/alpha/kernel/entry.S           |    4 
 arch/arm/kernel/ptrace.c            |   36 
 arch/arm26/kernel/ptrace.c          |   32 
 arch/frv/kernel/ptrace.c            |   15 
 arch/i386/kernel/entry.S            |    7 
 arch/i386/kernel/i387.c             |  143 +-
 arch/i386/kernel/process.c          |    3 
 arch/i386/kernel/ptrace.c           |  863 ++++++++--------
 arch/i386/kernel/signal.c           |   37 
 arch/i386/kernel/vm86.c             |    7 
 arch/i386/math-emu/fpu_entry.c      |    6 
 arch/ia64/ia32/ia32_entry.S         |    2 
 arch/ia64/ia32/sys_ia32.c           |  536 +++++++++-
 arch/ia64/kernel/asm-offsets.c      |    2 
 arch/ia64/kernel/fsys.S             |   16 
 arch/ia64/kernel/mca.c              |    2 
 arch/ia64/kernel/ptrace.c           | 1701 ++++++++++++++++----------------
 arch/ia64/kernel/signal.c           |    4 
 arch/mips/kernel/ptrace.c           |   21 
 arch/mips/kernel/sysirix.c          |    2 
 arch/powerpc/kernel/Makefile        |    4 
 arch/powerpc/kernel/asm-offsets.c   |    2 
 arch/powerpc/kernel/process.c       |    5 
 arch/powerpc/kernel/ptrace-common.h |  161 ---
 arch/powerpc/kernel/ptrace.c        |  957 ++++++++++--------
 arch/powerpc/kernel/ptrace32.c      |  436 --------
 arch/powerpc/kernel/signal_32.c     |   55 +
 arch/powerpc/kernel/signal_64.c     |    3 
 arch/powerpc/kernel/sys_ppc32.c     |    5 
 arch/powerpc/lib/sstep.c            |    3 
 arch/ppc/kernel/asm-offsets.c       |    2 
 arch/s390/kernel/Makefile           |    2 
 arch/s390/kernel/compat_linux.c     |    3 
 arch/s390/kernel/compat_signal.c    |    5 
 arch/s390/kernel/compat_wrapper.S   |    2 
 arch/s390/kernel/process.c          |    3 
 arch/s390/kernel/ptrace.c           | 1118 ++++++++++-----------
 arch/s390/kernel/signal.c           |    3 
 arch/s390/kernel/traps.c            |    6 
 arch/sparc64/kernel/Makefile        |    2 
 arch/sparc64/kernel/binfmt_aout32.c |    2 
 arch/sparc64/kernel/entry.S         |    6 
 arch/sparc64/kernel/process.c       |    3 
 arch/sparc64/kernel/ptrace.c        | 1222 ++++++++++++-----------
 arch/sparc64/kernel/signal.c        |    2 
 arch/sparc64/kernel/signal32.c      |    2 
 arch/sparc64/kernel/sys_sparc32.c   |    3 
 arch/sparc64/kernel/systbls.S       |    4 
 arch/x86_64/ia32/fpu32.c            |   92 +
 arch/x86_64/ia32/ia32_aout.c        |    6 
 arch/x86_64/ia32/ia32_signal.c      |    7 
 arch/x86_64/ia32/ia32entry.S        |    2 
 arch/x86_64/ia32/ptrace32.c         |  725 +++++++++----
 arch/x86_64/ia32/sys_ia32.c         |    5 
 arch/x86_64/kernel/process.c        |    5 
 arch/x86_64/kernel/ptrace.c         |  662 +++++++-----
 arch/x86_64/kernel/signal.c         |   28 
 arch/x86_64/kernel/traps.c          |    8 
 arch/x86_64/mm/fault.c              |    4 
 drivers/connector/cn_proc.c         |    4 
 fs/binfmt_aout.c                    |    6 
 fs/binfmt_elf.c                     |    6 
 fs/binfmt_elf_fdpic.c               |    7 
 fs/binfmt_flat.c                    |    3 
 fs/binfmt_som.c                     |    2 
 fs/exec.c                           |   11 
 fs/proc/array.c                     |   12 
 fs/proc/base.c                      |   57 -
 include/asm-i386/i387.h             |   13 
 include/asm-i386/signal.h           |    4 
 include/asm-i386/thread_info.h      |    7 
 include/asm-i386/tracehook.h        |   57 +
 include/asm-ia64/elf.h              |   24 
 include/asm-ia64/tracehook.h        |   89 +
 include/asm-powerpc/tracehook.h     |   88 +
 include/asm-s390/tracehook.h        |   61 +
 include/asm-sparc64/tracehook.h     |   52 
 include/asm-x86_64/fpu32.h          |    3 
 include/asm-x86_64/thread_info.h    |    3 
 include/asm-x86_64/tracehook.h      |   61 +
 include/linux/init_task.h           |    3 
 include/linux/ptrace.h              |  236 +++-
 include/linux/sched.h               |   25 
 include/linux/tracehook.h           |  643 ++++++++++++
 include/linux/utrace.h              |  619 +++++++++++
 init/Kconfig                        |   29 
 kernel/Makefile                     |    4 
 kernel/exit.c                       |  238 +---
 kernel/fork.c                       |   68 -
 kernel/ptrace.c                     | 1780 +++++++++++++++++++++++++++------
 kernel/signal.c                     |  211 ----
 kernel/sys.c                        |    2 
 kernel/sys_ni.c                     |    4 
 kernel/timer.c                      |    6 
 kernel/tsacct.c                     |    2 
 kernel/utrace.c                     | 1892 ++++++++++++++++++++++++++++++++++++
 security/selinux/hooks.c            |   54 -
 security/selinux/include/objsec.h   |    1 
 100 files changed, 10882 insertions(+), 5090 deletions(-)

Index: linux-2.6-utrace.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-utrace.patch,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- linux-2.6-utrace.patch	12 Mar 2007 23:55:08 -0000	1.55
+++ linux-2.6-utrace.patch	15 Mar 2007 01:01:05 -0000	1.56
@@ -2852,7 +2852,7 @@
  	return 0;
  }
  
-@@ -4507,6 +4508,7 @@ static int selinux_setprocattr(struct ta
+@@ -4511,6 +4512,7 @@ static int selinux_setprocattr(struct ta
  			       char *name, void *value, size_t size)
  {
  	struct task_security_struct *tsec;
@@ -2860,7 +2860,7 @@
  	u32 sid = 0;
  	int error;
  	char *str = value;
-@@ -4595,18 +4597,24 @@ static int selinux_setprocattr(struct ta
+@@ -4599,18 +4601,24 @@ static int selinux_setprocattr(struct ta
  		/* Check for ptracing, and update the task SID if ok.
  		   Otherwise, leave SID unchanged and fail. */
  		task_lock(p);
@@ -5821,7 +5821,7 @@
  	return pid;
 --- linux-2.6/kernel/ptrace.c
 +++ linux-2.6/kernel/ptrace.c
-@@ -18,473 +18,1590 @@
+@@ -18,473 +18,1599 @@
  #include <linux/ptrace.h>
  #include <linux/security.h>
  #include <linux/signal.h>
@@ -6340,15 +6340,17 @@
 +		spin_unlock_irq(&current->sighand->siglock);
 +	}
 +	return error;
-+}
-+
+ }
+ 
+-int ptrace_detach(struct task_struct *child, unsigned int data)
 +
 +/*
 + * This is called when we are exiting.  We must stop all our ptracing.
 + */
 +void
 +ptrace_exit(struct task_struct *tsk)
-+{
+ {
+-	if (!valid_signal(data))
 +	struct list_head *pos, *n;
 +
 +	/*
@@ -6397,15 +6399,13 @@
 +	rcu_read_unlock();
 +
 +	BUG_ON(!list_empty(&tsk->ptracees));
- }
- 
--int ptrace_detach(struct task_struct *child, unsigned int data)
++}
++
 +static int
 +ptrace_induce_signal(struct task_struct *target,
 +		     struct utrace_attached_engine *engine,
 +		     long signr)
- {
--	if (!valid_signal(data))
++{
 +	struct ptrace_state *state = (struct ptrace_state *) engine->data;
 +
 +	if (signr == 0)
@@ -6491,15 +6491,15 @@
 +		else
 +			ret = (*regset->set)(target, regset,
 +					     offset, size, NULL, data);
- 	}
--	return copied;
++	}
 +	else {
 +		if (!access_ok(VERIFY_WRITE, data, size))
 +			ret = -EIO;
 +		else
 +			ret = (*regset->get)(target, regset,
 +					     offset, size, NULL, data);
-+	}
+ 	}
+-	return copied;
 +
 +	return ret;
  }
@@ -6548,15 +6548,15 @@
 +		else
 +			ret = (*regset->set)(target, regset, pos, regset->size,
 +					     NULL, data);
- 	}
--	return copied;
++	}
 +	else {
 +		if (!access_ok(VERIFY_WRITE, data, regset->size))
 +			ret = -EIO;
 +		else
 +			ret = (*regset->get)(target, regset, pos, regset->size,
 +					     NULL, data);
-+	}
+ 	}
+-	return copied;
 +
 +	return ret;
  }
@@ -6671,10 +6671,10 @@
 +	struct utrace_attached_engine *engine;
 +	struct ptrace_state *state;
 +	int ret;
- 
++
 +	if (request == PTRACE_TRACEME)
 +		return ptrace_traceme();
-+
+ 
 +	ret = -ESRCH;
  	read_lock(&tasklist_lock);
 -	if (likely(child->sighand != NULL)) {
@@ -7014,9 +7014,9 @@
 +		if (copied != sizeof(tmp))
 +			break;
 +		ret = put_user(tmp, (compat_ulong_t __user *) data);
- 		break;
- 	}
- 
++		break;
++	}
++
 +	case PTRACE_POKETEXT: /* write the word at location addr. */
 +	case PTRACE_POKEDATA:
 +		ret = 0;
@@ -7044,9 +7044,9 @@
 +			    state->u.live.u.siginfo,
 +			    (struct compat_siginfo __user *) data))
 +			ret = -EFAULT;
-+		break;
-+	}
-+
+ 		break;
+ 	}
+ 
 +out_tsk:
 +	put_task_struct(child);
 +out:
@@ -7235,11 +7235,26 @@
 +	BUG_ON(state->parent != tsk);
 +	rcu_read_unlock();
 +
-+	pr_debug("%d ptrace_do_wait (%d) found %d code %x (%lu)\n",
-+		 current->pid, tsk->pid, p->pid, exit_code, p->exit_state);
-+
++	pr_debug("%d ptrace_do_wait (%d) found %d code %x (%lu/%d)\n",
++		 current->pid, tsk->pid, p->pid, exit_code,
++		 p->exit_state, p->exit_signal);
+ 
+ 	/*
+-	 * Tracing init is not allowed.
++	 * If there was a group exit in progress, all threads report that
++	 * status.  Most will have SIGKILL in their own exit_code.
+ 	 */
+-	if (pid == 1)
+-		return ERR_PTR(-EPERM);
++	if (p->signal->flags & SIGNAL_GROUP_EXIT)
++		exit_code = p->signal->group_exit_code;
+ 
+-	read_lock(&tasklist_lock);
+-	child = find_task_by_pid(pid);
+-	if (child)
+-		get_task_struct(child);
 +	if (p->exit_state) {
-+		if (unlikely(p->parent == tsk))
++		if (unlikely(p->parent == tsk && p->exit_signal != -1))
 +			/*
 +			 * This is our natural child we were ptracing.
 +			 * When it dies it detaches (see ptrace_report_death).
@@ -7263,20 +7278,16 @@
 +		exit_code = (status << 8) | 0x7f;
 +	}
  
- 	/*
--	 * Tracing init is not allowed.
++	/*
 +	 * At this point we are committed to a successful return
 +	 * or a user error return.  Release the tasklist_lock.
- 	 */
--	if (pid == 1)
--		return ERR_PTR(-EPERM);
++	 */
 +	get_task_struct(p);
-+	read_unlock(&tasklist_lock);
- 
--	read_lock(&tasklist_lock);
--	child = find_task_by_pid(pid);
--	if (child)
--		get_task_struct(child);
+ 	read_unlock(&tasklist_lock);
+-	if (!child)
+-		return ERR_PTR(-ESRCH);
+-	return child;
++
 +	if (rusagep)
 +		err = getrusage(p, RUSAGE_BOTH, rusagep);
 +	if (infop) {
@@ -7295,11 +7306,7 @@
 +	}
 +	if (!err && stat_addr)
 +		err = put_user(exit_code, stat_addr);
- 
--	read_unlock(&tasklist_lock);
--	if (!child)
--		return ERR_PTR(-ESRCH);
--	return child;
++
 +	if (!err) {
 +		if (why != CLD_TRAPPED)
 +			/*
@@ -7443,16 +7450,17 @@
 +		 */
 +		tsk->exit_code = SIGKILL;
 +
-+	if (tsk->parent == state->parent) {
++	if (tsk->parent == state->parent && tsk->exit_signal != -1) {
 +		/*
-+		 * This is a natural child, so we detach and let the normal
++		 * This is a natural child (excluding clone siblings of a
++		 * child group_leader), so we detach and let the normal
 +		 * reporting happen once our NOREAP action is gone.  But
 +		 * first, generate a SIGCHLD for those cases where normal
 +		 * behavior won't.  A ptrace'd child always generates SIGCHLD.
 +		 */
 +		pr_debug("ptrace %d death natural parent %d exit_code %x\n",
 +			 tsk->pid, state->parent->pid, tsk->exit_code);
-+		if (tsk->exit_signal == -1 || !thread_group_empty(tsk))
++		if (!thread_group_empty(tsk))
 +			do_notify(tsk, state->parent, CLD_EXITED);
 +		ptrace_state_unlink(state);
 +		rcu_assign_pointer(engine->data, 0UL);
@@ -11452,7 +11460,7 @@
  /*30*/	.word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
  	.word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
  /*40*/	.word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
-@@ -166,7 +166,7 @@ sunos_sys_table:
+@@ -168,7 +168,7 @@ sunos_sys_table:
  	.word sys_chmod, sys32_lchown16, sunos_brk
  	.word sunos_nosys, sys32_lseek, sunos_getpid
  	.word sunos_nosys, sunos_nosys, sunos_nosys
@@ -11493,7 +11501,7 @@
  	return error;
 --- linux-2.6/arch/sparc64/kernel/process.c
 +++ linux-2.6/arch/sparc64/kernel/process.c
-@@ -808,9 +808,6 @@ asmlinkage int sparc_execve(struct pt_re
+@@ -813,9 +813,6 @@ asmlinkage int sparc_execve(struct pt_re
  		current_thread_info()->xfsr[0] = 0;
  		current_thread_info()->fpsaved[0] = 0;
  		regs->tstate &= ~TSTATE_PEF;




More information about the fedora-cvs-commits mailing list