Commit 025dde5
committed
KVM: Harden guest memory APIs against out-of-bounds accesses
When reading or writing a guest page, WARN and bail if offset+len would
result in a read to a different page so that KVM bugs are more likely to
be detected, and so that any such bugs are less likely to escalate to an
out-of-bounds access. E.g. if userspace isn't using guard pages and the
target page is at the end of a memslot.
Note, KVM already hardens itself in similar APIs, e.g. in the "cached"
variants, it's just the vanilla APIs that are playing with fire.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>1 parent ec495f2 commit 025dde5
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3275 | 3275 | | |
3276 | 3276 | | |
3277 | 3277 | | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
3278 | 3281 | | |
3279 | 3282 | | |
3280 | 3283 | | |
| |||
3348 | 3351 | | |
3349 | 3352 | | |
3350 | 3353 | | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
3351 | 3357 | | |
3352 | 3358 | | |
3353 | 3359 | | |
| |||
3378 | 3384 | | |
3379 | 3385 | | |
3380 | 3386 | | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
3381 | 3390 | | |
3382 | 3391 | | |
3383 | 3392 | | |
| |||
0 commit comments