Commit Graph

1002 Commits

Author SHA1 Message Date
Jianfeng Tan 06c3e57024 fix use after free issue in mbuf free
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>
2021-03-06 19:18:52 +08:00
Hawker c0c877b54c update comments 2021-03-06 19:18:52 +08:00
Hawker 6fb0694d16 update comments 2021-03-06 19:18:52 +08:00
Hawker dc643060d1 update comments 2021-03-06 19:18:52 +08:00
Hawker 8155960f54 update create_tcp_flow parameter 2021-03-06 19:18:51 +08:00
Hawker 170b9c333f update init_flow 2021-03-06 19:18:50 +08:00
Hawker d5f823fe01 Replace deprecated filter api with generic flowapi 2021-03-06 19:18:50 +08:00
Xin Wang b5a6261dce Fix compile error of micro_thread with gcc 8.3. 2021-03-06 19:18:50 +08:00
patrick.zeng 41b16a2c91 Add codedog configuration file .code.yml 2021-03-06 19:18:48 +08:00
fengbojiang bbbaae8e7b Update release note for 1.21. 2021-03-06 19:04:48 +08:00
fengbojiang b9be57e497 Update release note for 1.21. 2021-03-06 19:04:48 +08:00
fengbojiang 1707f5301d DPDK: upgrade to DPDK 19.11.6(LTS). 2021-03-06 19:04:47 +08:00
fengbojiang 7a655b09d2 DPDK: upgrade to DPDK 19.11.6(LTS). 2021-03-06 19:04:47 +08:00
fengbojiang 4b7cdbfe03 Fix some issues of ff msg. 2021-03-06 19:04:47 +08:00
fengbojiang 81612f2676 Fix some issues of ff msg. 2021-03-06 19:04:47 +08:00
fengbojiang a32da8f0cf The `ff_traffic` and `ff_top`'s `-P` argument support bigger than 38. 2021-03-06 19:04:46 +08:00
fengbojiang 03a3be5d63 The `ff_traffic` and `ff_top`'s `-P` argument support bigger than 38. 2021-03-06 19:04:46 +08:00
fengbojiang c0904131cb Fix bug of ff_ipc_msg_free in ff tools.
The ff msg shouldn't to free while `ff_ipc_send` success but `ff_ipc_recv` failed (such as F-Stack app are breaking by gdb).
2021-03-06 19:04:46 +08:00
fengbojiang c6b7b89709 Fix bug of ff_ipc_msg_free in ff tools.
The ff msg shouldn't to free while `ff_ipc_send` success but `ff_ipc_recv` failed (such as F-Stack app are breaking by gdb).
2021-03-06 19:04:46 +08:00
fengbojiang(姜凤波) 9fc26dbf88 Add `ff_regist_pcblddr_fun` to regist a pcb lddr function in F-Stack.
If There are multiple ips, and F-Stack client application can choose a source ip by yourself, instead always use the first ip.
2021-03-06 19:04:46 +08:00
fengbojiang(姜凤波) 1ddd0f0898 Add `ff_regist_pcblddr_fun` to regist a pcb lddr function in F-Stack.
If There are multiple ips, and F-Stack client application can choose a source ip by yourself, instead always use the first ip.
2021-03-06 19:04:46 +08:00
zengyi1001 25867c09cb Add IPv6 net addr parameters in config
Co-authored-by: fengbojiang <fengbojiang@tencent.com>
2021-03-06 19:04:46 +08:00
zengyi1001 0f2a196b68 Add IPv6 net addr parameters in config
Co-authored-by: fengbojiang <fengbojiang@tencent.com>
2021-03-06 19:04:46 +08:00
fengbojiang f69aa4778c Fix #560, Wrong msg_flags in struct msghdr after calling ff_recvmsg in a Linux application. 2021-03-06 19:04:46 +08:00
fengbojiang 6798bf3e3d Fix #560, Wrong msg_flags in struct msghdr after calling ff_recvmsg in a Linux application. 2021-03-06 19:04:46 +08:00
freak82 f39eac0056 Fix #568, Insufficient condition in ff_rte_frm_extcl function. 2021-03-06 19:04:46 +08:00
freak82 7817f2be74 Fix #568, Insufficient condition in ff_rte_frm_extcl function. 2021-03-06 19:04:46 +08:00
Hawker d769a4bd03 Bug:CLR_FD_BIT is undefined 2021-03-06 19:04:46 +08:00
Hawker 6819118ae2 Bug:CLR_FD_BIT is undefined 2021-03-06 19:04:46 +08:00
Jianfeng Tan e6161e2b0f fix use after free issue in mbuf free
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>
2021-03-06 19:04:46 +08:00
Jianfeng Tan 84456118c7 fix use after free issue in mbuf free
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>
2021-03-06 19:04:46 +08:00
Hawker fc7cff57bb update comments 2021-03-06 19:04:46 +08:00
Hawker 76f39db167 update comments 2021-03-06 19:04:46 +08:00
Hawker 663e85b1d7 update comments 2021-03-06 19:04:46 +08:00
Hawker c2cb022c64 update comments 2021-03-06 19:04:46 +08:00
Hawker cb0cb8ee1f update comments 2021-03-06 19:04:45 +08:00
Hawker d957b83157 update comments 2021-03-06 19:04:45 +08:00
Hawker c0e965e941 update create_tcp_flow parameter 2021-03-06 19:04:45 +08:00
Hawker 637df35cd2 update create_tcp_flow parameter 2021-03-06 19:04:45 +08:00
Hawker cd0965ba8a update init_flow 2021-03-06 19:04:45 +08:00
Hawker 900256fd7d update create_tcp_flow parameter 2021-03-06 19:04:45 +08:00
Hawker be1c8e2e75 Replace deprecated filter api with generic flowapi 2021-03-06 19:04:45 +08:00
Hawker fc73e3a9a4 update init_flow 2021-03-06 19:04:45 +08:00
Xin Wang f4073352dc Fix compile error of micro_thread with gcc 8.3. 2021-03-06 19:04:45 +08:00
Hawker 6c89f403ee Replace deprecated filter api with generic flowapi 2021-03-06 19:04:45 +08:00
patrick.zeng c1b64d492e Add codedog configuration file .code.yml 2021-03-06 19:04:45 +08:00
Xin Wang 973ff95de2 Fix compile error of micro_thread with gcc 8.3. 2021-03-06 19:04:45 +08:00
patrick.zeng 2c7595d6e9 Add codedog configuration file .code.yml 2021-03-06 19:04:45 +08:00
Hawker 55151ab9d2 Bugfix: support rte_flow_isolate for multi lcore (#562)
* Bugfix: support rte_flow_isolate

init flow isolate mode only run once
2020-11-25 11:31:04 +08:00
Hawker 2474e16370
Bugfix: support rte_flow_isolate for multi lcore (#562)
* Bugfix: support rte_flow_isolate

init flow isolate mode only run once
2020-11-25 11:31:04 +08:00