diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2010-02-22 17:51:32 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-23 16:45:26 -0500 |
commit | c6a0dd7ec6fb2d4927979ed4dc562fc5c122d826 (patch) | |
tree | 415f5e04788eb289820685b33dabcc7949d6196b | |
parent | 5e6dbc260704ce4d22fc9664f517f0bb6748feaa (diff) |
ptrace: Fix ptrace_regset() comments and diagnose errors specifically
Return -EINVAL for the bad size and for unrecognized NT_* type in
ptrace_regset() instead of -EIO.
Also update the comments for this ptrace interface with more clarifications.
Requested-by: Roland McGrath <roland@redhat.com>
Requested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <20100222225240.397523600@sbs-t61.sc.intel.com>
Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | include/linux/ptrace.h | 5 | ||||
-rw-r--r-- | kernel/ptrace.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index dbfa821d5a6e..c5eab89da51e 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -30,6 +30,11 @@ | |||
30 | /* | 30 | /* |
31 | * Generic ptrace interface that exports the architecture specific regsets | 31 | * Generic ptrace interface that exports the architecture specific regsets |
32 | * using the corresponding NT_* types (which are also used in the core dump). | 32 | * using the corresponding NT_* types (which are also used in the core dump). |
33 | * Please note that the NT_PRSTATUS note type in a core dump contains a full | ||
34 | * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the | ||
35 | * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the | ||
36 | * other user_regset flavors, the user_regset layout and the ELF core dump note | ||
37 | * payload are exactly the same layout. | ||
33 | * | 38 | * |
34 | * This interface usage is as follows: | 39 | * This interface usage is as follows: |
35 | * struct iovec iov = { buf, len}; | 40 | * struct iovec iov = { buf, len}; |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 13b4554d8fbb..42ad8ae729a0 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -537,7 +537,7 @@ static int ptrace_regset(struct task_struct *task, int req, unsigned int type, | |||
537 | int regset_no; | 537 | int regset_no; |
538 | 538 | ||
539 | if (!regset || (kiov->iov_len % regset->size) != 0) | 539 | if (!regset || (kiov->iov_len % regset->size) != 0) |
540 | return -EIO; | 540 | return -EINVAL; |
541 | 541 | ||
542 | regset_no = regset - view->regsets; | 542 | regset_no = regset - view->regsets; |
543 | kiov->iov_len = min(kiov->iov_len, | 543 | kiov->iov_len = min(kiov->iov_len, |