Skip to content

Commit 6de5a8a

Browse files
Eli Cooperrichardweinberger
authored andcommitted
um: fix FPU state preservation around signal handlers
This patch makes UML saves/restores FPU state from/to the fpstate in pt_regs when setting up or returning from a signal stack, rather than calling ptrace directly. This ensures that FPU state is correctly preserved around signal handlers in a multi-threaded scenario. Signed-off-by: Eli Cooper <elicooper@gmx.com>
1 parent 44549e8 commit 6de5a8a

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

‎arch/x86/um/signal.c‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,10 @@ static int copy_sc_from_user(struct pt_regs *regs,
225225
} else
226226
#endif
227227
{
228-
struct user_i387_struct fp;
229-
230-
err = copy_from_user(&fp, (void *)sc.fpstate,
228+
err = copy_from_user(regs->regs.fp, (void *)sc.fpstate,
231229
sizeof(struct user_i387_struct));
232230
if (err)
233231
return 1;
234-
235-
err = restore_fp_registers(pid, (unsigned long *) &fp);
236-
if (err < 0) {
237-
printk(KERN_ERR "copy_sc_from_user - "
238-
"restore_fp_registers failed, errno = %d\n",
239-
-err);
240-
return 1;
241-
}
242232
}
243233
return 0;
244234
}
@@ -325,10 +315,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
325315
} else
326316
#endif
327317
{
328-
struct user_i387_struct fp;
329-
330-
err = save_fp_registers(pid, (unsigned long *) &fp);
331-
if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
318+
if (copy_to_user(to_fp, regs->regs.fp,
319+
sizeof(struct user_i387_struct)))
332320
return 1;
333321
}
334322

0 commit comments

Comments
 (0)