Open
Conversation
Injecting software interrupts will change the guest's RIP. As there is no usage to require the host to do so for a pVM, disallow the host to inject software interrupts to a pVM for security reason. Fixes: 3974ce6 ("pKVM: x86: Add event injection PV interfaces") Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
As the host is not allowed to inject the pVM's software interrupt, and the pending pVM's software interrupt (exits during delivering a software interrupt) should be injected by the pKVM, thus the host cannot cancel such injection. Fixes: addc9b4 ("pKVM: x86 Add cancel injection PV interface") Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Refactor pkvm_inject_nmi() to return -EBUSY if the NMI is not allowed. This is aligned with the pkvm_inject_irq(). Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
The host is allowed to use __pkvm__inject_irq to inject interrupts to a pVM. However the injected interrupt number is not limited to be interrupts only. A malicious host can use this PV interface to inject an interrupt with the vector number from 0 ~ 31, which are the reserved number by the Intel 64 and IA-32 architectures for architecture-defined exceptions. As the pVM's exceptions are emulated and injected by the pKVM itself, the host is not allowed to inject any exception to a pVM but is expected to only injects external interrupts, validate the interrupt vector number to make sure only the number for external interrupts can be injected. Fixes: 3974ce6 ("pKVM: x86: Add event injection PV interfaces") Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Validate the passed in max_isr value from the host for the same security reason with the PV interface __pkvm__inject_irq, to make sure it is not an exception vector for the pVM as the pVM's exceptions are emulated and injected by the pKVM itself, and the host is not allowed to inject exceptions to the pVM. Fixes: b2743f1 ("pKVM: x86: Add hwapic_isr_update PV interface") Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Validate the passed in pir value from the host for the same security reason with the PV interface __pkvm__inject_irq, to make sure it is not an exception vector for the pVM as the pVM's exceptions are emulated and injected by the pKVM itself, and the host is not allowed to inject exceptions to the pVM. Fixes: b7f4d37 ("pKVM: x86: Add sync_pir_to_irr PV interface") Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
f4bd6a9 to
aa7ffd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disable the software interrupt injection to the pVM, and validate the injected interrupt vector number is not in the range of 0 ~ 31.