[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/kernel/devel linux-2.6-utrace.patch,1.35,1.36



Author: roland

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

Modified Files:
	linux-2.6-utrace.patch 
Log Message:
More thorough utrace fix for overzealous BUG_ON.

linux-2.6-utrace.patch:
 Documentation/utrace.txt                |  455 ++++++++
 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/ia64/ia32/ia32_entry.S             |    2 
 arch/ia64/ia32/sys_ia32.c               |   23 
 arch/ia64/kernel/asm-offsets.c          |    2 
 arch/ia64/kernel/fsys.S                 |   16 
 arch/ia64/kernel/mca.c                  |    2 
 arch/ia64/kernel/ptrace.c               | 1670 +++++++++++++++---------------
 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            |  959 ++++++++++-------
 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/powerpc/platforms/cell/spufs/run.c |    2 
 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/process.c              |    3 
 arch/s390/kernel/ptrace.c               |  651 ++++++++++--
 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            | 1221 ++++++++++++----------
 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          |    8 
 arch/x86_64/ia32/ia32entry.S            |    2 
 arch/x86_64/ia32/ptrace32.c             |  721 ++++++++-----
 arch/x86_64/ia32/sys_ia32.c             |    5 
 arch/x86_64/kernel/process.c            |    5 
 arch/x86_64/kernel/ptrace.c             |  657 +++++++-----
 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                          |   17 
 include/asm-i386/i387.h                 |   13 
 include/asm-i386/signal.h               |    4 
 include/asm-i386/thread_info.h          |    7 
 include/asm-i386/tracehook.h            |   49 
 include/asm-ia64/elf.h                  |   24 
 include/asm-ia64/tracehook.h            |   81 +
 include/asm-powerpc/tracehook.h         |   80 +
 include/asm-s390/tracehook.h            |   53 
 include/asm-sparc64/tracehook.h         |   44 
 include/asm-x86_64/fpu32.h              |    3 
 include/asm-x86_64/thread_info.h        |    2 
 include/asm-x86_64/tracehook.h          |   54 
 include/linux/init_task.h               |    3 
 include/linux/ptrace.h                  |  224 +++-
 include/linux/sched.h                   |   25 
 include/linux/tracehook.h               |  707 +++++++++++++
 include/linux/utrace.h                  |  484 ++++++++
 init/Kconfig                            |   29 
 kernel/Makefile                         |    1 
 kernel/exit.c                           |  244 +---
 kernel/fork.c                           |   62 -
 kernel/ptrace.c                         | 1581 +++++++++++++++++++++++------
 kernel/signal.c                         |  211 ---
 kernel/sys.c                            |    2 
 kernel/timer.c                          |    4 
 kernel/utrace.c                         | 1732 ++++++++++++++++++++++++++++++++
 security/selinux/hooks.c                |   54 
 security/selinux/include/objsec.h       |    1 
 97 files changed, 9740 insertions(+), 4543 deletions(-)

Index: linux-2.6-utrace.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-utrace.patch,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- linux-2.6-utrace.patch	27 Oct 2006 09:27:06 -0000	1.35
+++ linux-2.6-utrace.patch	28 Oct 2006 01:27:28 -0000	1.36
@@ -89,14 +89,14 @@
  kernel/Makefile                         |    1 
  kernel/exit.c                           |  244 +---
  kernel/fork.c                           |   62 -
- kernel/ptrace.c                         | 1595 +++++++++++++++++++++++------
+ kernel/ptrace.c                         | 1581 +++++++++++++++++++++++-----
  kernel/signal.c                         |  211 +---
  kernel/sys.c                            |    2 
  kernel/timer.c                          |    4 
  kernel/utrace.c                         | 1732 +++++++++++++++++++++++++++++++
  security/selinux/hooks.c                |   54 +
  security/selinux/include/objsec.h       |    1 
- 98 files changed, 9756 insertions(+), 4541 deletions(-)
+ 98 files changed, 9740 insertions(+), 4543 deletions(-)
  create mode 100644 Documentation/utrace.txt
  delete arch/powerpc/kernel/ptrace-common.h
  delete arch/powerpc/kernel/ptrace32.c
@@ -5574,7 +5574,7 @@
  
  static int may_attach(struct task_struct *task)
  {
-@@ -157,334 +71,1387 @@ int ptrace_may_attach(struct task_struct
+@@ -157,334 +71,1369 @@ int ptrace_may_attach(struct task_struct
  	return !err;
  }
  
@@ -5758,7 +5758,7 @@
 +		retval = PTR_ERR(engine);
 +		if (retval == -EEXIST)
 +			retval = -EPERM;
- 	}
++	}
 +	else {
 +		task_lock(current);
 +		retval = security_ptrace(current->parent, current);
@@ -5770,8 +5770,9 @@
 +			utrace_detach(current, engine);
 +		else
 +			ptrace_update(current, engine, 0);
-+	}
-+
+ 	}
+ 
+-	if (!task->mm)
 +	return retval;
 +}
 +
