Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovn-northd-ddlog: Add license to new multicast.dl file. #11

Merged
merged 1 commit into from Sep 25, 2019

Conversation

dceara
Copy link
Collaborator

@dceara dceara commented Sep 25, 2019

Signed-off-by: Dumitru Ceara dceara@redhat.com

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
@numansiddique
Copy link
Collaborator

Signed-off-by: Numan Siddique nusiddiq@redhat.com

@numansiddique numansiddique merged commit fdd408c into ovn-org:ddlog-dev-v2 Sep 25, 2019
@dceara dceara deleted the ddlog-multicast-license branch November 27, 2019 13:09
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Nov 19, 2020
Result of 'normalize_v46_prefix()' should be freed and all dynamic
strings should be destroyed.

  Direct leak of 156 byte(s) in 13 object(s) allocated from:
    #0 0x53700f in malloc (northd/ovn-northd+0x53700f)
    ovn-org#1 0x71b146 in xmalloc ovs/lib/util.c:138:15
    ovn-org#2 0x71b39a in xvasprintf ovs/lib/util.c:202:9
    ovn-org#3 0x71b753 in xasprintf ovs/lib/util.c:343:9
    ovn-org#4 0x59bddc in add_ecmp_symmetric_reply_flows northd/ovn-northd.c:7985:18
    ovn-org#5 0x59aab5 in build_ecmp_route_flow northd/ovn-northd.c:8102:13
    ovn-org#6 0x592260 in build_static_route_flows_for_lrouter ovn-northd.c:10243:13
    ovn-org#7 0x589267 in build_lswitch_and_lrouter_iterate_by_od ovn-northd.c:11241:5
    ovn-org#8 0x5888ca in build_lswitch_and_lrouter_flows northd/ovn-northd.c:11313:9
    ovn-org#9 0x5730a0 in build_lflows northd/ovn-northd.c:11401:5
    ovn-org#10 0x56f992 in ovnnb_db_run northd/ovn-northd.c:12339:5
    ovn-org#11 0x56e8a7 in ovn_db_run northd/ovn-northd.c:12932:5
    ovn-org#12 0x56d6af in main northd/ovn-northd.c:13338:17
    ovn-org#13 0x7f5371d041a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

Fixes: 4fdca65 ("Add ECMP symmetric replies.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Nov 20, 2020
'child_port_list' is an array of pointers that should be freed too.

  Direct leak of 30 byte(s) in 6 object(s) allocated from:
    #0 0x501fff in malloc (/tests/ovstest+0x501fff)
    ovn-org#1 0x6227e6 in xmalloc /lib/util.c:138:15
    ovn-org#2 0x6228b8 in xmemdup0 /lib/util.c:168:15
    ovn-org#3 0x8183d6 in parse_fwd_group_action /lib/actions.c:3374:30
    ovn-org#4 0x814b6e in parse_action /lib/actions.c:3610:9
    ovn-org#5 0x8139ef in parse_actions /lib/actions.c:3637:14
    ovn-org#6 0x8136a3 in ovnacts_parse /lib/actions.c:3672:9
    ovn-org#7 0x813c80 in ovnacts_parse_string /lib/actions.c:3699:5
    ovn-org#8 0x53a979 in test_parse_actions /tests/test-ovn.c:1372:21
    ovn-org#9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    ovn-org#10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    ovn-org#11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    ovn-org#12 0x537359 in main /tests/ovstest.c:133:9
    ovn-org#13 0x7f06978f21a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Manoj Sharma <manoj.sharma@nutanix.com>
Fixes: edb2400 ("Forwarding group to load balance l2 traffic with liveness detection")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Nov 20, 2020
'dsts' should be freed in case of any error.

  Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x502378 in realloc (/tests/ovstest+0x502378)
    ovn-org#1 0x622826 in xrealloc /lib/util.c:149:9
    ovn-org#2 0x8194f4 in parse_select_action /lib/actions.c:1185:20
    ovn-org#3 0x814f49 in parse_set_action /lib/actions.c:3499:13
    ovn-org#4 0x814341 in parse_action /lib/actions.c:3554:9
    ovn-org#5 0x8139ef in parse_actions /lib/actions.c:3643:14
    ovn-org#6 0x8136a3 in ovnacts_parse /lib/actions.c:3678:9
    ovn-org#7 0x813c80 in ovnacts_parse_string /lib/actions.c:3705:5
    ovn-org#8 0x53a4e8 in test_parse_actions /tests/test-ovn.c:1321:17
    ovn-org#9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    ovn-org#10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    ovn-org#11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    ovn-org#12 0x537359 in main /tests/ovstest.c:133:9
    ovn-org#13 0x7f9ce05ba1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Han Zhou <hzhou@ovn.org>
Fixes: 85b3544 ("ovn-controller: A new action "select".")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'child_port_list' is an array of pointers that should be freed too.

  Direct leak of 30 byte(s) in 6 object(s) allocated from:
    #0 0x501fff in malloc (/tests/ovstest+0x501fff)
    #1 0x6227e6 in xmalloc /lib/util.c:138:15
    #2 0x6228b8 in xmemdup0 /lib/util.c:168:15
    #3 0x8183d6 in parse_fwd_group_action /lib/actions.c:3374:30
    #4 0x814b6e in parse_action /lib/actions.c:3610:9
    #5 0x8139ef in parse_actions /lib/actions.c:3637:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3672:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3699:5
    #8 0x53a979 in test_parse_actions /tests/test-ovn.c:1372:21
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f06978f21a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Manoj Sharma <manoj.sharma@nutanix.com>
Fixes: edb2400 ("Forwarding group to load balance l2 traffic with liveness detection")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'dsts' should be freed in case of any error.

  Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x502378 in realloc (/tests/ovstest+0x502378)
    #1 0x622826 in xrealloc /lib/util.c:149:9
    #2 0x8194f4 in parse_select_action /lib/actions.c:1185:20
    #3 0x814f49 in parse_set_action /lib/actions.c:3499:13
    #4 0x814341 in parse_action /lib/actions.c:3554:9
    #5 0x8139ef in parse_actions /lib/actions.c:3643:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3678:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3705:5
    #8 0x53a4e8 in test_parse_actions /tests/test-ovn.c:1321:17
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f9ce05ba1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Han Zhou <hzhou@ovn.org>
Fixes: 85b3544 ("ovn-controller: A new action "select".")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'child_port_list' is an array of pointers that should be freed too.

  Direct leak of 30 byte(s) in 6 object(s) allocated from:
    #0 0x501fff in malloc (/tests/ovstest+0x501fff)
    #1 0x6227e6 in xmalloc /lib/util.c:138:15
    #2 0x6228b8 in xmemdup0 /lib/util.c:168:15
    #3 0x8183d6 in parse_fwd_group_action /lib/actions.c:3374:30
    #4 0x814b6e in parse_action /lib/actions.c:3610:9
    #5 0x8139ef in parse_actions /lib/actions.c:3637:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3672:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3699:5
    #8 0x53a979 in test_parse_actions /tests/test-ovn.c:1372:21
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f06978f21a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Manoj Sharma <manoj.sharma@nutanix.com>
Fixes: edb2400 ("Forwarding group to load balance l2 traffic with liveness detection")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'dsts' should be freed in case of any error.

  Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x502378 in realloc (/tests/ovstest+0x502378)
    #1 0x622826 in xrealloc /lib/util.c:149:9
    #2 0x8194f4 in parse_select_action /lib/actions.c:1185:20
    #3 0x814f49 in parse_set_action /lib/actions.c:3499:13
    #4 0x814341 in parse_action /lib/actions.c:3554:9
    #5 0x8139ef in parse_actions /lib/actions.c:3643:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3678:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3705:5
    #8 0x53a4e8 in test_parse_actions /tests/test-ovn.c:1321:17
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f9ce05ba1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Han Zhou <hzhou@ovn.org>
Fixes: 85b3544 ("ovn-controller: A new action "select".")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'child_port_list' is an array of pointers that should be freed too.

  Direct leak of 30 byte(s) in 6 object(s) allocated from:
    #0 0x501fff in malloc (/tests/ovstest+0x501fff)
    #1 0x6227e6 in xmalloc /lib/util.c:138:15
    #2 0x6228b8 in xmemdup0 /lib/util.c:168:15
    #3 0x8183d6 in parse_fwd_group_action /lib/actions.c:3374:30
    #4 0x814b6e in parse_action /lib/actions.c:3610:9
    #5 0x8139ef in parse_actions /lib/actions.c:3637:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3672:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3699:5
    #8 0x53a979 in test_parse_actions /tests/test-ovn.c:1372:21
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f06978f21a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Manoj Sharma <manoj.sharma@nutanix.com>
Fixes: edb2400 ("Forwarding group to load balance l2 traffic with liveness detection")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>

(cherry-picked from master commit 9443464)
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'dsts' should be freed in case of any error.

  Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x502378 in realloc (/tests/ovstest+0x502378)
    #1 0x622826 in xrealloc /lib/util.c:149:9
    #2 0x8194f4 in parse_select_action /lib/actions.c:1185:20
    #3 0x814f49 in parse_set_action /lib/actions.c:3499:13
    #4 0x814341 in parse_action /lib/actions.c:3554:9
    #5 0x8139ef in parse_actions /lib/actions.c:3643:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3678:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3705:5
    #8 0x53a4e8 in test_parse_actions /tests/test-ovn.c:1321:17
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f9ce05ba1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Han Zhou <hzhou@ovn.org>
Fixes: 85b3544 ("ovn-controller: A new action "select".")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>

(cherry-picked from master commit 18141db)
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'child_port_list' is an array of pointers that should be freed too.

  Direct leak of 30 byte(s) in 6 object(s) allocated from:
    #0 0x501fff in malloc (/tests/ovstest+0x501fff)
    #1 0x6227e6 in xmalloc /lib/util.c:138:15
    #2 0x6228b8 in xmemdup0 /lib/util.c:168:15
    #3 0x8183d6 in parse_fwd_group_action /lib/actions.c:3374:30
    #4 0x814b6e in parse_action /lib/actions.c:3610:9
    #5 0x8139ef in parse_actions /lib/actions.c:3637:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3672:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3699:5
    #8 0x53a979 in test_parse_actions /tests/test-ovn.c:1372:21
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f06978f21a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Manoj Sharma <manoj.sharma@nutanix.com>
Fixes: edb2400 ("Forwarding group to load balance l2 traffic with liveness detection")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>

(cherry-picked from master commit 9443464)
numansiddique pushed a commit that referenced this pull request Nov 22, 2020
'dsts' should be freed in case of any error.

  Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x502378 in realloc (/tests/ovstest+0x502378)
    #1 0x622826 in xrealloc /lib/util.c:149:9
    #2 0x8194f4 in parse_select_action /lib/actions.c:1185:20
    #3 0x814f49 in parse_set_action /lib/actions.c:3499:13
    #4 0x814341 in parse_action /lib/actions.c:3554:9
    #5 0x8139ef in parse_actions /lib/actions.c:3643:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3678:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3705:5
    #8 0x53a4e8 in test_parse_actions /tests/test-ovn.c:1321:17
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f9ce05ba1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Han Zhou <hzhou@ovn.org>
Fixes: 85b3544 ("ovn-controller: A new action "select".")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>

(cherry-picked from master commit 18141db)
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Feb 16, 2021
In one of the scaled deployments, ovn-controller is asserting with the
below stack trace

****************
(gdb) bt
   #0  0x00007fa6aed4970f in raise () from /lib64/libc.so.6
   ovn-org#1  0x00007fa6aed33b25 in abort () from /lib64/libc.so.6
   ovn-org#2  0x000055d46594a714 in ovs_abort_valist (err_no=err_no@entry=0, format=format@entry=0x55d465a2a190 "%s: assertion %s failed in %s()", args=args@entry=0x7ffd24307ba0) at lib/util.c:419
   ovn-org#3  0x000055d465952504 in vlog_abort_valist (module_=<optimized out>, message=0x55d465a2a190 "%s: assertion %s failed in %s()", args=args@entry=0x7ffd24307ba0) at lib/vlog.c:1249
   ovn-org#4  0x000055d4659525aa in vlog_abort (module=module@entry=0x55d465ce6880 <this_module>, message=message@entry=0x55d465a2a190 "%s: assertion %s failed in %s()") at lib/vlog.c:1263
   ovn-org#5  0x000055d46594a42b in ovs_assert_failure (where=where@entry=0x55d465a05529 "controller/ofctrl.c:1198", function=function@entry=0x55d465a05ca0 <__func__.33798> "flood_remove_flows_for_sb_uuid",
    condition=condition@entry=0x55d465a05a80 "ovs_list_is_empty(&f->list_node)") at lib/util.c:86
   ovn-org#6  0x000055d465877aa2 in flood_remove_flows_for_sb_uuid (flow_table=flow_table@entry=0x55d46688d080, sb_uuid=sb_uuid@entry=0x55d53dbec538, flood_remove_nodes=flood_remove_nodes@entry=0x7ffd24307ed0) at controller/ofctrl.c:1205
   ovn-org#7  0x000055d465877c2e in flood_remove_flows_for_sb_uuid (flow_table=flow_table@entry=0x55d46688d080, sb_uuid=sb_uuid@entry=0x55d546553898, flood_remove_nodes=flood_remove_nodes@entry=0x7ffd24307ed0) at controller/ofctrl.c:1230
   ovn-org#8  0x000055d465877c2e in flood_remove_flows_for_sb_uuid (flow_table=flow_table@entry=0x55d46688d080, sb_uuid=sb_uuid@entry=0x55d55eafebf0, flood_remove_nodes=flood_remove_nodes@entry=0x7ffd24307ed0) at controller/ofctrl.c:1230
   ovn-org#9  0x000055d465877dc2 in ofctrl_flood_remove_flows (flow_table=0x55d46688d080, flood_remove_nodes=flood_remove_nodes@entry=0x7ffd24307ed0) at controller/ofctrl.c:1250
   ovn-org#10 0x000055d465872b24 in lflow_handle_changed_ref (ref_type=ref_type@entry=REF_TYPE_PORTGROUP, ref_name=ref_name@entry=0x55d49375a050 "5564_pg_6415729e_58ec_4b8b_bc99_2ceef5c44bac", l_ctx_in=l_ctx_in@entry=0x7ffd24307fd0,
    l_ctx_out=l_ctx_out@entry=0x7ffd24307f90, changed=changed@entry=0x7ffd24307f8f) at controller/lflow.c:612
   ovn-org#11 0x000055d46588f2f8 in _flow_output_resource_ref_handler (node=<optimized out>, data=<optimized out>, ref_type=REF_TYPE_PORTGROUP) at controller/ovn-controller.c:2181
   ovn-org#12 0x000055d4658a8163 in engine_compute (recompute_allowed=<optimized out>, node=<optimized out>) at lib/inc-proc-eng.c:306
   ovn-org#13 engine_run_node (recompute_allowed=true, node=0x7ffd2430d4b0) at lib/inc-proc-eng.c:352
   ovn-org#14 engine_run (recompute_allowed=recompute_allowed@entry=true) at lib/inc-proc-eng.c:377
   ovn-org#15 0x000055d46586613d in main (argc=<optimized out>, argv=<optimized out>) at controller/ovn-controller.c:2794

***************

This assertion is seen when a port group gets updated and it is referenced by many
logical flows (with conj actions).  The function
ofctrl_flood_remove_flows(), calls flood_remove_flows_for_sb_uuid() for
each sb uuid in the hmap - flood_remove_nodes using HMAP_FOR_EACH (flood_remove_nodes).
flood_remove_flows_for_sb_uuid() also takes the hmap
'flood_remove_nodes' as an argument and it inserts few items into it
when it has to call itself recursively.  When an item is inserted, its possible that
the hmap may get expanded.  And if this happens, the HMAP_FOR_EACH ()
skips few entries causing some of the desired flows not getting cleared.

Later when ofctrl_add_or_append_flow() is called, there would be
multiple  'struct sb_flow_ref' references for the same desired flow.
And this causes the above assertion later when the same port group gets
updated.

This patch fixes this issue by cloning the hmap 'flood_remove_nodes' and
using it to iterate the flood remove nodes.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1928012
CC: Han Zhou <hzhou@ovn.org>
CC: Dumitru Ceara <dceara@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Jun 9, 2021
This is benign but AddressSanitizer was complaining about it:

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fa93cd6d667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    ovn-org#1 0x1be8d3e in xmalloc__ lib/util.c:137
    ovn-org#2 0x1be8e1a in xmalloc lib/util.c:172
    ovn-org#3 0x1b799d3 in json_create lib/json.c:1451
    ovn-org#4 0x1b74314 in json_integer_create lib/json.c:263
    ovn-org#5 0x1b7d38a in jsonrpc_create_id lib/jsonrpc.c:563
    ovn-org#6 0x1b7d3a5 in jsonrpc_create_request lib/jsonrpc.c:570
    ovn-org#7 0x1b8d851 in ovsdb_cs_send_transaction lib/ovsdb-cs.c:1376
    ovn-org#8 0x40b017 in northd_send_output_only_data_request northd/ovn-northd-ddlog.c:290
    ovn-org#9 0x40c802 in northd_run northd/ovn-northd-ddlog.c:568
    ovn-org#10 0x410225 in main northd/ovn-northd-ddlog.c:1289
    ovn-org#11 0x7fa93c4a9081 in __libc_start_main ../csu/libc-start.c:308

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
putnopvut pushed a commit that referenced this pull request Jun 14, 2021
This is benign but AddressSanitizer was complaining about it:

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fa93cd6d667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    #1 0x1be8d3e in xmalloc__ lib/util.c:137
    #2 0x1be8e1a in xmalloc lib/util.c:172
    #3 0x1b799d3 in json_create lib/json.c:1451
    #4 0x1b74314 in json_integer_create lib/json.c:263
    #5 0x1b7d38a in jsonrpc_create_id lib/jsonrpc.c:563
    #6 0x1b7d3a5 in jsonrpc_create_request lib/jsonrpc.c:570
    #7 0x1b8d851 in ovsdb_cs_send_transaction lib/ovsdb-cs.c:1376
    #8 0x40b017 in northd_send_output_only_data_request northd/ovn-northd-ddlog.c:290
    #9 0x40c802 in northd_run northd/ovn-northd-ddlog.c:568
    #10 0x410225 in main northd/ovn-northd-ddlog.c:1289
    #11 0x7fa93c4a9081 in __libc_start_main ../csu/libc-start.c:308

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Ben Pfaff <blp@ovn.org>
putnopvut pushed a commit that referenced this pull request Jun 14, 2021
This is benign but AddressSanitizer was complaining about it:

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fa93cd6d667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    #1 0x1be8d3e in xmalloc__ lib/util.c:137
    #2 0x1be8e1a in xmalloc lib/util.c:172
    #3 0x1b799d3 in json_create lib/json.c:1451
    #4 0x1b74314 in json_integer_create lib/json.c:263
    #5 0x1b7d38a in jsonrpc_create_id lib/jsonrpc.c:563
    #6 0x1b7d3a5 in jsonrpc_create_request lib/jsonrpc.c:570
    #7 0x1b8d851 in ovsdb_cs_send_transaction lib/ovsdb-cs.c:1376
    #8 0x40b017 in northd_send_output_only_data_request northd/ovn-northd-ddlog.c:290
    #9 0x40c802 in northd_run northd/ovn-northd-ddlog.c:568
    #10 0x410225 in main northd/ovn-northd-ddlog.c:1289
    #11 0x7fa93c4a9081 in __libc_start_main ../csu/libc-start.c:308

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Ben Pfaff <blp@ovn.org>
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Feb 24, 2022
Fix it by using shash_destroy_free_data() instead of shash_destroy().

Example of asan log of this memory leak:

Direct leak of 232 byte(s) in 29 object(s) allocated from:
    #0 0x534b0f in malloc (/home/hanzhou/src/ovn/_build_as/controller/ovn-controller+0x534b0f)
    ovn-org#1 0x73bd4d in xmalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:137:15
    ovn-org#2 0x73bd4d in xmalloc /home/hanzhou/src/ovs/_build/../lib/util.c:172:12
    ovn-org#3 0x638c49 in parse_constant_set /home/hanzhou/src/ovn/_build_as/../lib/expr.c:971:14
    ovn-org#4 0x64450d in expr_parse_primary /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1390:44
    ovn-org#5 0x63aefc in expr_parse_not /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1479:16
    ovn-org#6 0x63ac45 in expr_parse__ /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1486:22
    ovn-org#7 0x63b500 in expr_parse /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1535:34
    ovn-org#8 0x63b500 in expr_parse_string /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1557:25
    ovn-org#9 0x598a56 in convert_match_to_expr /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:1240:22
    ovn-org#10 0x591c07 in consider_logical_flow__ /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:1407:16
    ovn-org#11 0x58d641 in add_logical_flows /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:393:9
    ovn-org#12 0x58d641 in lflow_run /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:2444:5
    ovn-org#13 0x5f57a3 in en_lflow_output_run /home/hanzhou/src/ovn/_build_as/../controller/ovn-controller.c:2449:5
    ovn-org#14 0x65bc04 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:380:5
    ovn-org#15 0x65b2a3 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:456:17
    ovn-org#16 0x65b2a3 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:493:9
    ovn-org#17 0x5ef9c1 in main /home/hanzhou/src/ovn/_build_as/../controller/ovn-controller.c
    ovn-org#18 0x7f82418691a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)

Reported-by: Numan Siddique <numans@ovn.org>
Fixes: aa3e4e8 ("lflow: Track reference count of address sets when parsing lflows.")
Signed-off-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
hzhou8 added a commit that referenced this pull request Feb 24, 2022
Fix it by using shash_destroy_free_data() instead of shash_destroy().

Example of asan log of this memory leak:

Direct leak of 232 byte(s) in 29 object(s) allocated from:
    #0 0x534b0f in malloc (/home/hanzhou/src/ovn/_build_as/controller/ovn-controller+0x534b0f)
    #1 0x73bd4d in xmalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:137:15
    #2 0x73bd4d in xmalloc /home/hanzhou/src/ovs/_build/../lib/util.c:172:12
    #3 0x638c49 in parse_constant_set /home/hanzhou/src/ovn/_build_as/../lib/expr.c:971:14
    #4 0x64450d in expr_parse_primary /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1390:44
    #5 0x63aefc in expr_parse_not /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1479:16
    #6 0x63ac45 in expr_parse__ /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1486:22
    #7 0x63b500 in expr_parse /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1535:34
    #8 0x63b500 in expr_parse_string /home/hanzhou/src/ovn/_build_as/../lib/expr.c:1557:25
    #9 0x598a56 in convert_match_to_expr /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:1240:22
    #10 0x591c07 in consider_logical_flow__ /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:1407:16
    #11 0x58d641 in add_logical_flows /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:393:9
    #12 0x58d641 in lflow_run /home/hanzhou/src/ovn/_build_as/../controller/lflow.c:2444:5
    #13 0x5f57a3 in en_lflow_output_run /home/hanzhou/src/ovn/_build_as/../controller/ovn-controller.c:2449:5
    #14 0x65bc04 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:380:5
    #15 0x65b2a3 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:456:17
    #16 0x65b2a3 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:493:9
    #17 0x5ef9c1 in main /home/hanzhou/src/ovn/_build_as/../controller/ovn-controller.c
    #18 0x7f82418691a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)

Reported-by: Numan Siddique <numans@ovn.org>
Fixes: aa3e4e8 ("lflow: Track reference count of address sets when parsing lflows.")
Signed-off-by: Han Zhou <hzhou@ovn.org>
LorenzoBianconi added a commit to LorenzoBianconi/ovn that referenced this pull request Apr 15, 2022
Avoid the following crash in ovn-trace due to a reject action infinite
loop:

AddressSanitizer:DEADLYSIGNAL
==569410==ERROR: AddressSanitizer: stack-overflow on address 0x7ffc0a991bc4 (pc 0x000000415081 bp 0x7ffc0a993fa0 sp 0x7ffc0a991b30 T0)
    #0 0x415081 in trace_actions utilities/ovn-trace.c:2617
    ovn-org#1 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#2 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#3 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#4 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#5 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#6 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#7 0x41788d in execute_next utilities/ovn-trace.c:2307
    ovn-org#8 0x41788d in trace_actions utilities/ovn-trace.c:2644
    ovn-org#9 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#10 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    ovn-org#11 0x419671 in execute_reject utilities/ovn-trace.c:2049
    ovn-org#12 0x419671 in trace_actions utilities/ovn-trace.c:2860
    ovn-org#13 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#14 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#15 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#16 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#17 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#18 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#19 0x41788d in execute_next utilities/ovn-trace.c:2307
    ovn-org#20 0x41788d in trace_actions utilities/ovn-trace.c:2644
    ovn-org#21 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#22 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    ovn-org#23 0x419671 in execute_reject utilities/ovn-trace.c:2049
    ovn-org#24 0x419671 in trace_actions utilities/ovn-trace.c:2860
    ovn-org#25 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#26 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#27 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#28 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#29 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#30 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#31 0x41788d in execute_next utilities/ovn-trace.c:2307
    ovn-org#32 0x41788d in trace_actions utilities/ovn-trace.c:2644
    ovn-org#33 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#34 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    ovn-org#35 0x419671 in execute_reject utilities/ovn-trace.c:2049
    ovn-org#36 0x419671 in trace_actions utilities/ovn-trace.c:2860
    ovn-org#37 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#38 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#39 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#40 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#41 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#42 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#43 0x41788d in execute_next utilities/ovn-trace.c:2307
    ....

The issue can be triggered with the following reproducer:

$ovn-nbctl ls-add sw
$ovn-nbctl lsp-add sw p1
$ovn-nbctl lsp-set-addresses p1 "00:00:00:00:00:02 192.168.0.2"
$ovn-nbctl lsp-add sw p2
$ovn-nbctl lsp-set-addresses p2 "00:00:00:00:00:03 192.168.0.3"
$ovn-nbctl pg-add pg1 p1 p2
$ovn-nbctl acl-add pg1 to-lport 2003 "inport==@pg1 && ip4 && ip4.src == 192.168.0.0/16 && udp && udp.dst == 9000" allow
$ovn-nbctl acl-add pg1 to-lport 2001 "inport==@pg1" reject
$ovn-trace 'inport == "p2" && eth.src == 00:00:00:00:00:03 && eth.dst == 00:00:00:00:00:02 && ip.ttl==42 && ip4.src == 192.168.0.3'

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2074537
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Apr 15, 2022
Avoid the following crash in ovn-trace due to a reject action infinite
loop:

AddressSanitizer:DEADLYSIGNAL
==569410==ERROR: AddressSanitizer: stack-overflow on address 0x7ffc0a991bc4 (pc 0x000000415081 bp 0x7ffc0a993fa0 sp 0x7ffc0a991b30 T0)
    #0 0x415081 in trace_actions utilities/ovn-trace.c:2617
    ovn-org#1 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#2 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#3 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#4 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#5 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#6 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#7 0x41788d in execute_next utilities/ovn-trace.c:2307
    ovn-org#8 0x41788d in trace_actions utilities/ovn-trace.c:2644
    ovn-org#9 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#10 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    ovn-org#11 0x419671 in execute_reject utilities/ovn-trace.c:2049
    ovn-org#12 0x419671 in trace_actions utilities/ovn-trace.c:2860
    ovn-org#13 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#14 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#15 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#16 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#17 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#18 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#19 0x41788d in execute_next utilities/ovn-trace.c:2307
    ovn-org#20 0x41788d in trace_actions utilities/ovn-trace.c:2644
    ovn-org#21 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#22 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    ovn-org#23 0x419671 in execute_reject utilities/ovn-trace.c:2049
    ovn-org#24 0x419671 in trace_actions utilities/ovn-trace.c:2860
    ovn-org#25 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#26 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#27 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#28 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#29 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#30 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#31 0x41788d in execute_next utilities/ovn-trace.c:2307
    ovn-org#32 0x41788d in trace_actions utilities/ovn-trace.c:2644
    ovn-org#33 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#34 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    ovn-org#35 0x419671 in execute_reject utilities/ovn-trace.c:2049
    ovn-org#36 0x419671 in trace_actions utilities/ovn-trace.c:2860
    ovn-org#37 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#38 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#39 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    ovn-org#40 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    ovn-org#41 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    ovn-org#42 0x41d878 in trace__ utilities/ovn-trace.c:3007
    ovn-org#43 0x41788d in execute_next utilities/ovn-trace.c:2307
    ....

The issue can be triggered with the following reproducer:

$ovn-nbctl ls-add sw
$ovn-nbctl lsp-add sw p1
$ovn-nbctl lsp-set-addresses p1 "00:00:00:00:00:02 192.168.0.2"
$ovn-nbctl lsp-add sw p2
$ovn-nbctl lsp-set-addresses p2 "00:00:00:00:00:03 192.168.0.3"
$ovn-nbctl pg-add pg1 p1 p2
$ovn-nbctl acl-add pg1 to-lport 2003 "inport==@pg1 && ip4 && ip4.src == 192.168.0.0/16 && udp && udp.dst == 9000" allow
$ovn-nbctl acl-add pg1 to-lport 2001 "inport==@pg1" reject
$ovn-trace 'inport == "p2" && eth.src == 00:00:00:00:00:03 && eth.dst == 00:00:00:00:00:02 && ip.ttl==42 && ip4.src == 192.168.0.3'

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2074537
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
putnopvut pushed a commit that referenced this pull request May 10, 2022
Avoid the following crash in ovn-trace due to a reject action infinite
loop:

AddressSanitizer:DEADLYSIGNAL
==569410==ERROR: AddressSanitizer: stack-overflow on address 0x7ffc0a991bc4 (pc 0x000000415081 bp 0x7ffc0a993fa0 sp 0x7ffc0a991b30 T0)
    #0 0x415081 in trace_actions utilities/ovn-trace.c:2617
    #1 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #2 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #3 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #4 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #5 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #6 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #7 0x41788d in execute_next utilities/ovn-trace.c:2307
    #8 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #9 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #10 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #11 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #12 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #13 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #14 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #15 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #16 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #17 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #18 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #19 0x41788d in execute_next utilities/ovn-trace.c:2307
    #20 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #21 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #22 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #23 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #24 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #25 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #26 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #27 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #28 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #29 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #30 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #31 0x41788d in execute_next utilities/ovn-trace.c:2307
    #32 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #33 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #34 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #35 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #36 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #37 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #38 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #39 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #40 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #41 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #42 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #43 0x41788d in execute_next utilities/ovn-trace.c:2307
    ....

The issue can be triggered with the following reproducer:

$ovn-nbctl ls-add sw
$ovn-nbctl lsp-add sw p1
$ovn-nbctl lsp-set-addresses p1 "00:00:00:00:00:02 192.168.0.2"
$ovn-nbctl lsp-add sw p2
$ovn-nbctl lsp-set-addresses p2 "00:00:00:00:00:03 192.168.0.3"
$ovn-nbctl pg-add pg1 p1 p2
$ovn-nbctl acl-add pg1 to-lport 2003 "inport==@pg1 && ip4 && ip4.src == 192.168.0.0/16 && udp && udp.dst == 9000" allow
$ovn-nbctl acl-add pg1 to-lport 2001 "inport==@pg1" reject
$ovn-trace 'inport == "p2" && eth.src == 00:00:00:00:00:03 && eth.dst == 00:00:00:00:00:02 && ip.ttl==42 && ip4.src == 192.168.0.3'

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2074537
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
putnopvut pushed a commit that referenced this pull request May 10, 2022
Avoid the following crash in ovn-trace due to a reject action infinite
loop:

AddressSanitizer:DEADLYSIGNAL
==569410==ERROR: AddressSanitizer: stack-overflow on address 0x7ffc0a991bc4 (pc 0x000000415081 bp 0x7ffc0a993fa0 sp 0x7ffc0a991b30 T0)
    #0 0x415081 in trace_actions utilities/ovn-trace.c:2617
    #1 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #2 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #3 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #4 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #5 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #6 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #7 0x41788d in execute_next utilities/ovn-trace.c:2307
    #8 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #9 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #10 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #11 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #12 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #13 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #14 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #15 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #16 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #17 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #18 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #19 0x41788d in execute_next utilities/ovn-trace.c:2307
    #20 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #21 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #22 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #23 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #24 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #25 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #26 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #27 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #28 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #29 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #30 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #31 0x41788d in execute_next utilities/ovn-trace.c:2307
    #32 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #33 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #34 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #35 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #36 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #37 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #38 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #39 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #40 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #41 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #42 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #43 0x41788d in execute_next utilities/ovn-trace.c:2307
    ....

The issue can be triggered with the following reproducer:

$ovn-nbctl ls-add sw
$ovn-nbctl lsp-add sw p1
$ovn-nbctl lsp-set-addresses p1 "00:00:00:00:00:02 192.168.0.2"
$ovn-nbctl lsp-add sw p2
$ovn-nbctl lsp-set-addresses p2 "00:00:00:00:00:03 192.168.0.3"
$ovn-nbctl pg-add pg1 p1 p2
$ovn-nbctl acl-add pg1 to-lport 2003 "inport==@pg1 && ip4 && ip4.src == 192.168.0.0/16 && udp && udp.dst == 9000" allow
$ovn-nbctl acl-add pg1 to-lport 2001 "inport==@pg1" reject
$ovn-trace 'inport == "p2" && eth.src == 00:00:00:00:00:03 && eth.dst == 00:00:00:00:00:02 && ip.ttl==42 && ip4.src == 192.168.0.3'

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2074537
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
putnopvut pushed a commit that referenced this pull request May 10, 2022
Avoid the following crash in ovn-trace due to a reject action infinite
loop:

AddressSanitizer:DEADLYSIGNAL
==569410==ERROR: AddressSanitizer: stack-overflow on address 0x7ffc0a991bc4 (pc 0x000000415081 bp 0x7ffc0a993fa0 sp 0x7ffc0a991b30 T0)
    #0 0x415081 in trace_actions utilities/ovn-trace.c:2617
    #1 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #2 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #3 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #4 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #5 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #6 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #7 0x41788d in execute_next utilities/ovn-trace.c:2307
    #8 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #9 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #10 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #11 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #12 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #13 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #14 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #15 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #16 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #17 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #18 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #19 0x41788d in execute_next utilities/ovn-trace.c:2307
    #20 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #21 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #22 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #23 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #24 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #25 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #26 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #27 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #28 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #29 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #30 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #31 0x41788d in execute_next utilities/ovn-trace.c:2307
    #32 0x41788d in trace_actions utilities/ovn-trace.c:2644
    #33 0x41a7c0 in trace_actions utilities/ovn-trace.c:2622
    #34 0x41a7c0 in execute_sctp4_abort utilities/ovn-trace.c:1985
    #35 0x419671 in execute_reject utilities/ovn-trace.c:2049
    #36 0x419671 in trace_actions utilities/ovn-trace.c:2860
    #37 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #38 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #39 0x41e3a8 in execute_output utilities/ovn-trace.c:1700
    #40 0x416fcf in trace_actions utilities/ovn-trace.c:2640
    #41 0x41d878 in trace_actions utilities/ovn-trace.c:2622
    #42 0x41d878 in trace__ utilities/ovn-trace.c:3007
    #43 0x41788d in execute_next utilities/ovn-trace.c:2307
    ....

The issue can be triggered with the following reproducer:

$ovn-nbctl ls-add sw
$ovn-nbctl lsp-add sw p1
$ovn-nbctl lsp-set-addresses p1 "00:00:00:00:00:02 192.168.0.2"
$ovn-nbctl lsp-add sw p2
$ovn-nbctl lsp-set-addresses p2 "00:00:00:00:00:03 192.168.0.3"
$ovn-nbctl pg-add pg1 p1 p2
$ovn-nbctl acl-add pg1 to-lport 2003 "inport==@pg1 && ip4 && ip4.src == 192.168.0.0/16 && udp && udp.dst == 9000" allow
$ovn-nbctl acl-add pg1 to-lport 2001 "inport==@pg1" reject
$ovn-trace 'inport == "p2" && eth.src == 00:00:00:00:00:03 && eth.dst == 00:00:00:00:00:02 && ip.ttl==42 && ip4.src == 192.168.0.3'

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2074537
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Aug 19, 2022
Fix the problem introduced by commit e52c245, reported by ASAN for test case:
"options:activation-strategy for logical port"

==1480622==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61100000c7d0 at pc 0x0000004fbd91 bp 0x7ffec4244630 sp 0x7ffec4243de0
READ of size 168 at 0x61100000c7d0 thread T0
    #0 0x4fbd90 in __interceptor_memcpy.part.0 (/home/hanzhou/src/ovn/_build_as/controller/ovn-controller+0x4fbd90)
    ovn-org#1 0x73457f in ofpbuf_put /home/hanzhou/src/ovs/_build/../lib/ofpbuf.c:431:5
    ovn-org#2 0x73457f in ofpbuf_put /home/hanzhou/src/ovs/_build/../lib/ofpbuf.c:424:1
    ovn-org#3 0x72ba29 in ofpprop_put /home/hanzhou/src/ovs/_build/../lib/ofp-prop.c:294:5
    ovn-org#4 0x7046e7 in encode_CONTROLLER /home/hanzhou/src/ovs/_build/../lib/ofp-actions.c:914:13
    ovn-org#5 0x7046e7 in encode_ofpact /home/hanzhou/src/ovs/_build/../lib/ofp-actions.c:8890:9
    ovn-org#6 0x705878 in ofpacts_put_openflow_instructions /home/hanzhou/src/ovs/_build/../lib/ofp-actions.c:8943:17
    ovn-org#7 0x716287 in ofputil_encode_flow_mod /home/hanzhou/src/ovs/_build/../lib/ofp-flow.c:426:9
    ovn-org#8 0x5c5978 in encode_flow_mod /home/hanzhou/src/ovn/_build_as/../controller/ofctrl.c:1893:12
    ovn-org#9 0x5c5978 in add_flow_mod /home/hanzhou/src/ovn/_build_as/../controller/ofctrl.c:1912:26
    ovn-org#10 0x5c5978 in installed_flow_add /home/hanzhou/src/ovn/_build_as/../controller/ofctrl.c:2254:5
    ovn-org#11 0x5bfd62 in update_installed_flows_by_track /home/hanzhou/src/ovn/_build_as/../controller/ofctrl.c:2484:17
    ovn-org#12 0x5bc5b9 in ofctrl_put /home/hanzhou/src/ovn/_build_as/../controller/ofctrl.c:2715:13
    ovn-org#13 0x600e97 in main /home/hanzhou/src/ovn/_build_as/../controller/ovn-controller.c:4186:25
    ovn-org#14 0x7f7ae80ce1a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)
    ovn-org#15 0x49432d in _start (/home/hanzhou/src/ovn/_build_as/controller/ovn-controller+0x49432d)

Fixes: e52c245 ("physical.c: Fix bug of wrong use in vm migration")
Signed-off-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
hzhou8 added a commit to hzhou8/ovn that referenced this pull request Jun 29, 2023
…eletion.

When multiple LSP deletions are handled in incremental processing, if it
hits a LSP that can't be incrementally processed after incrementally
processing some LSP deletions, it falls back to recompute without
destroying the ovn_port objects that are already handled in the handler,
resulting in memory leaks. See example below, which is detected by the
new test case added by this patch when running with address sanitizer.

=======================

Indirect leak of 936 byte(s) in 3 object(s) allocated from:
    #0 0x55bce7 in calloc (/home/hanzhou/src/ovn/_build_as/northd/ovn-northd+0x55bce7)
    #1 0x773f4e in xcalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:121:31
    #2 0x773f4e in xzalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:131:12
    #3 0x773f4e in xzalloc /home/hanzhou/src/ovs/_build/../lib/util.c:165:12
    #4 0x60106c in en_northd_run /home/hanzhou/src/ovn/_build_as/../northd/en-northd.c:137:5
    ovn-org#5 0x61c6a8 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:415:5
    ovn-org#6 0x61bee0 in engine_compute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:454:17
    ovn-org#7 0x61bee0 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:503:14
    ovn-org#8 0x61bee0 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:528:9
    ovn-org#9 0x605e23 in inc_proc_northd_run /home/hanzhou/src/ovn/_build_as/../northd/inc-proc-northd.c:317:9
    ovn-org#10 0x5fe43b in main /home/hanzhou/src/ovn/_build_as/../northd/ovn-northd.c:934:33
    ovn-org#11 0x7f473933c1a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)

Indirect leak of 204 byte(s) in 3 object(s) allocated from:
    #0 0x55bea8 in realloc (/home/hanzhou/src/ovn/_build_as/northd/ovn-northd+0x55bea8)
    #1 0x773c7d in xrealloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:147:9
    #2 0x773c7d in xrealloc /home/hanzhou/src/ovs/_build/../lib/util.c:179:12
    #3 0x614bd4 in extract_addresses /home/hanzhou/src/ovn/_build_as/../lib/ovn-util.c:228:12
    #4 0x614bd4 in extract_lsp_addresses /home/hanzhou/src/ovn/_build_as/../lib/ovn-util.c:243:20
    ovn-org#5 0x5c8d90 in parse_lsp_addrs /home/hanzhou/src/ovn/_build_as/../northd/northd.c:2468:21
    ovn-org#6 0x5b2ebf in join_logical_ports /home/hanzhou/src/ovn/_build_as/../northd/northd.c:2594:13
    ovn-org#7 0x5b2ebf in build_ports /home/hanzhou/src/ovn/_build_as/../northd/northd.c:4711:5
    ovn-org#8 0x5b2ebf in ovnnb_db_run /home/hanzhou/src/ovn/_build_as/../northd/northd.c:17376:5
    ovn-org#9 0x60106c in en_northd_run /home/hanzhou/src/ovn/_build_as/../northd/en-northd.c:137:5
    ovn-org#10 0x61c6a8 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:415:5
    ovn-org#11 0x61bee0 in engine_compute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:454:17
    ovn-org#12 0x61bee0 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:503:14
    ovn-org#13 0x61bee0 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:528:9
    ovn-org#14 0x605e23 in inc_proc_northd_run /home/hanzhou/src/ovn/_build_as/../northd/inc-proc-northd.c:317:9
    ovn-org#15 0x5fe43b in main /home/hanzhou/src/ovn/_build_as/../northd/ovn-northd.c:934:33
    ovn-org#16 0x7f473933c1a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)
...

Fixes: b337750 ("northd: Incremental processing of VIF changes in 'northd' node.")
Reported-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
ovsrobot pushed a commit to ovsrobot/ovn that referenced this pull request Jun 29, 2023
…eletion.

When multiple LSP deletions are handled in incremental processing, if it
hits a LSP that can't be incrementally processed after incrementally
processing some LSP deletions, it falls back to recompute without
destroying the ovn_port objects that are already handled in the handler,
resulting in memory leaks. See example below, which is detected by the
new test case added by this patch when running with address sanitizer.

=======================

Indirect leak of 936 byte(s) in 3 object(s) allocated from:
    #0 0x55bce7 in calloc (/home/hanzhou/src/ovn/_build_as/northd/ovn-northd+0x55bce7)
    ovn-org#1 0x773f4e in xcalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:121:31
    ovn-org#2 0x773f4e in xzalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:131:12
    ovn-org#3 0x773f4e in xzalloc /home/hanzhou/src/ovs/_build/../lib/util.c:165:12
    ovn-org#4 0x60106c in en_northd_run /home/hanzhou/src/ovn/_build_as/../northd/en-northd.c:137:5
    ovn-org#5 0x61c6a8 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:415:5
    ovn-org#6 0x61bee0 in engine_compute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:454:17
    ovn-org#7 0x61bee0 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:503:14
    ovn-org#8 0x61bee0 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:528:9
    ovn-org#9 0x605e23 in inc_proc_northd_run /home/hanzhou/src/ovn/_build_as/../northd/inc-proc-northd.c:317:9
    ovn-org#10 0x5fe43b in main /home/hanzhou/src/ovn/_build_as/../northd/ovn-northd.c:934:33
    ovn-org#11 0x7f473933c1a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)

Indirect leak of 204 byte(s) in 3 object(s) allocated from:
    #0 0x55bea8 in realloc (/home/hanzhou/src/ovn/_build_as/northd/ovn-northd+0x55bea8)
    ovn-org#1 0x773c7d in xrealloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:147:9
    ovn-org#2 0x773c7d in xrealloc /home/hanzhou/src/ovs/_build/../lib/util.c:179:12
    ovn-org#3 0x614bd4 in extract_addresses /home/hanzhou/src/ovn/_build_as/../lib/ovn-util.c:228:12
    ovn-org#4 0x614bd4 in extract_lsp_addresses /home/hanzhou/src/ovn/_build_as/../lib/ovn-util.c:243:20
    ovn-org#5 0x5c8d90 in parse_lsp_addrs /home/hanzhou/src/ovn/_build_as/../northd/northd.c:2468:21
    ovn-org#6 0x5b2ebf in join_logical_ports /home/hanzhou/src/ovn/_build_as/../northd/northd.c:2594:13
    ovn-org#7 0x5b2ebf in build_ports /home/hanzhou/src/ovn/_build_as/../northd/northd.c:4711:5
    ovn-org#8 0x5b2ebf in ovnnb_db_run /home/hanzhou/src/ovn/_build_as/../northd/northd.c:17376:5
    ovn-org#9 0x60106c in en_northd_run /home/hanzhou/src/ovn/_build_as/../northd/en-northd.c:137:5
    ovn-org#10 0x61c6a8 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:415:5
    ovn-org#11 0x61bee0 in engine_compute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:454:17
    ovn-org#12 0x61bee0 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:503:14
    ovn-org#13 0x61bee0 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:528:9
    ovn-org#14 0x605e23 in inc_proc_northd_run /home/hanzhou/src/ovn/_build_as/../northd/inc-proc-northd.c:317:9
    ovn-org#15 0x5fe43b in main /home/hanzhou/src/ovn/_build_as/../northd/ovn-northd.c:934:33
    ovn-org#16 0x7f473933c1a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)
...

Fixes: b337750 ("northd: Incremental processing of VIF changes in 'northd' node.")
Reported-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
hzhou8 added a commit that referenced this pull request Jun 30, 2023
…eletion.

When multiple LSP deletions are handled in incremental processing, if it
hits a LSP that can't be incrementally processed after incrementally
processing some LSP deletions, it falls back to recompute without
destroying the ovn_port objects that are already handled in the handler,
resulting in memory leaks. See example below, which is detected by the
new test case added by this patch when running with address sanitizer.

=======================

Indirect leak of 936 byte(s) in 3 object(s) allocated from:
    #0 0x55bce7 in calloc (/home/hanzhou/src/ovn/_build_as/northd/ovn-northd+0x55bce7)
    #1 0x773f4e in xcalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:121:31
    #2 0x773f4e in xzalloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:131:12
    #3 0x773f4e in xzalloc /home/hanzhou/src/ovs/_build/../lib/util.c:165:12
    #4 0x60106c in en_northd_run /home/hanzhou/src/ovn/_build_as/../northd/en-northd.c:137:5
    #5 0x61c6a8 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:415:5
    #6 0x61bee0 in engine_compute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:454:17
    #7 0x61bee0 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:503:14
    #8 0x61bee0 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:528:9
    #9 0x605e23 in inc_proc_northd_run /home/hanzhou/src/ovn/_build_as/../northd/inc-proc-northd.c:317:9
    #10 0x5fe43b in main /home/hanzhou/src/ovn/_build_as/../northd/ovn-northd.c:934:33
    #11 0x7f473933c1a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)

Indirect leak of 204 byte(s) in 3 object(s) allocated from:
    #0 0x55bea8 in realloc (/home/hanzhou/src/ovn/_build_as/northd/ovn-northd+0x55bea8)
    #1 0x773c7d in xrealloc__ /home/hanzhou/src/ovs/_build/../lib/util.c:147:9
    #2 0x773c7d in xrealloc /home/hanzhou/src/ovs/_build/../lib/util.c:179:12
    #3 0x614bd4 in extract_addresses /home/hanzhou/src/ovn/_build_as/../lib/ovn-util.c:228:12
    #4 0x614bd4 in extract_lsp_addresses /home/hanzhou/src/ovn/_build_as/../lib/ovn-util.c:243:20
    #5 0x5c8d90 in parse_lsp_addrs /home/hanzhou/src/ovn/_build_as/../northd/northd.c:2468:21
    #6 0x5b2ebf in join_logical_ports /home/hanzhou/src/ovn/_build_as/../northd/northd.c:2594:13
    #7 0x5b2ebf in build_ports /home/hanzhou/src/ovn/_build_as/../northd/northd.c:4711:5
    #8 0x5b2ebf in ovnnb_db_run /home/hanzhou/src/ovn/_build_as/../northd/northd.c:17376:5
    #9 0x60106c in en_northd_run /home/hanzhou/src/ovn/_build_as/../northd/en-northd.c:137:5
    #10 0x61c6a8 in engine_recompute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:415:5
    #11 0x61bee0 in engine_compute /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:454:17
    #12 0x61bee0 in engine_run_node /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:503:14
    #13 0x61bee0 in engine_run /home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:528:9
    #14 0x605e23 in inc_proc_northd_run /home/hanzhou/src/ovn/_build_as/../northd/inc-proc-northd.c:317:9
    #15 0x5fe43b in main /home/hanzhou/src/ovn/_build_as/../northd/ovn-northd.c:934:33
    #16 0x7f473933c1a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)
...

Fixes: b337750 ("northd: Incremental processing of VIF changes in 'northd' node.")
Reported-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants