]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
xen/events: add a proper barrier to 2-level uevent unmasking
authorJuergen Gross <jgross@suse.com>
Tue, 3 Nov 2020 14:29:00 +0000 (15:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 17:28:01 +0000 (18:28 +0100)
commit 4d3fe31bd993ef504350989786858aefdb877daa upstream.

A follow-up patch will require certain write to happen before an event
channel is unmasked.

While the memory barrier is not strictly necessary for all the callers,
the main one will need it. In order to avoid an extra memory barrier
when using fifo event channels, mandate evtchn_unmask() to provide
write ordering.

The 2-level event handling unmask operation is missing an appropriate
barrier, so add it. Fifo event channels are fine in this regard due to
using sync_cmpxchg().

This is part of XSA-332.

Cc: stable@vger.kernel.org
Suggested-by: Julien Grall <julien@xen.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Wei Liu <wl@xen.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/events/events_2l.c

index 8edef51c92e597ba5fd702dc3fcd20590cac2ae8..e4b75693600ef879ec475a18b532cd793b3daa59 100644 (file)
@@ -91,6 +91,8 @@ static void evtchn_2l_unmask(unsigned port)
 
        BUG_ON(!irqs_disabled());
 
+       smp_wmb();      /* All writes before unmask must be visible. */
+
        if (unlikely((cpu != cpu_from_evtchn(port))))
                do_hypercall = 1;
        else {