From: Eli Cooper <elicooper@gmx.com>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: Richard Weinberger <richard@nod.at>, Jeff Dike <jdike@addtoit.com>
Subject: [uml-devel] [PATCH v3 1/3] um: fix FPU state preservation around signal handlers
Date: Sun, 20 Mar 2016 00:58:39 +0800 [thread overview]
Message-ID: <1458406721-7478-2-git-send-email-elicooper@gmx.com> (raw)
In-Reply-To: <1458406721-7478-1-git-send-email-elicooper@gmx.com>
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>
---
arch/x86/um/signal.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
index 14fcd01..dac23ee 100644
--- a/arch/x86/um/signal.c
+++ b/arch/x86/um/signal.c
@@ -225,20 +225,10 @@ static int copy_sc_from_user(struct pt_regs *regs,
} else
#endif
{
- struct user_i387_struct fp;
-
- err = copy_from_user(&fp, (void *)sc.fpstate,
+ err = copy_from_user(regs->regs.fp, (void *)sc.fpstate,
sizeof(struct user_i387_struct));
if (err)
return 1;
-
- err = restore_fp_registers(pid, (unsigned long *) &fp);
- if (err < 0) {
- printk(KERN_ERR "copy_sc_from_user - "
- "restore_fp_registers failed, errno = %d\n",
- -err);
- return 1;
- }
}
return 0;
}
@@ -325,10 +315,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
} else
#endif
{
- struct user_i387_struct fp;
-
- err = save_fp_registers(pid, (unsigned long *) &fp);
- if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
+ if (copy_to_user(to_fp, regs->regs.fp,
+ sizeof(struct user_i387_struct)))
return 1;
}
--
2.7.2
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2016-03-19 16:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-19 16:58 [uml-devel] [PATCH v3 0/3] um: fix and extend FPU support Eli Cooper
2016-03-19 16:58 ` Eli Cooper [this message]
2016-03-19 16:58 ` [uml-devel] [PATCH v3 2/3] um: extend fpstate to _xstate to support YMM registers Eli Cooper
2016-03-19 16:58 ` [uml-devel] [PATCH v3 3/3] um: add extended processor state save/restore support Eli Cooper
2016-04-04 21:42 ` [uml-devel] [PATCH v3 0/3] um: fix and extend FPU support Richard Weinberger
2016-05-20 15:31 ` Eli Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458406721-7478-2-git-send-email-elicooper@gmx.com \
--to=elicooper@gmx.com \
--cc=jdike@addtoit.com \
--cc=richard@nod.at \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).