x86/livepatch: Prevent patching with active waitqueues
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 25 Nov 2019 15:25:18 +0000 (16:25 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Nov 2019 15:25:18 +0000 (16:25 +0100)
commitf9ea10deceabb904bd1d00bbac2d104b46be10be
tree80f8e7dade244a985c3f4893a3d8b5794d3821f3
parent48a2e5d91fc8311d222e8b166b25fc72e755ea6e
x86/livepatch: Prevent patching with active waitqueues

The safety of livepatching depends on every stack having been unwound, but
there is one corner case where this is not true.  The Sharing/Paging/Monitor
infrastructure may use waitqueues, which copy the stack frame sideways and
longjmp() to a different vcpu.

This case is rare, and can be worked around by pausing the offending
domain(s), waiting for their rings to drain, then performing a livepatch.

In the case that there is an active waitqueue, fail the livepatch attempt with
-EBUSY, which is preforable to the fireworks which occur from trying to unwind
the old stack frame at a later point.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
master commit: ca4cd3668237d50a0b33b48e7de7f93d9475120d
master date: 2019-11-22 17:05:43 +0000
xen/arch/arm/livepatch.c
xen/arch/x86/livepatch.c
xen/common/livepatch.c
xen/include/xen/livepatch.h