* [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically
@ 2010-02-22 22:51 Suresh Siddha
2010-02-22 22:51 ` [patch 2/3] x86, ptrace: simplify xstateregs_get() Suresh Siddha
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Suresh Siddha @ 2010-02-22 22:51 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Roland McGrath,
Oleg Nesterov
Cc: LKML, hjl.tools, suresh.b.siddha
[-- Attachment #1: better_characterize_ptrace_regset_error.patch --]
[-- Type: text/plain, Size: 1640 bytes --]
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>
---
include/linux/ptrace.h | 5 +++++
kernel/ptrace.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
Index: tip/kernel/ptrace.c
===================================================================
--- tip.orig/kernel/ptrace.c
+++ tip/kernel/ptrace.c
@@ -537,7 +537,7 @@ static int ptrace_regset(struct task_str
int regset_no;
if (!regset || (kiov->iov_len % regset->size) != 0)
- return -EIO;
+ return -EINVAL;
regset_no = regset - view->regsets;
kiov->iov_len = min(kiov->iov_len,
Index: tip/include/linux/ptrace.h
===================================================================
--- tip.orig/include/linux/ptrace.h
+++ tip/include/linux/ptrace.h
@@ -30,6 +30,11 @@
/*
* Generic ptrace interface that exports the architecture specific regsets
* using the corresponding NT_* types (which are also used in the core dump).
+ * Please note that the NT_PRSTATUS note type in a core dump contains a full
+ * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
+ * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
+ * other user_regset flavors, the user_regset layout and the ELF core dump note
+ * payload are exactly the same layout.
*
* This interface usage is as follows:
* struct iovec iov = { buf, len};
^ permalink raw reply [flat|nested] 9+ messages in thread
* [patch 2/3] x86, ptrace: simplify xstateregs_get()
2010-02-22 22:51 [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Suresh Siddha
@ 2010-02-22 22:51 ` Suresh Siddha
2010-02-23 20:38 ` Roland McGrath
2010-02-23 21:49 ` [tip:x86/ptrace] x86, ptrace: Simplify xstateregs_get() tip-bot for Suresh Siddha
2010-02-22 22:51 ` [patch 3/3] x86, ptrace: remove set_stopped_child_used_math() in [x]fpregs_set Suresh Siddha
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Suresh Siddha @ 2010-02-22 22:51 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Roland McGrath,
Oleg Nesterov
Cc: LKML, hjl.tools, suresh.b.siddha
[-- Attachment #1: simplify_xstateregs_get.patch --]
[-- Type: text/plain, Size: 2068 bytes --]
48 bytes (bytes 464..511) of the xstateregs payload come from the
kernel defined structure (xstate_fx_sw_bytes). Rest comes from the
xstate regs structure in the thread struct. Instead of having multiple
user_regset_copyout()'s, simplify the xstateregs_get() by first
copying the SW bytes into the xstate regs structure in the thread structure
and then using one user_regset_copyout() to copyout the xstateregs.
Requested-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
arch/x86/kernel/i387.c | 30 +++++++-----------------------
1 file changed, 7 insertions(+), 23 deletions(-)
Index: tip/arch/x86/kernel/i387.c
===================================================================
--- tip.orig/arch/x86/kernel/i387.c
+++ tip/arch/x86/kernel/i387.c
@@ -243,34 +243,18 @@ int xstateregs_get(struct task_struct *t
return ret;
/*
- * First copy the fxsave bytes 0..463.
+ * Copy the 48bytes defined by the software first into the xstate
+ * memory layout in the thread struct, so that we can copy the entire
+ * xstateregs to the user using one user_regset_copyout().
*/
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- &target->thread.xstate->xsave, 0,
- offsetof(struct user_xstateregs,
- i387.xstate_fx_sw));
- if (ret)
- return ret;
-
- /*
- * Copy the 48bytes defined by software.
- */
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- xstate_fx_sw_bytes,
- offsetof(struct user_xstateregs,
- i387.xstate_fx_sw),
- offsetof(struct user_xstateregs,
- xsave_hdr));
- if (ret)
- return ret;
+ memcpy(&target->thread.xstate->fxsave.sw_reserved,
+ xstate_fx_sw_bytes, sizeof(xstate_fx_sw_bytes));
/*
- * Copy the rest of xstate memory layout.
+ * Copy the xstate memory layout.
*/
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- &target->thread.xstate->xsave.xsave_hdr,
- offsetof(struct user_xstateregs,
- xsave_hdr), -1);
+ &target->thread.xstate->xsave, 0, -1);
return ret;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [patch 3/3] x86, ptrace: remove set_stopped_child_used_math() in [x]fpregs_set
2010-02-22 22:51 [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Suresh Siddha
2010-02-22 22:51 ` [patch 2/3] x86, ptrace: simplify xstateregs_get() Suresh Siddha
@ 2010-02-22 22:51 ` Suresh Siddha
2010-02-23 20:37 ` Roland McGrath
2010-02-23 21:49 ` [tip:x86/ptrace] x86, ptrace: Remove " tip-bot for Suresh Siddha
2010-02-23 20:39 ` [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Roland McGrath
2010-02-23 21:48 ` [tip:x86/ptrace] ptrace: Fix " tip-bot for Suresh Siddha
3 siblings, 2 replies; 9+ messages in thread
From: Suresh Siddha @ 2010-02-22 22:51 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Roland McGrath,
Oleg Nesterov
Cc: LKML, hjl.tools, suresh.b.siddha
[-- Attachment #1: fix_fpregset_set_stopped_child_used_math.patch --]
[-- Type: text/plain, Size: 945 bytes --]
init_fpu() already ensures that the used_math() is set for the stopped child.
Remove the redundant set_stopped_child_used_math() in [x]fpregs_set()
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
arch/x86/kernel/i387.c | 4 ----
1 file changed, 4 deletions(-)
Index: tip/arch/x86/kernel/i387.c
===================================================================
--- tip.orig/arch/x86/kernel/i387.c
+++ tip/arch/x86/kernel/i387.c
@@ -209,8 +209,6 @@ int xfpregs_set(struct task_struct *targ
if (ret)
return ret;
- set_stopped_child_used_math(target);
-
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&target->thread.xstate->fxsave, 0, -1);
@@ -471,8 +469,6 @@ int fpregs_set(struct task_struct *targe
if (ret)
return ret;
- set_stopped_child_used_math(target);
-
if (!HAVE_HWFP)
return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch 3/3] x86, ptrace: remove set_stopped_child_used_math() in [x]fpregs_set
2010-02-22 22:51 ` [patch 3/3] x86, ptrace: remove set_stopped_child_used_math() in [x]fpregs_set Suresh Siddha
@ 2010-02-23 20:37 ` Roland McGrath
2010-02-23 21:49 ` [tip:x86/ptrace] x86, ptrace: Remove " tip-bot for Suresh Siddha
1 sibling, 0 replies; 9+ messages in thread
From: Roland McGrath @ 2010-02-23 20:37 UTC (permalink / raw)
To: Suresh Siddha
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Oleg Nesterov,
LKML, hjl.tools
Acked-by: Roland McGrath <roland@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch 2/3] x86, ptrace: simplify xstateregs_get()
2010-02-22 22:51 ` [patch 2/3] x86, ptrace: simplify xstateregs_get() Suresh Siddha
@ 2010-02-23 20:38 ` Roland McGrath
2010-02-23 21:49 ` [tip:x86/ptrace] x86, ptrace: Simplify xstateregs_get() tip-bot for Suresh Siddha
1 sibling, 0 replies; 9+ messages in thread
From: Roland McGrath @ 2010-02-23 20:38 UTC (permalink / raw)
To: Suresh Siddha
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Oleg Nesterov,
LKML, hjl.tools
Acked-by: Roland McGrath <roland@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically
2010-02-22 22:51 [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Suresh Siddha
2010-02-22 22:51 ` [patch 2/3] x86, ptrace: simplify xstateregs_get() Suresh Siddha
2010-02-22 22:51 ` [patch 3/3] x86, ptrace: remove set_stopped_child_used_math() in [x]fpregs_set Suresh Siddha
@ 2010-02-23 20:39 ` Roland McGrath
2010-02-23 21:48 ` [tip:x86/ptrace] ptrace: Fix " tip-bot for Suresh Siddha
3 siblings, 0 replies; 9+ messages in thread
From: Roland McGrath @ 2010-02-23 20:39 UTC (permalink / raw)
To: Suresh Siddha
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Oleg Nesterov,
LKML, hjl.tools
Acked-by: Roland McGrath <roland@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [tip:x86/ptrace] ptrace: Fix ptrace_regset() comments and diagnose errors specifically
2010-02-22 22:51 [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Suresh Siddha
` (2 preceding siblings ...)
2010-02-23 20:39 ` [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Roland McGrath
@ 2010-02-23 21:48 ` tip-bot for Suresh Siddha
3 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Suresh Siddha @ 2010-02-23 21:48 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, roland, suresh.b.siddha, oleg, tglx
Commit-ID: c6a0dd7ec6fb2d4927979ed4dc562fc5c122d826
Gitweb: http://git.kernel.org/tip/c6a0dd7ec6fb2d4927979ed4dc562fc5c122d826
Author: Suresh Siddha <suresh.b.siddha@intel.com>
AuthorDate: Mon, 22 Feb 2010 14:51:32 -0800
Committer: H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 23 Feb 2010 13:45:26 -0800
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>
---
include/linux/ptrace.h | 5 +++++
kernel/ptrace.c | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index dbfa821..c5eab89 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -30,6 +30,11 @@
/*
* Generic ptrace interface that exports the architecture specific regsets
* using the corresponding NT_* types (which are also used in the core dump).
+ * Please note that the NT_PRSTATUS note type in a core dump contains a full
+ * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
+ * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
+ * other user_regset flavors, the user_regset layout and the ELF core dump note
+ * payload are exactly the same layout.
*
* This interface usage is as follows:
* struct iovec iov = { buf, len};
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 13b4554..42ad8ae 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,
int regset_no;
if (!regset || (kiov->iov_len % regset->size) != 0)
- return -EIO;
+ return -EINVAL;
regset_no = regset - view->regsets;
kiov->iov_len = min(kiov->iov_len,
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:x86/ptrace] x86, ptrace: Simplify xstateregs_get()
2010-02-22 22:51 ` [patch 2/3] x86, ptrace: simplify xstateregs_get() Suresh Siddha
2010-02-23 20:38 ` Roland McGrath
@ 2010-02-23 21:49 ` tip-bot for Suresh Siddha
1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Suresh Siddha @ 2010-02-23 21:49 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, roland, suresh.b.siddha, oleg, tglx
Commit-ID: ff7fbc72e0c3ef7e94a27a3a918fd09ec9a30204
Gitweb: http://git.kernel.org/tip/ff7fbc72e0c3ef7e94a27a3a918fd09ec9a30204
Author: Suresh Siddha <suresh.b.siddha@intel.com>
AuthorDate: Mon, 22 Feb 2010 14:51:33 -0800
Committer: H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 23 Feb 2010 13:45:27 -0800
x86, ptrace: Simplify xstateregs_get()
48 bytes (bytes 464..511) of the xstateregs payload come from the
kernel defined structure (xstate_fx_sw_bytes). Rest comes from the
xstate regs structure in the thread struct. Instead of having multiple
user_regset_copyout()'s, simplify the xstateregs_get() by first
copying the SW bytes into the xstate regs structure in the thread structure
and then using one user_regset_copyout() to copyout the xstateregs.
Requested-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <20100222225240.494688491@sbs-t61.sc.intel.com>
Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Oleg Nesterov <oleg@redhat.com>
---
arch/x86/kernel/i387.c | 30 +++++++-----------------------
1 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 7a8a193..81e23bf 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -243,34 +243,18 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
return ret;
/*
- * First copy the fxsave bytes 0..463.
+ * Copy the 48bytes defined by the software first into the xstate
+ * memory layout in the thread struct, so that we can copy the entire
+ * xstateregs to the user using one user_regset_copyout().
*/
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- &target->thread.xstate->xsave, 0,
- offsetof(struct user_xstateregs,
- i387.xstate_fx_sw));
- if (ret)
- return ret;
-
- /*
- * Copy the 48bytes defined by software.
- */
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- xstate_fx_sw_bytes,
- offsetof(struct user_xstateregs,
- i387.xstate_fx_sw),
- offsetof(struct user_xstateregs,
- xsave_hdr));
- if (ret)
- return ret;
+ memcpy(&target->thread.xstate->fxsave.sw_reserved,
+ xstate_fx_sw_bytes, sizeof(xstate_fx_sw_bytes));
/*
- * Copy the rest of xstate memory layout.
+ * Copy the xstate memory layout.
*/
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- &target->thread.xstate->xsave.xsave_hdr,
- offsetof(struct user_xstateregs,
- xsave_hdr), -1);
+ &target->thread.xstate->xsave, 0, -1);
return ret;
}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:x86/ptrace] x86, ptrace: Remove set_stopped_child_used_math() in [x]fpregs_set
2010-02-22 22:51 ` [patch 3/3] x86, ptrace: remove set_stopped_child_used_math() in [x]fpregs_set Suresh Siddha
2010-02-23 20:37 ` Roland McGrath
@ 2010-02-23 21:49 ` tip-bot for Suresh Siddha
1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Suresh Siddha @ 2010-02-23 21:49 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, roland, suresh.b.siddha, oleg, tglx
Commit-ID: 6dbbe14f21368a45aedba7eab0221857b8ad8d16
Gitweb: http://git.kernel.org/tip/6dbbe14f21368a45aedba7eab0221857b8ad8d16
Author: Suresh Siddha <suresh.b.siddha@intel.com>
AuthorDate: Mon, 22 Feb 2010 14:51:34 -0800
Committer: H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 23 Feb 2010 13:45:27 -0800
x86, ptrace: Remove set_stopped_child_used_math() in [x]fpregs_set
init_fpu() already ensures that the used_math() is set for the stopped child.
Remove the redundant set_stopped_child_used_math() in [x]fpregs_set()
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <20100222225240.642169080@sbs-t61.sc.intel.com>
Acked-by: Rolan McGrath <roland@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
arch/x86/kernel/i387.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 81e23bf..c01a2b8 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -209,8 +209,6 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
if (ret)
return ret;
- set_stopped_child_used_math(target);
-
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&target->thread.xstate->fxsave, 0, -1);
@@ -471,8 +469,6 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
if (ret)
return ret;
- set_stopped_child_used_math(target);
-
if (!HAVE_HWFP)
return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-02-23 21:49 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-22 22:51 [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Suresh Siddha
2010-02-22 22:51 ` [patch 2/3] x86, ptrace: simplify xstateregs_get() Suresh Siddha
2010-02-23 20:38 ` Roland McGrath
2010-02-23 21:49 ` [tip:x86/ptrace] x86, ptrace: Simplify xstateregs_get() tip-bot for Suresh Siddha
2010-02-22 22:51 ` [patch 3/3] x86, ptrace: remove set_stopped_child_used_math() in [x]fpregs_set Suresh Siddha
2010-02-23 20:37 ` Roland McGrath
2010-02-23 21:49 ` [tip:x86/ptrace] x86, ptrace: Remove " tip-bot for Suresh Siddha
2010-02-23 20:39 ` [patch 1/3] ptrace: fix ptrace_regset() comments and diagnose errors specifically Roland McGrath
2010-02-23 21:48 ` [tip:x86/ptrace] ptrace: Fix " tip-bot for Suresh Siddha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).