[patch 15/62] Patch Upstream: x86 ptrace: fix PTRACE_GETFPXREGS error

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg KH
Date: Wednesday, July 30, 2008 - 4:58 pm

2.6.26 -stable review patch.  If anyone has any objections, please let
us know.

------------------
From: Roland McGrath <roland@redhat.com>

commit 45fdc3a7624a4a48185a04ae0abab5f9793d8952 upstream

ptrace has always returned only -EIO for all failures to access
registers.  The user_regset calls are allowed to return a more
meaningful variety of errors.  The REGSET_XFP calls use -ENODEV
for !cpu_has_fxsr hardware.  Make ptrace return the traditional
-EIO instead of the error code from the user_regset call.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/x86/kernel/i387.c   |    4 ++--
 arch/x86/kernel/ptrace.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -162,7 +162,7 @@ int xfpregs_get(struct task_struct *targ
 	int ret;
 
 	if (!cpu_has_fxsr)
-		return -EIO;
+		return -ENODEV;
 
 	ret = init_fpu(target);
 	if (ret)
@@ -179,7 +179,7 @@ int xfpregs_set(struct task_struct *targ
 	int ret;
 
 	if (!cpu_has_fxsr)
-		return -EIO;
+		return -ENODEV;
 
 	ret = init_fpu(target);
 	if (ret)
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -943,13 +943,13 @@ long arch_ptrace(struct task_struct *chi
 		return copy_regset_to_user(child, &user_x86_32_view,
 					   REGSET_XFP,
 					   0, sizeof(struct user_fxsr_struct),
-					   datap);
+					   datap) ? -EIO : 0;
 
 	case PTRACE_SETFPXREGS:	/* Set the child extended FPU state. */
 		return copy_regset_from_user(child, &user_x86_32_view,
 					     REGSET_XFP,
 					     0, sizeof(struct user_fxsr_struct),
-					     datap);
+					     datap) ? -EIO : 0;
 #endif
 
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION

-- 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 00/62] 2.6.26-stable review, Greg KH, (Wed Jul 30, 4:49 pm)
[patch 03/62] ipv6: use timer pending, Greg KH, (Wed Jul 30, 4:57 pm)
[patch 05/62] hdlcdrv: Fix CRC calculation., Greg KH, (Wed Jul 30, 4:57 pm)
[patch 15/62] Patch Upstream: x86 ptrace: fix PTRACE_GETFP ..., Greg KH, (Wed Jul 30, 4:58 pm)
[patch 23/62] proc: fix /proc/*/pagemap, Greg KH, (Wed Jul 30, 4:58 pm)
[patch 53/62] UML - Fix boot crash, Greg KH, (Wed Jul 30, 4:59 pm)