Re: [PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Tuesday, July 1, 2008 - 2:02 am

* Roland McGrath <roland@redhat.com> wrote:


since the original fix is already upstream, i've applied the delta patch 
below. Should we still do this for v2.6.26 or can we defer it to 
v2.6.27? As ptrace is the only user of this facility for now this would 
be an identity transformation AFAICS and the v2.6.26 release is very 
close.

	Ingo

---------------->
Subject: x86 ptrace: fix PTRACE_GETFPXREGS error
From: Roland McGrath <roland@redhat.com>
Date: Mon, 30 Jun 2008 14:02:41 -0700 (PDT)

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>
Cc: stable@kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/i387.c   |    4 ++--
 arch/x86/kernel/ptrace.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Index: tip/arch/x86/kernel/i387.c
===================================================================
--- tip.orig/arch/x86/kernel/i387.c
+++ tip/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)
Index: tip/arch/x86/kernel/ptrace.c
===================================================================
--- tip.orig/arch/x86/kernel/ptrace.c
+++ tip/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] ptrace GET/SET FPXREGS broken, TAKADA Yoshihito, (Sun Jun 29, 9:44 pm)
Re: [PATCH] ptrace GET/SET FPXREGS broken, Ingo Molnar, (Mon Jun 30, 5:18 am)
[PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error, Roland McGrath, (Mon Jun 30, 2:02 pm)
Re: [PATCH] ptrace GET/SET FPXREGS broken, Roland McGrath, (Mon Jun 30, 2:02 pm)
Re: [PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error, Ingo Molnar, (Tue Jul 1, 2:02 am)
Re: [PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error, Roland McGrath, (Tue Jul 1, 2:32 am)
Re: [PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error, Ingo Molnar, (Tue Jul 1, 3:11 am)
Re: [PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error, TAKADA Yoshihito, (Wed Jul 2, 6:58 pm)
Re: [PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error, TAKADA Yoshihito, (Wed Jul 2, 7:37 pm)
Re: [PATCH] x86 ptrace: fix PTRACE_GETFPXREGS error, Roland McGrath, (Wed Jul 2, 8:00 pm)