diff options
| author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-05-15 10:26:50 -0400 | 
|---|---|---|
| committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-05-15 10:26:50 -0400 | 
| commit | 12e04ffcd93b25dfd726d46338c2ee7d23de556e (patch) | |
| tree | f91479a62805619168994fd3ee55e3ffa23fc24e /kernel/ptrace.c | |
| parent | 9eff37a8713939f218ab8bf0dc93f1d67af7b8b4 (diff) | |
| parent | f722406faae2d073cc1d01063d1123c35425939e (diff) | |
Merge tag 'v3.10-rc1' into stable/for-linus-3.10
Linux 3.10-rc1
* tag 'v3.10-rc1': (12273 commits)
  Linux 3.10-rc1
  [SCSI] qla2xxx: Update firmware link in Kconfig file.
  [SCSI] iscsi class, qla4xxx: fix sess/conn refcounting when find fns are used
  [SCSI] sas: unify the pointlessly separated enums sas_dev_type and sas_device_type
  [SCSI] pm80xx: thermal, sas controller config and error handling update
  [SCSI] pm80xx: NCQ error handling changes
  [SCSI] pm80xx: WWN Modification for PM8081/88/89 controllers
  [SCSI] pm80xx: Changed module name and debug messages update
  [SCSI] pm80xx: Firmware flash memory free fix, with addition of new memory region for it
  [SCSI] pm80xx: SPC new firmware changes for device id 0x8081 alone
  [SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files
  [SCSI] pm80xx: MSI-X implementation for using 64 interrupts
  [SCSI] pm80xx: Updated common functions common for SPC and SPCv/ve
  [SCSI] pm80xx: Multiple inbound/outbound queue configuration
  [SCSI] pm80xx: Added SPCv/ve specific ids, variables and modify for SPC
  [SCSI] lpfc: fix up Kconfig dependencies
  [SCSI] Handle MLQUEUE busy response in scsi_send_eh_cmnd
  dm cache: set config value
  dm cache: move config fns
  dm thin: generate event when metadata threshold passed
  ...
Diffstat (limited to 'kernel/ptrace.c')
| -rw-r--r-- | kernel/ptrace.c | 81 | 
1 files changed, 81 insertions, 0 deletions
| diff --git a/kernel/ptrace.c b/kernel/ptrace.c index acbd28424d8..aed981a3f69 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -17,6 +17,7 @@  #include <linux/ptrace.h>  #include <linux/security.h>  #include <linux/signal.h> +#include <linux/uio.h>  #include <linux/audit.h>  #include <linux/pid_namespace.h>  #include <linux/syscalls.h> @@ -24,6 +25,7 @@  #include <linux/regset.h>  #include <linux/hw_breakpoint.h>  #include <linux/cn_proc.h> +#include <linux/compat.h>  static int ptrace_trapping_sleep_fn(void *flags) @@ -618,6 +620,81 @@ static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info)  	return error;  } +static int ptrace_peek_siginfo(struct task_struct *child, +				unsigned long addr, +				unsigned long data) +{ +	struct ptrace_peeksiginfo_args arg; +	struct sigpending *pending; +	struct sigqueue *q; +	int ret, i; + +	ret = copy_from_user(&arg, (void __user *) addr, +				sizeof(struct ptrace_peeksiginfo_args)); +	if (ret) +		return -EFAULT; + +	if (arg.flags & ~PTRACE_PEEKSIGINFO_SHARED) +		return -EINVAL; /* unknown flags */ + +	if (arg.nr < 0) +		return -EINVAL; + +	if (arg.flags & PTRACE_PEEKSIGINFO_SHARED) +		pending = &child->signal->shared_pending; +	else +		pending = &child->pending; + +	for (i = 0; i < arg.nr; ) { +		siginfo_t info; +		s32 off = arg.off + i; + +		spin_lock_irq(&child->sighand->siglock); +		list_for_each_entry(q, &pending->list, list) { +			if (!off--) { +				copy_siginfo(&info, &q->info); +				break; +			} +		} +		spin_unlock_irq(&child->sighand->siglock); + +		if (off >= 0) /* beyond the end of the list */ +			break; + +#ifdef CONFIG_COMPAT +		if (unlikely(is_compat_task())) { +			compat_siginfo_t __user *uinfo = compat_ptr(data); + +			ret = copy_siginfo_to_user32(uinfo, &info); +			ret |= __put_user(info.si_code, &uinfo->si_code); +		} else +#endif +		{ +			siginfo_t __user *uinfo = (siginfo_t __user *) data; + +			ret = copy_siginfo_to_user(uinfo, &info); +			ret |= __put_user(info.si_code, &uinfo->si_code); +		} + +		if (ret) { +			ret = -EFAULT; +			break; +		} + +		data += sizeof(siginfo_t); +		i++; + +		if (signal_pending(current)) +			break; + +		cond_resched(); +	} + +	if (i > 0) +		return i; + +	return ret; +}  #ifdef PTRACE_SINGLESTEP  #define is_singlestep(request)		((request) == PTRACE_SINGLESTEP) @@ -748,6 +825,10 @@ int ptrace_request(struct task_struct *child, long request,  		ret = put_user(child->ptrace_message, datalp);  		break; +	case PTRACE_PEEKSIGINFO: +		ret = ptrace_peek_siginfo(child, addr, data); +		break; +  	case PTRACE_GETSIGINFO:  		ret = ptrace_getsiginfo(child, &siginfo);  		if (!ret) | 
