forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork0
Commit60e21a0
arm64: KVM: Take S1 walks into account when determining S2 write faults
The WnR bit in the HSR/ESR_EL2 indicates whether a data abort wasgenerated by a read or a write instruction. For stage 2 data abortsgenerated by a stage 1 translation table walk (i.e. the actual pagetable access faults at EL2), the WnR bit therefore reports whether theinstruction generating the walk was a load or a store, *not* whether thepage table walker was reading or writing the entry.For page tables marked as read-only at stage 2 (e.g. due to KSM mergingthem with the tables from another guest), this could result in livelock,where a page table walk generated by a load instruction attempts toset the access flag in the stage 1 descriptor, but fails to triggerCoW in the host since only a read fault is reported.This patch modifies the arm64 kvm_vcpu_dabt_iswrite function totake into account stage 2 faults in stage 1 walks. Since DBM cannot bedisabled at EL2 for CPUs that implement it, we assume that these faultsare always causes by writes, avoiding the livelock situation at theexpense of occasional, spurious CoWs.We could, in theory, do a bit better by checking the guest TCRconfiguration and inspecting the page table to see why the PTE faulted.However, I doubt this is measurable in practice, and the threat oflivelock is real.Cc: <stable@vger.kernel.org>Cc: Julien Grall <julien.grall@arm.com>Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>Signed-off-by: Will Deacon <will.deacon@arm.com>1 parent1001354 commit60e21a0
1 file changed
+6
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | 181 | | |
187 | 182 | | |
188 | 183 | | |
| |||
203 | 198 | | |
204 | 199 | | |
205 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
| |||
0 commit comments
Comments
(0)