Commit 2a8dfab
KVM: arm64: Block cacheable PFNMAP mapping
Fixes a security bug due to mismatched attributes between S1 and
S2 mapping.
Currently, it is possible for a region to be cacheable in the userspace
VMA, but mapped non cached in S2. This creates a potential issue where
the VMM may sanitize cacheable memory across VMs using cacheable stores,
ensuring it is zeroed. However, if KVM subsequently assigns this memory
to a VM as uncached, the VM could end up accessing stale, non-zeroed data
from a previous VM, leading to unintended data exposure. This is a security
risk.
Block such mismatch attributes case by returning EINVAL when userspace
try to map PFNMAP cacheable. Only allow NORMAL_NC and DEVICE_*.
CC: Oliver Upton <[email protected]>
CC: Catalin Marinas <[email protected]>
CC: Sean Christopherson <[email protected]>
Suggested-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Tested-by: Donald Dutile <[email protected]>
Signed-off-by: Ankit Agrawal <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Oliver Upton <[email protected]>1 parent 216887f commit 2a8dfab
1 file changed
+30
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1465 | 1465 | | |
1466 | 1466 | | |
1467 | 1467 | | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
1468 | 1480 | | |
1469 | 1481 | | |
1470 | 1482 | | |
1471 | 1483 | | |
1472 | 1484 | | |
1473 | 1485 | | |
1474 | 1486 | | |
1475 | | - | |
| 1487 | + | |
1476 | 1488 | | |
1477 | 1489 | | |
1478 | 1490 | | |
| |||
1617 | 1629 | | |
1618 | 1630 | | |
1619 | 1631 | | |
| 1632 | + | |
| 1633 | + | |
1620 | 1634 | | |
1621 | 1635 | | |
1622 | 1636 | | |
| |||
1660 | 1674 | | |
1661 | 1675 | | |
1662 | 1676 | | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
1663 | 1686 | | |
1664 | 1687 | | |
1665 | 1688 | | |
| |||
2219 | 2242 | | |
2220 | 2243 | | |
2221 | 2244 | | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
2222 | 2251 | | |
2223 | 2252 | | |
2224 | 2253 | | |
| |||
0 commit comments