Re: [PATCH v3 8/8] KVM: s390: Fix length check __import_wp_info()
| Newsgroups | org.kernel.vger.kvm,org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
> struct kvm_hw_breakpoint::len is a __u64 that is fully controlled by user
> space. This is then assigned to wp_info->len, which is an int. The bounds
> check is done on the truncated value while the allocation uses the
> untruncated one:
>
> wp_info->len = bp_data->len;
> [...]
> if (wp_info->len < 0 || wp_info->len > MAX_WP_SIZE)
> return -EINVAL;
>
> wp_info->old_data = kmalloc(bp_data->len, GFP_KERNEL_ACCOUNT);
>
> Use the validated value for the allocation as intended. Without this
> fix userspace can trigger >4GB allocations which will fail and result
> in a WARN due to MAX_PAGE_ORDER.
>
> Fixes: 27291e2165b6 ("KVM: s390: hardware support for guest debugging")
> Cc: [email protected]
> Signed-off-by: Christian Borntraeger <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8