Suresh Siddha
870568b390
x86, fpu: fix CONFIG_PREEMPT=y corruption of application's FPU stack
...
Jürgen Mell reported an FPU state corruption bug under CONFIG_PREEMPT,
and bisected it to commit v2.6.19-1363-gacc2076, "i386: add sleazy FPU
optimization".
Add tsk_used_math() checks to prevent calling math_state_restore()
which can sleep in the case of !tsk_used_math(). This prevents
making a blocking call in __switch_to().
Apparently "fpu_counter > 5" check is not enough, as in some signal handling
and fork/exec scenarios, fpu_counter > 5 and !tsk_used_math() is possible.
It's a side effect though. This is the failing scenario:
process 'A' in save_i387_ia32() just after clear_used_math()
Got an interrupt and pre-empted out.
At the next context switch to process 'A' again, kernel tries to restore
the math state proactively and sees a fpu_counter > 0 and !tsk_used_math()
This results in init_fpu() during the __switch_to()'s math_state_restore()
And resulting in fpu corruption which will be saved/restored
(save_i387_fxsave and restore_i387_fxsave) during the remaining
part of the signal handling after the context switch.
Bisected-by: Jürgen Mell <j.mell@t-online.de >
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com >
Tested-by: Jürgen Mell <j.mell@t-online.de >
Signed-off-by: Ingo Molnar <mingo@elte.hu >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: stable@kernel.org
2008-06-04 16:21:24 +02:00
..
2008-06-04 13:11:46 +02:00
2008-05-19 18:17:28 -04:00
2007-10-17 21:19:04 +02:00
2008-04-25 19:54:07 +02:00
2008-04-17 17:41:19 +02:00
2008-04-26 17:35:47 +02:00
2008-05-23 14:08:06 +02:00
Merge branches 'release', 'acpica', 'bugzilla-10224', 'bugzilla-9772', 'bugzilla-9916', 'ec', 'eeepc', 'idle', 'misc', 'pm-legacy', 'sysfs-links-2.6.26', 'thermal', 'thinkpad' and 'video' into release
2008-04-30 13:58:00 -04:00
2008-04-29 08:06:29 -07:00
2008-04-29 08:06:29 -07:00
2007-10-11 11:17:01 +02:00
2007-10-11 11:17:24 +02:00
2008-01-30 13:32:31 +01:00
2008-04-17 17:41:30 +02:00
2008-04-19 19:10:28 -07:00
2007-10-19 11:53:33 -07:00
2007-10-13 10:01:23 -07:00
2008-04-27 12:00:29 +03:00
2008-01-30 13:31:31 +01:00
2008-04-17 17:41:34 +02:00
2008-04-19 19:19:55 +02:00
2008-04-29 13:45:24 +02:00
2008-04-17 17:40:51 +02:00
2008-01-30 13:33:37 +01:00
2008-02-19 16:18:28 +01:00
2008-04-19 19:19:54 +02:00
2007-10-11 11:17:01 +02:00
2008-01-30 13:31:19 +01:00
2008-04-19 19:19:54 +02:00
2008-04-24 23:57:33 +02:00
2008-04-17 17:41:13 +02:00
2008-04-30 23:15:34 +02:00
2008-04-17 17:41:36 +02:00
2008-04-19 19:19:58 +02:00
2008-05-08 15:43:50 +02:00
2008-04-17 17:40:49 +02:00
2008-04-26 21:34:42 +02:00
2008-04-30 23:15:34 +02:00
2008-04-17 17:41:37 +02:00
2008-04-30 23:15:34 +02:00
2008-04-17 10:42:34 -04:00
2008-06-04 13:11:46 +02:00
2008-01-24 20:40:40 -08:00
2008-04-26 17:35:47 +02:00
2008-02-19 16:18:34 +01:00
2008-01-30 13:33:19 +01:00
2008-05-16 17:22:20 -04:00
2008-04-28 10:49:17 -07:00
2008-04-26 17:35:48 +02:00
2008-03-26 22:23:40 +01:00
2008-01-30 13:33:10 +01:00
2008-04-17 17:40:56 +02:00
2008-04-29 08:06:02 -07:00
2008-01-30 13:30:56 +01:00
2007-10-11 11:17:24 +02:00
2008-04-26 21:34:42 +02:00
2008-04-19 19:19:54 +02:00
2008-04-17 17:41:33 +02:00
2008-04-27 12:00:28 +03:00
2008-05-23 14:08:06 +02:00
2008-02-04 16:48:03 +01:00
2008-02-07 08:42:25 -08:00
2008-04-02 15:28:19 -07:00
2008-05-07 12:42:03 +02:00
2008-04-17 17:40:49 +02:00
2008-04-28 08:58:35 -07:00
2008-04-19 19:44:58 +02:00
2008-04-26 23:41:04 +02:00
2007-10-11 11:17:01 +02:00
2007-10-11 11:17:24 +02:00
2008-05-04 20:04:45 +02:00
2008-04-19 19:10:28 -07:00
2008-04-19 19:19:55 +02:00
2008-04-19 19:19:55 +02:00
2008-01-30 13:33:20 +01:00
2008-04-29 08:06:07 -07:00
2008-01-30 13:32:10 +01:00
2008-01-30 13:33:19 +01:00
2008-04-24 23:57:31 +02:00
2008-04-26 17:35:47 +02:00
2008-05-12 21:27:50 +02:00
2008-06-04 13:11:47 +02:00
2008-04-19 19:19:57 +02:00
2008-04-19 19:19:56 +02:00
2007-10-11 11:17:01 +02:00
2008-01-30 13:30:18 +01:00
2008-06-04 16:21:24 +02:00
2008-06-04 16:21:24 +02:00
2008-05-17 22:57:20 +02:00
2008-05-13 19:40:20 +02:00
2008-03-21 17:06:15 +01:00
2008-01-30 13:33:36 +01:00
2008-05-04 20:04:45 +02:00
2008-04-17 17:41:29 +02:00
2008-04-17 17:41:29 +02:00
2008-04-17 17:40:47 +02:00
2008-01-31 22:05:45 +01:00
2008-04-19 19:19:55 +02:00
2008-05-10 19:31:45 +02:00
2008-05-13 19:37:38 +02:00
2008-05-12 21:27:51 +02:00
2008-04-17 17:40:46 +02:00
2008-04-30 08:29:37 -07:00
2008-04-30 08:29:37 -07:00
2008-05-13 19:36:12 +02:00
2008-06-04 13:11:46 +02:00
2008-04-17 17:40:55 +02:00
2008-04-17 17:40:55 +02:00
2008-04-17 17:40:57 +02:00
2008-02-26 12:55:58 +01:00
2008-04-17 17:40:58 +02:00
2008-04-26 17:35:47 +02:00
2008-05-03 13:50:33 -07:00
2008-05-03 13:50:33 -07:00
2008-04-17 17:40:48 +02:00
2008-02-05 09:44:07 -08:00
2007-10-17 20:16:12 +02:00
2008-04-17 17:41:15 +02:00
2008-02-14 23:30:20 +01:00
2008-04-29 08:06:03 -07:00
2008-02-08 09:22:29 -08:00
2008-04-17 17:40:56 +02:00
2008-04-26 17:35:47 +02:00
2008-04-10 17:28:26 -07:00
2008-01-30 13:31:52 +01:00
2008-02-19 16:18:30 +01:00
2008-04-26 17:35:47 +02:00
2008-04-17 17:41:37 +02:00
2008-04-17 17:41:37 +02:00
2008-04-26 17:35:46 +02:00
2008-04-19 19:19:55 +02:00
2008-05-23 14:08:06 +02:00
2008-05-23 14:08:06 +02:00
2008-01-30 13:33:24 +01:00
2007-10-11 11:17:24 +02:00
2008-04-17 17:41:33 +02:00
2008-04-24 23:57:31 +02:00
2008-01-30 13:33:14 +01:00
2008-04-17 17:40:47 +02:00
2008-04-28 13:49:35 -07:00
2007-10-11 11:17:01 +02:00
2008-04-29 13:45:24 +02:00
2008-04-24 23:15:44 +02:00
2008-05-13 19:38:47 +02:00