-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Intel] Intel: backport KVM Fix for Clearing SGX EDECCSSA to 6.6 #598
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Intel] Intel: backport KVM Fix for Clearing SGX EDECCSSA to 6.6 #598
Conversation
Upstream commit 7efb4d8a392a18e37fcdb5e77c111af6e9a9e2f2 Conflict: none When SGX EDECCSSA support was added to KVM in commit 16a7fe3 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest"), it forgot to clear the X86_FEATURE_SGX_EDECCSSA bit in KVM CPU caps when KVM SGX is disabled. Fix it. Intel-SIG: commit 7efb4d8a392a KVM: VMX: Also clear SGX EDECCSSA in KVM CPU caps when SGX is disabled Backport a SGX bug fix from upstream. Fixes: 16a7fe3 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest") Signed-off-by: Kai Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]> [ Zhiquan Li: amend commit log ] Signed-off-by: Zhiquan Li <[email protected]>
Reviewer's Guide by SourceryThis pull request backports a fix that ensures the SGX EDECCSSA capability is correctly cleared in KVM CPU caps when SGX is disabled. This is achieved by adding a No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Avenger-285714 - I've reviewed your changes - here's some feedback:
Overall Comments:
- The commit message is well-formatted and provides sufficient context for the change.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sourcery-ai[bot] The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
0291c94
into
deepin-community:linux-6.6.y
Description
When SGX EDECCSSA support was added to KVM in commit 16a7fe3 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest"), it forgot to clear the X86_FEATURE_SGX_EDECCSSA bit in KVM CPU caps when KVM SGX is disabled. Fix it.
Fixes: 16a7fe3 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest")
About the patches
The total patch number is 1:
7efb4d8a392a KVM: VMX: Also clear SGX EDECCSSA in KVM CPU caps when SGX is disabled
Tests
Build successfully for each commit
Kernel selftest - SGX: PASSED
cd tools/testing/selftests/sgx/
make
./test_sgx
Kernel selftest - SGX in VM: PASSED
Function test
Step 1. Original SGX EDECCSSA status in guest
[root@guest ~]# cpuid -1 -l 0x12
CPU:
Software Guard Extensions (SGX) capability (0x12/0):
SGX1 supported = true
SGX2 supported = true
SGX ENCLV E*VIRTCHILD, ESETCONTEXT = false
SGX ENCLS ETRACKC, ERDINFO, ELDBC, ELDUC = false
SGX ENCLU EVERIFYREPORT2 = false
SGX ENCLS EUPDATESVN = false
SGX ENCLU EDECCSSA = true
MISCSELECT.EXINFO supported: #PF & #GP = true
MISCSELECT.CPINFO supported: #CP = false
MaxEnclaveSize_Not64 (log2) = 0x1f (31)
MaxEnclaveSize_64 (log2) = 0x38 (56)
Step 2. Disable SGX in guest
root@KVM-host:
# rmmod kvm_intel# modprobe kvm_intel sgx=0root@KVM-host:
Step 3. The SGX EDECCSSA capability is cleared in KVM, then its status becomes false
[root@guest ~]# cpuid -1 -l 0x12
CPU:
Software Guard Extensions (SGX) capability (0x12/0):
SGX1 supported = false
SGX2 supported = false
SGX ENCLV E*VIRTCHILD, ESETCONTEXT = false
SGX ENCLS ETRACKC, ERDINFO, ELDBC, ELDUC = false
SGX ENCLU EVERIFYREPORT2 = false
SGX ENCLS EUPDATESVN = false
SGX ENCLU EDECCSSA = false
MISCSELECT.EXINFO supported: #PF & #GP = false
MISCSELECT.CPINFO supported: #CP = false
MaxEnclaveSize_Not64 (log2) = 0x0 (0)
MaxEnclaveSize_64 (log2) = 0x0 (0)
[root@TDX-guest ~]#
Known issue:
None
Default config change:
None
Link: https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel/pulls/307
Upstream commit 7efb4d8a392a18e37fcdb5e77c111af6e9a9e2f2 Conflict: none
When SGX EDECCSSA support was added to KVM in commit 16a7fe3 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest"), it forgot to clear the X86_FEATURE_SGX_EDECCSSA bit in KVM CPU caps when KVM SGX is disabled. Fix it.
Intel-SIG: commit 7efb4d8a392a KVM: VMX: Also clear SGX EDECCSSA in KVM CPU caps when SGX is disabled
Backport a SGX bug fix from upstream.
Fixes: 16a7fe3 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest")
Link: https://lore.kernel.org/r/[email protected]
[ Zhiquan Li: amend commit log ]
Summary by Sourcery
Bug Fixes: