Commit ac8d6ca
KVM: x86: Only do MSR filtering when access MSR by rdmsr/wrmsr
If MSR access is rejected by MSR filtering,
kvm_set_msr()/kvm_get_msr() would return KVM_MSR_RET_FILTERED,
and the return value is only handled well for rdmsr/wrmsr.
However, some instruction emulation and state transition also
use kvm_set_msr()/kvm_get_msr() to do msr access but may trigger
some unexpected results if MSR access is rejected, E.g. RDPID
emulation would inject a #UD but RDPID wouldn't cause a exit
when RDPID is supported in hardware and ENABLE_RDTSCP is set.
And it would also cause failure when load MSR at nested entry/exit.
Since msr filtering is based on MSR bitmap, it is better to only
do MSR filtering for rdmsr/wrmsr.
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Message-Id: <2b2774154f7532c96a6f04d71c82a8bec7d9e80b.1646655860.git.houwenlong.hwl@antgroup.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent a836839 commit ac8d6ca
3 files changed
Lines changed: 40 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3625 | 3625 | | |
3626 | 3626 | | |
3627 | 3627 | | |
3628 | | - | |
| 3628 | + | |
3629 | 3629 | | |
3630 | 3630 | | |
3631 | 3631 | | |
| |||
3642 | 3642 | | |
3643 | 3643 | | |
3644 | 3644 | | |
3645 | | - | |
| 3645 | + | |
3646 | 3646 | | |
3647 | 3647 | | |
3648 | 3648 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1748 | 1748 | | |
1749 | 1749 | | |
1750 | 1750 | | |
1751 | | - | |
1752 | | - | |
1753 | | - | |
1754 | 1751 | | |
1755 | 1752 | | |
1756 | 1753 | | |
| |||
1832 | 1829 | | |
1833 | 1830 | | |
1834 | 1831 | | |
1835 | | - | |
1836 | | - | |
1837 | | - | |
1838 | 1832 | | |
1839 | 1833 | | |
1840 | 1834 | | |
| |||
1871 | 1865 | | |
1872 | 1866 | | |
1873 | 1867 | | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
1874 | 1882 | | |
1875 | 1883 | | |
1876 | 1884 | | |
| |||
1953 | 1961 | | |
1954 | 1962 | | |
1955 | 1963 | | |
1956 | | - | |
| 1964 | + | |
1957 | 1965 | | |
1958 | 1966 | | |
1959 | 1967 | | |
| |||
1978 | 1986 | | |
1979 | 1987 | | |
1980 | 1988 | | |
1981 | | - | |
| 1989 | + | |
1982 | 1990 | | |
1983 | 1991 | | |
1984 | 1992 | | |
| |||
7631 | 7639 | | |
7632 | 7640 | | |
7633 | 7641 | | |
7634 | | - | |
7635 | | - | |
| 7642 | + | |
| 7643 | + | |
7636 | 7644 | | |
7637 | 7645 | | |
7638 | 7646 | | |
7639 | 7647 | | |
7640 | | - | |
| 7648 | + | |
7641 | 7649 | | |
7642 | 7650 | | |
7643 | 7651 | | |
| |||
7648 | 7656 | | |
7649 | 7657 | | |
7650 | 7658 | | |
7651 | | - | |
7652 | | - | |
| 7659 | + | |
| 7660 | + | |
7653 | 7661 | | |
7654 | 7662 | | |
7655 | 7663 | | |
7656 | 7664 | | |
7657 | | - | |
| 7665 | + | |
7658 | 7666 | | |
7659 | 7667 | | |
7660 | 7668 | | |
| |||
7665 | 7673 | | |
7666 | 7674 | | |
7667 | 7675 | | |
| 7676 | + | |
| 7677 | + | |
| 7678 | + | |
| 7679 | + | |
| 7680 | + | |
| 7681 | + | |
| 7682 | + | |
| 7683 | + | |
| 7684 | + | |
| 7685 | + | |
| 7686 | + | |
| 7687 | + | |
7668 | 7688 | | |
7669 | 7689 | | |
7670 | 7690 | | |
| |||
7803 | 7823 | | |
7804 | 7824 | | |
7805 | 7825 | | |
| 7826 | + | |
| 7827 | + | |
7806 | 7828 | | |
7807 | 7829 | | |
7808 | 7830 | | |
| |||
0 commit comments