Commit a6f625f6 authored by Roland McGrath's avatar Roland McGrath Committed by Greg Kroah-Hartman

Patch Upstream: x86 ptrace: fix PTRACE_GETFPXREGS error

commit 45fdc3a7 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: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8c5a4a12
...@@ -162,7 +162,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset, ...@@ -162,7 +162,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset,
int ret; int ret;
if (!cpu_has_fxsr) if (!cpu_has_fxsr)
return -EIO; return -ENODEV;
ret = init_fpu(target); ret = init_fpu(target);
if (ret) if (ret)
...@@ -179,7 +179,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, ...@@ -179,7 +179,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
int ret; int ret;
if (!cpu_has_fxsr) if (!cpu_has_fxsr)
return -EIO; return -ENODEV;
ret = init_fpu(target); ret = init_fpu(target);
if (ret) if (ret)
......
...@@ -943,13 +943,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -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, return copy_regset_to_user(child, &user_x86_32_view,
REGSET_XFP, REGSET_XFP,
0, sizeof(struct user_fxsr_struct), 0, sizeof(struct user_fxsr_struct),
datap); datap) ? -EIO : 0;
case PTRACE_SETFPXREGS: /* Set the child extended FPU state. */ case PTRACE_SETFPXREGS: /* Set the child extended FPU state. */
return copy_regset_from_user(child, &user_x86_32_view, return copy_regset_from_user(child, &user_x86_32_view,
REGSET_XFP, REGSET_XFP,
0, sizeof(struct user_fxsr_struct), 0, sizeof(struct user_fxsr_struct),
datap); datap) ? -EIO : 0;
#endif #endif
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment