Commit Graph

106 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
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
fengbojiang 62653ab1a5 Fix bug of `sysctl` in tools/compat/sysctl.c.
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).
2020-11-21 21:27:55 +08:00
fengbojiang 1b5649a396 Add configuration options `symmetric_rss` to set whether to use symmetric RSS. 2020-08-30 00:55:08 +08:00
johnjiang 37a7c72f09 DPDK: upgrade to DPDK 19.11.2(LTS). 2020-06-18 16:55:50 +00:00
johnjiang e27c5f4e3a Merge branch 'dev' into feature-knictl 2020-05-21 10:56:12 +08:00
pengtian 0b1e7c031e #add knictl support 2020-05-14 18:30:34 +08:00
jinhao2 80d23aa1da update indent size 2020-01-08 21:13:12 +08:00
jinhao2 ce40395e0c dump packets by core, instead of by ports;without fopen/fclose while dumping 2020-01-08 12:09:40 +08:00
Jayath Sathyanarayana 316f2a31b4 Merge patch of Configuration param to skip "TX checksum offload", refer #448. 2019-11-04 13:10:27 +08:00
fengbojiang(姜凤波) d39775a93b Fix mac set bug. 2019-09-04 21:37:56 +08:00
fengbojiang(姜凤波) 5fbf4a15eb Bonding: supported. but it can't work in multi-processes, to be fix. 2019-09-04 21:17:10 +08:00
fengbojiang(姜凤波) 1e14958312 packet_dispatcher support vlan. 2019-08-06 22:19:12 +08:00
fengbojiang(姜凤波) 19dac219c8 Merge branch 'master' into dev
Fix bug of kni while set `vlan_strip=0`.
2019-08-06 22:11:54 +08:00
fengbojiang(姜凤波) a20fd2ae31 Fix bug of kni while set `vlan_strip=0`. 2019-08-06 22:05:27 +08:00
fengbojiang(姜凤波) 1068dedc41 Modified vlan code. 2019-07-29 15:29:24 +08:00
HongBo Long 86d95e99f0 set freebsd mbuf vlan information when the vlan_strip is enable && get ether_type error when the vlan_strip is disabled 2019-07-29 15:27:40 +08:00
fengbojiang(姜凤波) c6dae7f8fe Merge branch 'master' into dev
vlan bug fix
2019-07-29 15:08:46 +08:00
fengbojiang(姜凤波) ab2d620de6 Modified vlan code. 2019-07-29 14:47:11 +08:00
johnjiang 185c857ebb Merge pull request #414 from jinhao2/dev
support more than 32 processes; support 52bytes rsskey; compile failed.
2019-07-29 13:58:21 +08:00
jin.hao1 fd7b974f08 Update ff_dpdk_if.c
update codes.
2019-07-29 08:43:45 +08:00
jin.hao1 a6e2dd0ebd Update ff_dpdk_if.c
code aligned.
2019-07-29 08:42:28 +08:00
fengbojiang cea0be3c81 Tools: update top. 2019-07-25 22:33:42 +08:00
fengbojiang(姜凤波) a8ea1bed90 Tools: All tools can work in parallel now. 2019-07-25 17:19:28 +08:00
10077240 c005dd8b8e support more than 32 processes; support 52bytes rsskey; compile failed. 2019-07-25 11:27:30 +08:00
fengbojiang(姜凤波) 7cb21a2b2b IPv6: support multi-processes, deep copy NDP packet and dispatch. 2019-07-17 17:31:47 +08:00
fengbojiang(姜凤波) e499fe2b2a Merge branch 'dev' of https://github.com/F-Stack/f-stack into dev 2019-07-12 20:58:31 +08:00
fengbojiang(姜凤波) adfdf56113 IPv6: FreeBSD stack and f-stack support ipv6. 2019-07-12 20:56:01 +08:00
HongBo Long 2a7631a6bc set freebsd mbuf vlan information when the vlan_strip is enable && get ether_type error when the vlan_strip is disabled 2019-07-09 20:02:42 +08:00
root 5910503df7 fix the issue that set the incorrect crc_strip flag. 2019-07-05 14:45:00 +08:00
fengbojiang(姜凤波) dcc64c7196 remove unused code. 2019-06-27 18:21:45 +08:00
fengbojiang(姜凤波) ad241aff99 Add pkt_tx_delay parameter in config.ini.
It should be default while handling large concurrent requests, otherwise
it will reduce the throughput.
But if there are only a little, you can set it to less than 100, even to
0, to reduce the delay of the connection.
2019-06-27 17:44:19 +08:00
fengbojiang(姜凤波) 7f9cfd7ec2 modify RTE_MAX to RTE_ALIGN_CEIL while init mempool. 2019-06-27 12:12:59 +08:00
jfb8856606 d30ea9060e Reupgrade DPDK to 18.11. 2019-06-25 19:12:58 +08:00
fengbojiang(姜凤波) 173e66311e Merge branch 'master' into dev 2019-06-25 17:15:06 +08:00
logwang 5f73f9b957 Merge branch 'dev' into master 2019-05-21 22:19:57 +08:00
10077240 04cef02d60 use 4 spaces instead tab 2019-04-01 15:42:01 +08:00
10077240 5bf882b459 modify according to MR.Wang 2019-04-01 14:54:36 +08:00
10077240 ef5ab85936 not use mcopy when transmit from bsd to dpdk 2019-03-29 10:42:02 +08:00
johnjiang fba559f45b Merge pull request #355 from jinhao2/master
ff_traffic.tx info should save the sent packets
2019-03-18 11:07:06 +08:00
jin.hao1 49d7ad40cc recommit 2019-03-15 18:07:15 +08:00
jin.hao1 268488030d ff_traffic.tx info should save the sent packets
send_burst()  send several pkts which maybe composed by several mbufs, use rte_pktmbuf_pkt_len() to get actual length.
2019-03-15 16:18:17 +08:00
fengbojiang(姜凤波) e8591dc5c0 F-Stack's kni can work on DPDK 18.11 LTS now. 2019-03-14 17:17:58 +08:00
fengbojiang(姜凤波) ee6c3aa356 modify packet_dispatcher to support response package direct. 2019-03-08 15:12:57 +08:00