Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1398592 > unrolled thread
| Started by | Yu-cheng Yu <yu-cheng.yu@intel.com> |
|---|---|
| First post | 2016-05-11 01:40 +0200 |
| Last post | 2016-05-11 01:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v6 10/13] x86/xsaves: Fix __fpu_restore_sig() for XSAVES Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-11 01:40 +0200
| From | Yu-cheng Yu <yu-cheng.yu@intel.com> |
|---|---|
| Date | 2016-05-11 01:40 +0200 |
| Subject | [PATCH v6 10/13] x86/xsaves: Fix __fpu_restore_sig() for XSAVES |
| Message-ID | <rxppU-4nc-17@gated-at.bofh.it> |
When the kernel is using XSAVES compacted format, we cannot do
__copy_from_user() from a signal frame, which has standard-format data.
Fix it by using copyin_to_xsaves(), which converts between formats and
filters out all supervisor states that we do not allow userspace to
write.
Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
---
arch/x86/kernel/fpu/signal.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index 9ce2963..abc96b2 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -321,8 +321,15 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
*/
fpu__drop(fpu);
- if (__copy_from_user(&fpu->state.xsave, buf_fx, state_size) ||
- __copy_from_user(&env, buf, sizeof(env))) {
+ if (using_compacted_format()) {
+ err = copyin_to_xsaves(NULL, buf_fx,
+ &fpu->state.xsave);
+ } else {
+ err = __copy_from_user(&fpu->state.xsave,
+ buf_fx, state_size);
+ }
+
+ if (err || __copy_from_user(&env, buf, sizeof(env))) {
fpstate_init(&fpu->state);
err = -1;
} else {
--
1.9.1
Back to top | Article view | linux.kernel
csiph-web