mirror of https://github.com/F-Stack/f-stack.git
84456118c7
Two kinds of mbuf are used in f-stack: freebsd mbuf and dpdk mbuf. freebsd mbufs are metadata used in freebsd stack, and their data pointers (m_data) point to dpdk mbuf's data (buf_addr). And they have their own chain, like this: bsd_mbuf1 -> bsd_mbuf2 -> bsd_mbuf3 \ \ \ dpdk_mbuf1 -> dpdk_mbuf2 -> dpdk_mbuf3 Considering the map relationship, - m_freem() is corresponding to rte_pktmbuf_free(), is to free the whole chain of mbufs. - m_free() is corresponding to rte_pktmbuf_free_seg(), is to free the specified mbuf segment. The current implementation in f-stack uses rte_pktmbuf_free() for m_free(). This leads to mbufs, which are still in use, be freed unexpectedly. For example, if the bsd_mbuf1 is trimed into zero length, bsd will invoke m_free() to free the specified segment, however, the whole mbuf chain is freed by calling rte_pktmbuf_free(). #0 rte_pktmbuf_free (m=0x22006fb480) #1 in ff_dpdk_pktmbuf_free (m=0x22006fb480) #2 in ff_mbuf_ext_free (m=0x7ffff7f82800, arg1=0x22006fb480, arg2=0x0) #3 in mb_free_ext (m=0x7ffff7f82800) #4 in m_free (m=0x7ffff7f82800) #5 in sbcompress (sb=, m=0x7ffff7f82800, n=) #6 in sbappendstream_locked (sb=, m=0x7ffff7f82800, flags=0) The fix is straightforward. Use the correct API for segment free. Reported-by: Yong-Hao Zou <yonghaoz1994@gmail.com> Signed-off-by: Jianfeng Tan <henry.tjf@antgroup.com> |
||
---|---|---|
.. | ||
include | ||
opt | ||
Makefile | ||
ff_api.h | ||
ff_api.symlist | ||
ff_compat.c | ||
ff_config.c | ||
ff_config.h | ||
ff_dpdk_if.c | ||
ff_dpdk_if.h | ||
ff_dpdk_kni.c | ||
ff_dpdk_kni.h | ||
ff_dpdk_pcap.c | ||
ff_dpdk_pcap.h | ||
ff_epoll.c | ||
ff_epoll.h | ||
ff_errno.h | ||
ff_event.h | ||
ff_freebsd_init.c | ||
ff_glue.c | ||
ff_host_interface.c | ||
ff_host_interface.h | ||
ff_ini_parser.c | ||
ff_ini_parser.h | ||
ff_init.c | ||
ff_init_main.c | ||
ff_kern_condvar.c | ||
ff_kern_environment.c | ||
ff_kern_intr.c | ||
ff_kern_subr.c | ||
ff_kern_synch.c | ||
ff_kern_timeout.c | ||
ff_lock.c | ||
ff_memory.c | ||
ff_memory.h | ||
ff_msg.h | ||
ff_ng_base.c | ||
ff_ngctl.c | ||
ff_route.c | ||
ff_subr_prf.c | ||
ff_syscall_wrapper.c | ||
ff_veth.c | ||
ff_veth.h | ||
ff_vfs_ops.c |