if (data > _NSIG) 
if (!valid_signal(data)) 
sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data){	struct pt_regs *pt;	unsigned long urbs_end, peek_or_poke;	struct task_struct *child;	struct switch_stack *sw;	long ret;	lock_kernel();	ret = -EPERM;	if (request == PTRACE_TRACEME) {		/* are we already being traced? */		if (current->ptrace & PT_PTRACED)			goto out;		ret = security_ptrace(current->parent, current);		if (ret)			goto out;		current->ptrace |= PT_PTRACED;		ret = 0;		goto out;	}	peek_or_poke = (request == PTRACE_PEEKTEXT			|| request == PTRACE_PEEKDATA			|| request == PTRACE_POKETEXT			|| request == PTRACE_POKEDATA);	ret = -ESRCH;	read_lock(&tasklist_lock);	{		child = find_task_by_pid(pid);		if (child) {			if (peek_or_poke)				child = find_thread_for_addr(child, addr);			get_task_struct(child);		}	}	read_unlock(&tasklist_lock);	if (!child)		goto out;	ret = -EPERM;	if (pid == 1)		/* no messing around with init! */		goto out_tsk;	if (request == PTRACE_ATTACH) {		ret = ptrace_attach(child);		goto out_tsk;	}	ret = ptrace_check_attach(child, request == PTRACE_KILL);	if (ret < 0)		goto out_tsk;	pt = ia64_task_regs(child);	sw = (struct switch_stack *) (child->thread.ksp + 16);	switch (request) {	      case PTRACE_PEEKTEXT:	      case PTRACE_PEEKDATA:		/* read word at location addr */		urbs_end = ia64_get_user_rbs_end(child, pt, NULL);		ret = ia64_peek(child, sw, urbs_end, addr, &data);		if (ret == 0) {			ret = data;			/* ensure "ret" is not mistaken as an error code: */			force_successful_syscall_return();		}		goto out_tsk;	      case PTRACE_POKETEXT:	      case PTRACE_POKEDATA:		/* write the word at location addr */		urbs_end = ia64_get_user_rbs_end(child, pt, NULL);		ret = ia64_poke(child, sw, urbs_end, addr, data);		goto out_tsk;	      case PTRACE_PEEKUSR:		/* read the word at addr in the USER area */		if (access_uarea(child, addr, &data, 0) < 0) {			ret = -EIO;			goto out_tsk;		}		ret = data;		/* ensure "ret" is not mistaken as an error code */		force_successful_syscall_return();		goto out_tsk;	      case PTRACE_POKEUSR:		/* write the word at addr in the USER area */		if (access_uarea(child, addr, &data, 1) < 0) {			ret = -EIO;			goto out_tsk;		}		ret = 0;		goto out_tsk;	      case PTRACE_OLD_GETSIGINFO:		/* for backwards-compatibility */		ret = ptrace_request(child, PTRACE_GETSIGINFO, addr, data);		goto out_tsk;	      case PTRACE_OLD_SETSIGINFO:		/* for backwards-compatibility */		ret = ptrace_request(child, PTRACE_SETSIGINFO, addr, data);		goto out_tsk;	      case PTRACE_SYSCALL:		/* continue and stop at next (return from) syscall */	      case PTRACE_CONT:		/* restart after signal. */		ret = -EIO;		if (data > _NSIG)			goto out_tsk;		if (request == PTRACE_SYSCALL)			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);		else			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);		child->exit_code = data;		/*		 * Make sure the single step/taken-branch trap bits		 * are not set:		 */		ia64_psr(pt)->ss = 0;		ia64_psr(pt)->tb = 0;		wake_up_process(child);		ret = 0;		goto out_tsk;	      case PTRACE_KILL:		/*		 * Make the child exit.  Best I can do is send it a		 * sigkill.  Perhaps it should be put in the status		 * that it wants to exit.		 */		if (child->exit_state == EXIT_ZOMBIE)			/* already dead */			goto out_tsk;		child->exit_code = SIGKILL;		ptrace_disable(child);		wake_up_process(child);		ret = 0;		goto out_tsk;	      case PTRACE_SINGLESTEP:		/* let child execute for one instruction */	      case PTRACE_SINGLEBLOCK:		ret = -EIO;		if (data > _NSIG)			goto out_tsk;		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);		if (request == PTRACE_SINGLESTEP) {			ia64_psr(pt)->ss = 1;		} else {			ia64_psr(pt)->tb = 1;		}		child->exit_code = data;		/* give it a chance to run. */		wake_up_process(child);		ret = 0;		goto out_tsk;	      case PTRACE_DETACH:		/* detach a process that was attached. */		ret = ptrace_detach(child, data);		goto out_tsk;	      case PTRACE_GETREGS:		ret = ptrace_getregs(child,				     (struct pt_all_user_regs __user *) data);		goto out_tsk;	      case PTRACE_SETREGS:		ret = ptrace_setregs(child,				     (struct pt_all_user_regs __user *) data);		goto out_tsk;	      default:		ret = ptrace_request(child, request, addr, data);		goto out_tsk;	}  out_tsk:	put_task_struct(child);  out:	unlock_kernel();	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7ed20e1ad521b5f5df61bf6559ae60738e393741/ptrace.c/buggy/arch/ia64/kernel/ptrace.c