Commit 1f82935
KVM: Harden copying of userspace-array against overflow
kvm_main.c utilizes vmemdup_user() and array_size() to copy a userspace
array. Currently, this does not check for an overflow.
Use the new wrapper vmemdup_array_user() to copy the array more safely.
Note, KVM explicitly checks the number of entries before duplicating the
array, i.e. adding the overflow check should be a glorified nop.
Suggested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Link: https://lore.kernel.org/r/20231102181526.43279-4-pstanner@redhat.com
[sean: call out that KVM pre-checks the number of entries]
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent 8c49767 commit 1f82935
1 file changed
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5262 | 5262 | | |
5263 | 5263 | | |
5264 | 5264 | | |
5265 | | - | |
5266 | | - | |
5267 | | - | |
| 5265 | + | |
| 5266 | + | |
5268 | 5267 | | |
5269 | 5268 | | |
5270 | 5269 | | |
| |||
0 commit comments