@@ -5779,8 +5780,7 @@
 +{
 +	struct utrace_attached_engine *engine;
 +	int retval;
- 
--	if (!task->mm)
++
 +	retval = -EPERM;
 +	if (task->pid <= 1)
  		goto bad;
@@ -6020,12 +6020,14 @@
 +
 +	if (unlikely(regset == NULL))
 +		return -EIO;
-+
-+	if (size == (unsigned int) -1)
-+		size = regset->size * regset->n;
  
 -	if (data & PTRACE_O_TRACESYSGOOD)
 -		child->ptrace |= PT_TRACESYSGOOD;
++	if (size == (unsigned int) -1)
++		size = regset->size * regset->n;
+ 
+-	if (data & PTRACE_O_TRACEFORK)
+-		child->ptrace |= PT_TRACE_FORK;
 +	if (write) {
 +		if (!access_ok(VERIFY_READ, data, size))
 +			ret = -EIO;
@@ -6041,13 +6043,13 @@
 +					     offset, size, NULL, data);
 +	}
  
--	if (data & PTRACE_O_TRACEFORK)
--		child->ptrace |= PT_TRACE_FORK;
+-	if (data & PTRACE_O_TRACEVFORK)
+-		child->ptrace |= PT_TRACE_VFORK;
 +	return ret;
 +}
  
--	if (data & PTRACE_O_TRACEVFORK)
--		child->ptrace |= PT_TRACE_VFORK;
+-	if (data & PTRACE_O_TRACECLONE)
+-		child->ptrace |= PT_TRACE_CLONE;
 +fastcall int
 +ptrace_onereg_access(struct task_struct *target,
 +		     struct utrace_attached_engine *engine,
@@ -6060,22 +6062,21 @@
 +	unsigned int pos;
 +	int ret;
  
--	if (data & PTRACE_O_TRACECLONE)
--		child->ptrace |= PT_TRACE_CLONE;
-+	if (unlikely(regset == NULL))
-+		return -EIO;
- 
 -	if (data & PTRACE_O_TRACEEXEC)
 -		child->ptrace |= PT_TRACE_EXEC;
-+	if (regno < regset->bias || regno >= regset->bias + regset->n)
-+		return -EINVAL;
++	if (unlikely(regset == NULL))
++		return -EIO;
  
 -	if (data & PTRACE_O_TRACEVFORKDONE)
 -		child->ptrace |= PT_TRACE_VFORK_DONE;
-+	pos = (regno - regset->bias) * regset->size;
++	if (regno < regset->bias || regno >= regset->bias + regset->n)
++		return -EINVAL;
  
 -	if (data & PTRACE_O_TRACEEXIT)
 -		child->ptrace |= PT_TRACE_EXIT;
++	pos = (regno - regset->bias) * regset->size;
+ 
+-	return (data & ~PTRACE_O_MASK) ? -EINVAL : 0;
 +	if (write) {
 +		if (!access_ok(VERIFY_READ, data, regset->size))
 +			ret = -EIO;
@@ -6090,8 +6091,7 @@
 +			ret = (*regset->get)(target, regset, pos, regset->size,
 +					     NULL, data);
 +	}
- 
--	return (data & ~PTRACE_O_MASK) ? -EINVAL : 0;
++
 +	return ret;
  }
  
@@ -6224,7 +6224,6 @@
 +	child = find_task_by_pid(pid);
 +	if (child)
 +		get_task_struct(child);
-+
  	read_unlock(&tasklist_lock);
 -	return error;
 +#ifdef PTRACE_DEBUG
@@ -6793,25 +6792,31 @@
  	 */
 -	if (pid == 1)
 -		return ERR_PTR(-EPERM);
