]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen/gnttab: limit cache flush operation to guests allowed cache control
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 5 May 2025 07:58:08 +0000 (09:58 +0200)
committerRoger Pau Monne <roger.pau@citrix.com>
Tue, 6 May 2025 08:02:36 +0000 (10:02 +0200)
Whether a domain is allowed to issue cache-control operations is reported
by the cache_flush_permitted() check.  Introduce such check to limit the
availability of GNTTABOP_cache_flush to only guests that are granted cache
control.

Fixes: 18e8d22fe750 ("introduce GNTTABOP_cache_flush")
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
xen/common/grant_table.c

index e75ff98aff1c745b249d932b4b132bb8ee1c38c1..d874ac5f1241bb6cbc466ef6da8bada5d0146206 100644 (file)
@@ -3780,6 +3780,11 @@ long do_grant_table_op(
 
         if ( unlikely(!guest_handle_okay(cflush, count)) )
             goto out;
+
+        rc = -EPERM;
+        if ( !cache_flush_permitted(current->domain) )
+            goto out;
+
         rc = gnttab_cache_flush(cflush, &opaque_in, count);
         if ( rc >= 0 )
         {