mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
x86/pv: fix MMUEXT_FLUSH_CACHE to flush all pCPU caches
The implementation of MMUEXT_FLUSH_CACHE is bogus, as it doesn't account to flush the cache of any previous pCPU where the current vCPU might have run, and hence is likely to not work as expected. Fix this by resorting to use the same logic as MMUEXT_FLUSH_CACHE_GLOBAL, which will be correct in all cases. Adjust MMUEXT_FLUSH_CACHE_GLOBAL return code in case cache flush is not permitted for the domain to use -EACCES instead of -EINVAL, as that's more accurate and also matches the error code used by MMUEXT_FLUSH_CACHE. Fixes:8e90e37e6d("Fix WBINVD by adding a new hypercall.") Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> master commit:bbaea9878bmaster date: 2025-05-13 19:43:48 +0200
This commit is contained in:
1 parent
f938c08494
commit
ee150f56fc
1 file changed
+6
-9
+6
-9
@@ -3811,14 +3811,11 @@ long do_mmuext_op(
|
||||
break;
|
||||
|
||||
case MMUEXT_FLUSH_CACHE:
|
||||
if ( unlikely(currd != pg_owner) )
|
||||
rc = -EPERM;
|
||||
else if ( unlikely(!cache_flush_permitted(currd)) )
|
||||
rc = -EACCES;
|
||||
else
|
||||
wbinvd();
|
||||
break;
|
||||
|
||||
/*
|
||||
* Dirty pCPU caches where the current vCPU has been scheduled are
|
||||
* not tracked, and hence we need to resort to a global cache
|
||||
* flush for correctness.
|
||||
*/
|
||||
case MMUEXT_FLUSH_CACHE_GLOBAL:
|
||||
if ( unlikely(currd != pg_owner) )
|
||||
rc = -EPERM;
|
||||
@@ -3835,7 +3832,7 @@ long do_mmuext_op(
|
||||
flush_mask(mask, FLUSH_CACHE);
|
||||
}
|
||||
else
|
||||
rc = -EINVAL;
|
||||
rc = -EACCES;
|
||||
break;
|
||||
|
||||
case MMUEXT_SET_LDT:
|
||||
|
||||