[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 5/6] libvhost-user: prevent over-running max RAM slots
|
From: |
Philippe Mathieu-Daudé |
|
Subject: |
Re: [PATCH v3 5/6] libvhost-user: prevent over-running max RAM slots |
|
Date: |
Mon, 17 Jan 2022 13:32:30 +0100 |
|
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 |
On 1/17/22 09:20, David Hildenbrand wrote:
> On 17.01.22 05:12, Raphael Norwitz wrote:
>> When VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS support was added to
>> libvhost-user, no guardrails were added to protect against QEMU
>> attempting to hot-add too many RAM slots to a VM with a libvhost-user
>> based backed attached.
>>
>> This change adds the missing error handling by introducing a check on
>> the number of RAM slots the device has available before proceeding to
>> process the VHOST_USER_ADD_MEM_REG message.
>>
>> Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
>> Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
>> ---
>> subprojects/libvhost-user/libvhost-user.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>> + if (dev->nregions == VHOST_USER_MAX_RAM_SLOTS) {
>> + close(vmsg->fds[0]);
>> + vu_panic(dev, "failing attempt to hot add memory via "
>> + "VHOST_USER_ADD_MEM_REG message because the backend
>> has "
>> + "no free ram slots available");
>
> Maybe simply "VHOST_USER_ADD_MEM_REG failed because there are no free
> ram slots"
>
> Reviewed-by: David Hildenbrand <david@redhat.com>
>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
- [PATCH v3 0/6] Clean up error handling in libvhost-user memory mapping, Raphael Norwitz, 2022/01/16
- [PATCH v3 1/6] libvhost-user: Add vu_rem_mem_reg input validation, Raphael Norwitz, 2022/01/16
- [PATCH v3 2/6] libvhost-user: Add vu_add_mem_reg input validation, Raphael Norwitz, 2022/01/16
- [PATCH v3 3/6] libvhost-user: Simplify VHOST_USER_REM_MEM_REG, Raphael Norwitz, 2022/01/16
- [PATCH v3 5/6] libvhost-user: prevent over-running max RAM slots, Raphael Norwitz, 2022/01/16
- [PATCH v3 4/6] libvhost-user: fix VHOST_USER_REM_MEM_REG not closing the fd, Raphael Norwitz, 2022/01/16
- [PATCH v3 6/6] libvhost-user: handle removal of identical regions, Raphael Norwitz, 2022/01/16