diff options
author | Steven Luong <sluong@cisco.com> | 2019-01-23 22:20:19 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-02-23 12:43:44 +0000 |
commit | b0789106cb4f4c7ac529c02a5ff1ac346f0913dd (patch) | |
tree | 4f97328ef710a5de1f5f8f127b9c6f64742c02a5 /src/vnet/devices/virtio/vhost_user_inline.h | |
parent | 2cefb064045727a50e7e57cc00919389ce8d86ce (diff) |
vhoat: potential crash in map_guest_mem using debug image
map_guest_mem may be called from worker-thread/dataplane. It has a call
to vlib_log and may crash inside vlib_log's ASSERT statement
/* make sure we are running on the main thread to avoid use in dataplane
code, for dataplane logging consider use of event-logger */
ASSERT (vlib_get_thread_index () == 0);
The fix is to convert the vlib_log call in map_guest_map to event logger
Change-Id: Iaaf6d86782aa8a18d25e0209f22dc31f04668d56
Signed-off-by: Steven Luong <sluong@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/vhost_user_inline.h')
-rw-r--r-- | src/vnet/devices/virtio/vhost_user_inline.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/vnet/devices/virtio/vhost_user_inline.h b/src/vnet/devices/virtio/vhost_user_inline.h index 02c15ad666f..544e2d36952 100644 --- a/src/vnet/devices/virtio/vhost_user_inline.h +++ b/src/vnet/devices/virtio/vhost_user_inline.h @@ -15,6 +15,7 @@ #ifndef __VIRTIO_VHOST_USER_INLINE_H__ #define __VIRTIO_VHOST_USER_INLINE_H__ /* vhost-user inline functions */ +#include <vppinfra/elog.h> static_always_inline void * map_guest_mem (vhost_user_intf_t * vui, uword addr, u32 * hint) @@ -134,7 +135,19 @@ vhost_map_guest_mem_done: } } #endif - vu_log_err (vui, "failed to map guest mem addr %llx", addr); + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (el) = + { + .format = "failed to map guest mem addr %lx", + .format_args = "i8", + }; + /* *INDENT-ON* */ + struct + { + uword addr; + } *ed; + ed = ELOG_DATA (&vlib_global_main.elog_main, el); + ed->addr = addr; *hint = 0; return 0; } |