linux/arch/s390
Heiko Carstens d5e50a51cc s390/pfault: fix task state race
When setting the current task state to TASK_UNINTERRUPTIBLE this can
race with a different cpu. The other cpu could set the task state after
it inspected it (while it was still TASK_RUNNING) to TASK_RUNNING which
would change the state from TASK_UNINTERRUPTIBLE to TASK_RUNNING again.

This race was always present in the pfault interrupt code but didn't
cause anything harmful before commit f2db2e6c "[S390] pfault: cpu hotplug
vs missing completion interrupts" which relied on the fact that after
setting the task state to TASK_UNINTERRUPTIBLE the task would really
sleep.
Since this is not necessarily the case the result may be a list corruption
of the pfault_list or, as observed, a use-after-free bug while trying to
access the task_struct of a task which terminated itself already.

To fix this, we need to get a reference of the affected task when receiving
the initial pfault interrupt and add special handling if we receive yet
another initial pfault interrupt when the task is already enqueued in the
pfault list.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: <stable@vger.kernel.org> # needed for v3.0 and newer
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2012-05-16 14:42:42 +02:00
..
appldata
boot s390: add various .gitignore files. 2012-05-16 14:42:41 +02:00
crypto Disintegrate asm/system.h for S390 2012-03-28 18:30:02 +01:00
hypfs switch open-coded instances of d_make_root() to new helper 2012-03-20 21:29:35 -04:00
include/asm s390/time: always use stckf instead of stck if available 2012-05-16 14:42:41 +02:00
kernel s390/time: always use stckf instead of stck if available 2012-05-16 14:42:41 +02:00
kvm Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
lib [S390] rework idle code 2012-03-11 11:59:28 -04:00
math-emu
mm s390/pfault: fix task state race 2012-05-16 14:42:42 +02:00
oprofile Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
Kbuild [S390] make arch/s390 subdirectories depend on config option 2011-12-27 11:27:12 +01:00
Kconfig s390/ipl: remove builtin tape ipl code 2012-05-16 14:42:40 +02:00
Kconfig.debug
Makefile [S390] cleanup entry point definition 2012-01-18 18:03:41 +01:00
defconfig s390/crypto des: add missing select statement 2012-05-16 14:42:36 +02:00