Files
android_kernel_xiaomi_sm8450/arch/x86/include/asm
Boqun Feng a2b7861bb3 kvm/x86: Avoid async PF preempting the kernel incorrectly
Currently, in PREEMPT_COUNT=n kernel, kvm_async_pf_task_wait() could call
schedule() to reschedule in some cases.  This could result in
accidentally ending the current RCU read-side critical section early,
causing random memory corruption in the guest, or otherwise preempting
the currently running task inside between preempt_disable and
preempt_enable.

The difficulty to handle this well is because we don't know whether an
async PF delivered in a preemptible section or RCU read-side critical section
for PREEMPT_COUNT=n, since preempt_disable()/enable() and rcu_read_lock/unlock()
are both no-ops in that case.

To cure this, we treat any async PF interrupting a kernel context as one
that cannot be preempted, preventing kvm_async_pf_task_wait() from choosing
the schedule() path in that case.

To do so, a second parameter for kvm_async_pf_task_wait() is introduced,
so that we know whether it's called from a context interrupting the
kernel, and the parameter is set properly in all the callsites.

Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
2017-10-04 18:28:53 +02:00
..
2017-07-20 12:31:04 +02:00
2014-12-11 11:35:02 +01:00
2015-05-28 15:31:53 +02:00
2012-03-28 18:11:12 +01:00
2015-10-21 11:17:32 +02:00
2015-04-24 15:36:55 +02:00
2015-07-31 13:31:10 +02:00
2017-09-07 11:53:11 +02:00
2014-02-27 08:07:39 -08:00
2017-07-26 13:18:20 +02:00
2017-07-26 13:18:20 +02:00
2017-07-26 13:18:20 +02:00
2017-06-28 22:32:55 +02:00
2017-08-21 11:35:50 +02:00
2017-08-03 23:26:22 +02:00
2015-05-19 15:47:30 +02:00
2016-01-30 11:22:17 +01:00
2017-08-23 18:37:37 +02:00
2015-07-31 13:31:10 +02:00
2017-03-29 12:06:28 -04:00
2017-04-17 12:52:22 -04:00
2016-06-16 00:04:31 +02:00
2015-05-19 15:47:30 +02:00