]> xenbits.xensource.com Git - xen.git/commitdiff
evtchn/FIFO: add 2nd smp_rmb() to evtchn_fifo_word_from_port()
authorJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2020 12:42:51 +0000 (13:42 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2020 12:42:51 +0000 (13:42 +0100)
Besides with add_page_to_event_array() the function also needs to
synchronize with evtchn_fifo_init_control() setting both d->evtchn_fifo
and (subsequently) d->evtchn_port_ops.

This is XSA-359 / CVE-2020-29571.

Reported-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/common/event_fifo.c

index d508d572198b7b1584b29b65a0f2c84082297039..3310dc00d7c6e278789501a31d8d07502987169d 100644 (file)
@@ -55,6 +55,13 @@ static inline event_word_t *evtchn_fifo_word_from_port(const struct domain *d,
 {
     unsigned int p, w;
 
+    /*
+     * Callers aren't required to hold d->event_lock, so we need to synchronize
+     * with evtchn_fifo_init_control() setting d->evtchn_port_ops /after/
+     * d->evtchn_fifo.
+     */
+    smp_rmb();
+
     if ( unlikely(port >= d->evtchn_fifo->num_evtchns) )
         return NULL;
 
@@ -605,6 +612,10 @@ int evtchn_fifo_init_control(struct evtchn_init_control *init_control)
         if ( rc < 0 )
             goto error;
 
+        /*
+         * This call, as a side effect, synchronizes with
+         * evtchn_fifo_word_from_port().
+         */
         rc = map_control_block(v, gfn, offset);
         if ( rc < 0 )
             goto error;