diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-03-03 16:01:08 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-03-04 11:10:12 -0500 |
commit | 18a8622101154277df97e24097ed17aace84fa3a (patch) | |
tree | 3e0581e849c67539b9695b88fc08a68b811cd9e5 /arch/x86/kernel/i387.c | |
parent | 976dde010e513a9c7c3117a32b7b015f84b37430 (diff) |
x86, i387: fix ptrace leakage using init_fpu()
This bug got introduced by the recent i387 merge:
commit 4421011120b2304e5c248ae4165a2704588aedf1
Author: Roland McGrath <roland@redhat.com>
Date: Wed Jan 30 13:31:50 2008 +0100
x86: x86 i387 user_regset
Current usage of unlazy_fpu() in ptrace specific routines is wrong.
unlazy_fpu() will not init fpu if the task never used math. So the
ptrace calls can expose the parent tasks FPU data in some cases.
Replace it with the init_fpu() which will init the math state, if the
task never used math before.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/i387.c')
-rw-r--r-- | arch/x86/kernel/i387.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 763dfc407232..60fe80157569 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -132,7 +132,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset, | |||
132 | if (!cpu_has_fxsr) | 132 | if (!cpu_has_fxsr) |
133 | return -ENODEV; | 133 | return -ENODEV; |
134 | 134 | ||
135 | unlazy_fpu(target); | 135 | init_fpu(target); |
136 | 136 | ||
137 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 137 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
138 | &target->thread.i387.fxsave, 0, -1); | 138 | &target->thread.i387.fxsave, 0, -1); |
@@ -147,7 +147,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
147 | if (!cpu_has_fxsr) | 147 | if (!cpu_has_fxsr) |
148 | return -ENODEV; | 148 | return -ENODEV; |
149 | 149 | ||
150 | unlazy_fpu(target); | 150 | init_fpu(target); |
151 | set_stopped_child_used_math(target); | 151 | set_stopped_child_used_math(target); |
152 | 152 | ||
153 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 153 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
@@ -307,7 +307,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset, | |||
307 | if (!HAVE_HWFP) | 307 | if (!HAVE_HWFP) |
308 | return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf); | 308 | return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf); |
309 | 309 | ||
310 | unlazy_fpu(target); | 310 | init_fpu(target); |
311 | 311 | ||
312 | if (!cpu_has_fxsr) | 312 | if (!cpu_has_fxsr) |
313 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 313 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
@@ -332,7 +332,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
332 | if (!HAVE_HWFP) | 332 | if (!HAVE_HWFP) |
333 | return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf); | 333 | return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf); |
334 | 334 | ||
335 | unlazy_fpu(target); | 335 | init_fpu(target); |
336 | set_stopped_child_used_math(target); | 336 | set_stopped_child_used_math(target); |
337 | 337 | ||
338 | if (!cpu_has_fxsr) | 338 | if (!cpu_has_fxsr) |