Commit ff8071e
committed
KVM: VMX: Always reflect SGX EPCM #PFs back into the guest
When handling intercepted #PFs, reflect EPCM (Enclave Page Cache Map)
violations, i.e. #PFs with the SGX flag set, back into the guest. KVM
doesn't shadow EPCM entries (the EPCM deals only with virtual/linear
addresses), and so EPCM violation cannot be due to KVM interference,
and more importantly can't be resolved by KVM.
On pre-SGX2 hardware, EPCM violations are delivered as #GP(0) faults, but
on SGX2+ hardware, they are delivered as #PF(SGX). Failure to account for
the SGX2 behavior could put a vCPU into an infinite loop due to KVM not
realizing the #PF is the guest's responsibility.
Take care to deliver the EPCM violation as a #GP(0) if the _guest_ CPU
model is only SGX1.
Fixes: 72add91 ("KVM: VMX: Enable SGX virtualization for SGX1, SGX2 and LC")
Cc: Kai Huang <kai.huang@intel.com>
Reviewed-by: Richard Lyu <richard.lyu@suse.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://patch.msgid.link/20251121222018.348987-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent 9ace475 commit ff8071e
1 file changed
Lines changed: 44 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5303 | 5303 | | |
5304 | 5304 | | |
5305 | 5305 | | |
| 5306 | + | |
| 5307 | + | |
| 5308 | + | |
| 5309 | + | |
| 5310 | + | |
| 5311 | + | |
| 5312 | + | |
| 5313 | + | |
| 5314 | + | |
| 5315 | + | |
| 5316 | + | |
| 5317 | + | |
| 5318 | + | |
| 5319 | + | |
| 5320 | + | |
| 5321 | + | |
| 5322 | + | |
| 5323 | + | |
| 5324 | + | |
| 5325 | + | |
| 5326 | + | |
| 5327 | + | |
| 5328 | + | |
| 5329 | + | |
| 5330 | + | |
| 5331 | + | |
| 5332 | + | |
| 5333 | + | |
| 5334 | + | |
| 5335 | + | |
| 5336 | + | |
| 5337 | + | |
| 5338 | + | |
| 5339 | + | |
| 5340 | + | |
| 5341 | + | |
| 5342 | + | |
| 5343 | + | |
| 5344 | + | |
| 5345 | + | |
| 5346 | + | |
5306 | 5347 | | |
5307 | 5348 | | |
5308 | 5349 | | |
5309 | 5350 | | |
5310 | 5351 | | |
5311 | | - | |
| 5352 | + | |
5312 | 5353 | | |
5313 | 5354 | | |
5314 | 5355 | | |
| |||
5383 | 5424 | | |
5384 | 5425 | | |
5385 | 5426 | | |
5386 | | - | |
5387 | | - | |
5388 | | - | |
5389 | | - | |
5390 | | - | |
5391 | | - | |
5392 | | - | |
5393 | | - | |
5394 | | - | |
5395 | | - | |
5396 | | - | |
5397 | | - | |
5398 | | - | |
| 5427 | + | |
| 5428 | + | |
5399 | 5429 | | |
5400 | 5430 | | |
5401 | 5431 | | |
| |||
0 commit comments