-+	wake_up_interruptible_sync(&parent->signal->wait_chldexit);
-+	spin_unlock_irqrestore(&sighand->siglock, flags);
-+}
- 
+-
 -	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;
++	wake_up_interruptible_sync(&parent->signal->wait_chldexit);
++	spin_unlock_irqrestore(&sighand->siglock, flags);
+ }
+ 
+-#ifndef __ARCH_SYS_PTRACE
+-asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
 +static u32
 +ptrace_report(struct utrace_attached_engine *engine, struct task_struct *tsk,
 +	      int code)
-+{
+ {
+-	struct task_struct *child;
+-	long ret;
 +	struct ptrace_state *state = (struct ptrace_state *) engine->data;
 +	const struct utrace_regset *regset;
- 
--	read_unlock(&tasklist_lock);
--	if (!child)
--		return ERR_PTR(-ESRCH);
--	return child;
++
 +#ifdef PTRACE_DEBUG
 +	printk("%d ptrace_report %d engine %p state %p code %x parent %d (%p)\n",
 +	       current->pid, tsk->pid, engine, state, code,
@@ -6824,8 +6829,6 @@
 +	}
 +#endif
 +
-+	BUG_ON(state->u.live.stopped);
-+
 +	/*
 +	 * Set our QUIESCE flag right now, before notifying the tracer.
 +	 * We do this before setting state->u.live.stopped rather than
@@ -6834,13 +6837,17 @@
 +	 * try to resume us with PTRACE_CONT before we set the flag.
 +	 */
 +	utrace_set_flags(tsk, engine, engine->flags | UTRACE_ACTION_QUIESCE);
-+
-+	/*
+ 
+ 	/*
+-	 * This lock_kernel fixes a subtle race with suid exec
 +	 * If regset 0 has a writeback call, do it now.  On register window
 +	 * machines, this makes sure the user memory backing the register
 +	 * data is up to date by the time wait_task_inactive returns to
 +	 * ptrace_start in our tracer doing a PTRACE_PEEKDATA or the like.
-+	 */
+ 	 */
+-	lock_kernel();
+-	if (request == PTRACE_TRACEME) {
+-		ret = ptrace_traceme();
 +	regset = utrace_regset(tsk, engine, utrace_native_view(tsk), 0);
 +	if (regset->writeback)
 +		(*regset->writeback)(tsk, regset, 0);
@@ -6856,16 +6863,12 @@
 +#endif
 +
 +	return UTRACE_ACTION_RESUME;
- }
- 
--#ifndef __ARCH_SYS_PTRACE
--asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
++}
++
 +static inline u32
 +ptrace_event(struct utrace_attached_engine *engine, struct task_struct *tsk,
 +	     int event)
- {
--	struct task_struct *child;
--	long ret;
++{
 +	struct ptrace_state *state = (struct ptrace_state *) engine->data;
 +	state->u.live.syscall = 0;
 +	return ptrace_report(engine, tsk, (event << 8) | SIGTRAP);
@@ -6892,16 +6895,6 @@
 +		ptrace_done(state);
 +		return UTRACE_ACTION_DETACH;
 +	}
- 
- 	/*
--	 * This lock_kernel fixes a subtle race with suid exec
-+	 * We can get here with the stopped flag still set when
-+	 * we are dying with a SIGKILL that broke us out of quiescence.
- 	 */
--	lock_kernel();
--	if (request == PTRACE_TRACEME) {
--		ret = ptrace_traceme();
-+	state->u.live.stopped = 0;
 +
 +	state->u.live.reported = 0;
 +	do_notify(tsk, state->parent, CLD_EXITED);
@@ -7098,15 +7091,6 @@
 +		   struct task_struct *tsk, long orig_code, long *code)
 +{
 +	struct ptrace_state *state = (struct ptrace_state *) engine->data;
-+
-+	/*
-+	 * We can get here with the stopped flag still set when
-+	 * we are dying with a SIGKILL that broke us out of quiescence.
-+	 */
-+	if (state->u.live.stopped)
-+		WARN_ON(orig_code != SIGKILL);
-+	state->u.live.stopped = 0;
-+
 +	state->u.live.have_eventmsg = 1;
 +	state->u.live.u.eventmsg = *code;
 +	return ptrace_event(engine, tsk, PTRACE_EVENT_EXIT);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]