numam-dpdk/lib/librte_vhost
Maxime Coquelin c6420a3632 vhost: catch overflow causing mmap of size 0
This patch catches an overflow that could happen if an
invalid region size or page alignment is provided by the
guest via the VHOST_USER_SET_MEM_TABLE request.

If the sum of the size to mmap and the alignment overflows
uint64_t, then RTE_ALIGN_CEIL(mmap_size, alignment) macro
will return 0. This value was passed as is as size argument
to mmap().

While kernel handling of mmap() syscall returns an error
if size is 0, it is better to catch it earlier and provide
a meaningful error log.

Fixes: ec09c280b8 ("vhost: fix mmap not aligned with hugepage size")
Cc: stable@dpdk.org

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
2020-02-05 11:47:18 +01:00
..
fd_man.c vhost: fix race condition when adding fd in the fdset 2018-12-21 16:22:40 +01:00
fd_man.h vhost: fix race condition when adding fd in the fdset 2018-12-21 16:22:40 +01:00
iotlb.c vhost: add dynamic logging system 2020-01-17 19:46:01 +01:00
iotlb.h vhost: replace IOTLB license with SPDX tag 2019-08-05 16:06:11 +02:00
Makefile build: remove individual library versions 2019-11-20 23:05:39 +01:00
meson.build build: remove individual library versions 2019-11-20 23:05:39 +01:00
rte_vdpa.h enforce experimental tag at beginning of declarations 2019-06-29 19:04:48 +02:00
rte_vhost_crypto.h enforce experimental tag at beginning of declarations 2019-06-29 19:04:48 +02:00
rte_vhost_version.map vhost: support config change slave message 2020-01-17 19:46:26 +01:00
rte_vhost.h vhost: support config change slave message 2020-01-17 19:46:26 +01:00
socket.c vhost: do not treat empty socket message as error 2020-02-05 11:47:18 +01:00
vdpa.c vhost: convert buffer addresses to GPA for logging 2019-10-23 16:43:09 +02:00
vhost_crypto.c vhost/crypto: fix fetch size 2020-02-05 11:47:18 +01:00
vhost_user.c vhost: catch overflow causing mmap of size 0 2020-02-05 11:47:18 +01:00
vhost_user.h vhost: support config change slave message 2020-01-17 19:46:26 +01:00
vhost.c vhost: add dynamic logging system 2020-01-17 19:46:01 +01:00
vhost.h vhost: add dynamic logging system 2020-01-17 19:46:01 +01:00
virtio_crypto.h vhost: add virtio crypto header file 2018-04-14 00:43:30 +02:00
virtio_net.c vhost: flush shadow Tx if no more packets 2020-02-05 11:47:18 +01:00