Commit eabc7aa
KVM: arm64: Simplify np-guest hypercalls
When the handling of a guest stage-2 permission fault races with an MMU
notifier, the faulting page might be gone from the guest's stage-2 by
the point we attempt to call (p)kvm_pgtable_stage2_relax_perms(). In the
normal KVM case, this leads to returning -EAGAIN which user_mem_abort()
handles correctly by simply re-entering the guest. However, the pKVM
hypercall implementation has additional logic to check the page state
using __check_host_shared_guest() which gets confused with absence of a
page mapped at the requested IPA and returns -ENOENT, hence breaking
user_mem_abort() and hilarity ensues.
Luckily, several of the hypercalls for managing the stage-2 page-table
of NP guests have no effect on the pKVM ownership tracking (wrprotect,
test_clear_young, mkyoung, and crucially relax_perms), so the extra
state checking logic is in fact not strictly necessary. So, to fix the
discrepancy between standard KVM and pKVM, let's just drop the
superfluous __check_host_shared_guest() logic from those hypercalls and
make the extra state checking a debug assertion dependent on
CONFIG_NVHE_EL2_DEBUG as we already do for other transitions.
Signed-off-by: Quentin Perret <[email protected]>
Reviewed-by: Oliver Upton <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Marc Zyngier <[email protected]>1 parent c53fbdb commit eabc7aa
1 file changed
+38
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
1001 | | - | |
| 1001 | + | |
1002 | 1002 | | |
1003 | | - | |
1004 | | - | |
1005 | 1003 | | |
1006 | 1004 | | |
1007 | 1005 | | |
1008 | | - | |
1009 | | - | |
| 1006 | + | |
| 1007 | + | |
1010 | 1008 | | |
1011 | 1009 | | |
1012 | 1010 | | |
1013 | 1011 | | |
1014 | 1012 | | |
1015 | | - | |
1016 | | - | |
1017 | 1013 | | |
1018 | 1014 | | |
1019 | 1015 | | |
1020 | 1016 | | |
1021 | | - | |
| 1017 | + | |
1022 | 1018 | | |
1023 | 1019 | | |
1024 | | - | |
| 1020 | + | |
1025 | 1021 | | |
| 1022 | + | |
1026 | 1023 | | |
1027 | | - | |
1028 | 1024 | | |
1029 | 1025 | | |
1030 | | - | |
1031 | | - | |
| 1026 | + | |
| 1027 | + | |
1032 | 1028 | | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
| 1029 | + | |
| 1030 | + | |
1036 | 1031 | | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1037 | 1035 | | |
1038 | | - | |
1039 | 1036 | | |
1040 | 1037 | | |
1041 | 1038 | | |
1042 | 1039 | | |
1043 | | - | |
| 1040 | + | |
1044 | 1041 | | |
1045 | 1042 | | |
1046 | | - | |
1047 | 1043 | | |
1048 | 1044 | | |
1049 | | - | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1050 | 1049 | | |
| 1050 | + | |
| 1051 | + | |
1051 | 1052 | | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
| 1053 | + | |
| 1054 | + | |
1055 | 1055 | | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
1056 | 1067 | | |
1057 | | - | |
1058 | 1068 | | |
1059 | 1069 | | |
1060 | 1070 | | |
| |||
1063 | 1073 | | |
1064 | 1074 | | |
1065 | 1075 | | |
1066 | | - | |
1067 | 1076 | | |
1068 | 1077 | | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
| 1078 | + | |
| 1079 | + | |
1075 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1076 | 1084 | | |
1077 | | - | |
1078 | 1085 | | |
1079 | 1086 | | |
1080 | 1087 | | |
0 commit comments