]> err.no Git - linux-2.6/commitdiff
x86 ptrace: fix PTRACE_GETFPXREGS error
authorRoland McGrath <roland@redhat.com>
Mon, 30 Jun 2008 21:02:41 +0000 (14:02 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 1 Jul 2008 09:03:31 +0000 (11:03 +0200)
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
arch/x86/kernel/ptrace.c

index 95e80e5033c3b5c36fb66fd5ac7be4d99f04d421..eb9ddd8efb828175e7be0efcc0616257c67c5943 100644 (file)
@@ -162,7 +162,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset,
        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 *target, const struct user_regset *regset,
        int ret;
 
        if (!cpu_has_fxsr)
-               return -EIO;
+               return -ENODEV;
 
        ret = init_fpu(target);
        if (ret)
index a7835f2829361bcd964f85118839751fba24b12b..77040b6070e18c00ce71f788efa0d40d5a156229 100644 (file)
@@ -943,13 +943,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                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