Skip to content

Commit 36c8673

Browse files
author
Al Viro
committed
x86: copy_fpstate_to_sigframe(): have fpregs_soft_get() use kernel buffer
... then copy_to_user() the results Signed-off-by: Al Viro <[email protected]>
1 parent b3a9e3b commit 36c8673

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/x86/kernel/fpu/signal.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size)
170170
ia32_fxstate &= (IS_ENABLED(CONFIG_X86_32) ||
171171
IS_ENABLED(CONFIG_IA32_EMULATION));
172172

173+
if (!static_cpu_has(X86_FEATURE_FPU)) {
174+
struct user_i387_ia32_struct fp;
175+
fpregs_soft_get(current, NULL, 0, sizeof(fp), &fp, NULL);
176+
return copy_to_user(buf, &fp, sizeof(fp)) ? -EFAULT : 0;
177+
}
178+
173179
if (!access_ok(buf, size))
174180
return -EACCES;
175-
176-
if (!static_cpu_has(X86_FEATURE_FPU))
177-
return fpregs_soft_get(current, NULL, 0,
178-
sizeof(struct user_i387_ia32_struct), NULL,
179-
(struct _fpstate_32 __user *) buf) ? -1 : 1;
180-
181181
retry:
182182
/*
183183
* Load the FPU registers if they are not valid for the current task.

0 commit comments

Comments
 (0)