From 8f9da4e94f5b42bb3406314f8154b41a63648ee9 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Jun 01 2022 13:48:19 +0000 Subject: Import openvswitch2.15-2.15.0-104 from Fast DataPath --- diff --git a/SOURCES/openvswitch-2.15.0.patch b/SOURCES/openvswitch-2.15.0.patch index b9ee44f..5373d3e 100644 --- a/SOURCES/openvswitch-2.15.0.patch +++ b/SOURCES/openvswitch-2.15.0.patch @@ -22585,6 +22585,82 @@ index 8f2ea34308..8d141b41e3 100644 + HMAP_FOR_EACH (ITER, hmap_node, &(DUMP)->numas) #endif /* ovs-numa.h */ +diff --git a/lib/ovs-rcu.c b/lib/ovs-rcu.c +index cde1e925ba..9dfda3f053 100644 +--- a/lib/ovs-rcu.c ++++ b/lib/ovs-rcu.c +@@ -447,3 +447,40 @@ ovsrcu_init_module(void) + ovsthread_once_done(&once); + } + } ++ ++static void ++ovsrcu_barrier_func(void *seq_) ++{ ++ struct seq *seq = (struct seq *) seq_; ++ seq_change(seq); ++} ++ ++/* Similar to the kernel rcu_barrier, ovsrcu_barrier waits for all outstanding ++ * RCU callbacks to complete. However, unlike the kernel rcu_barrier, which ++ * might return immediately if there are no outstanding RCU callbacks, ++ * this API will at least wait for a grace period. ++ * ++ * Another issue the caller might need to know is that the barrier is just ++ * for "one-shot", i.e. if inside some RCU callbacks, another RCU callback is ++ * registered, this API only guarantees the first round of RCU callbacks have ++ * been executed after it returns. ++ */ ++void ++ovsrcu_barrier(void) ++{ ++ struct seq *seq = seq_create(); ++ /* First let all threads flush their cbsets. */ ++ ovsrcu_synchronize(); ++ ++ /* Then register a new cbset, ensure this cbset ++ * is at the tail of the global list. */ ++ uint64_t seqno = seq_read(seq); ++ ovsrcu_postpone__(ovsrcu_barrier_func, (void *) seq); ++ ++ do { ++ seq_wait(seq, seqno); ++ poll_block(); ++ } while (seqno == seq_read(seq)); ++ ++ seq_destroy(seq); ++} +diff --git a/lib/ovs-rcu.h b/lib/ovs-rcu.h +index ecc4c92010..8b397b7fb0 100644 +--- a/lib/ovs-rcu.h ++++ b/lib/ovs-rcu.h +@@ -155,6 +155,19 @@ + * port_delete(id); + * } + * ++ * Use ovsrcu_barrier() to wait for all the outstanding RCU callbacks to ++ * finish. This is useful when you have to destroy some resources however ++ * these resources are referenced in the outstanding RCU callbacks. ++ * ++ * void rcu_cb(void *A) { ++ * do_something(A); ++ * } ++ * ++ * void destroy_A() { ++ * ovsrcu_postpone(rcu_cb, A); // will use A later ++ * ovsrcu_barrier(); // wait for rcu_cb done ++ * do_destroy_A(); // free A ++ * } + */ + + #include "compiler.h" +@@ -310,4 +323,6 @@ void ovsrcu_synchronize(void); + + void ovsrcu_exit(void); + ++void ovsrcu_barrier(void); ++ + #endif /* ovs-rcu.h */ diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c index ff8adaefb5..249cff0512 100644 --- a/lib/ovsdb-cs.c @@ -24894,7 +24970,7 @@ index 3426a27b2d..e4959ec686 100644 void xlate_bundle_set(struct ofproto_dpif *, struct ofbundle *, const char *name, enum port_vlan_mode, diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c -index fd0b2fdea0..12781d6ae0 100644 +index fd0b2fdea0..534283b14c 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -215,10 +215,6 @@ struct shash all_dpif_backers = SHASH_INITIALIZER(&all_dpif_backers); @@ -24963,7 +25039,16 @@ index fd0b2fdea0..12781d6ae0 100644 OFPROTO_FOR_EACH_TABLE (table, &ofproto->up) { CLS_FOR_EACH (rule, up.cr, &table->cls) { -@@ -2314,6 +2324,12 @@ set_ipfix( +@@ -1800,6 +1810,8 @@ destruct(struct ofproto *ofproto_, bool del) + + seq_destroy(ofproto->ams_seq); + ++ /* Wait for all the meter destroy work to finish. */ ++ ovsrcu_barrier(); + close_dpif_backer(ofproto->backer, del); + } + +@@ -2314,6 +2326,12 @@ set_ipfix( dpif_ipfix_unref(di); ofproto->ipfix = NULL; } @@ -24976,7 +25061,7 @@ index fd0b2fdea0..12781d6ae0 100644 } return 0; -@@ -4414,12 +4430,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, +@@ -4414,12 +4432,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, atomic_add_relaxed(&tbl->n_matched, stats->n_packets, &orig); } if (xcache) { @@ -24996,7 +25081,7 @@ index fd0b2fdea0..12781d6ae0 100644 } return rule; } -@@ -4450,12 +4468,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, +@@ -4450,12 +4470,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, stats->n_packets, &orig); } if (xcache) { @@ -25016,7 +25101,7 @@ index fd0b2fdea0..12781d6ae0 100644 } if (rule) { goto out; /* Match. */ -@@ -5413,6 +5433,8 @@ ct_add_timeout_policy_to_dpif(struct dpif *dpif, +@@ -5413,6 +5435,8 @@ ct_add_timeout_policy_to_dpif(struct dpif *dpif, struct ct_dpif_timeout_policy cdtp; struct simap_node *node; @@ -25025,7 +25110,7 @@ index fd0b2fdea0..12781d6ae0 100644 cdtp.id = ct_tp->tp_id; SIMAP_FOR_EACH (node, &ct_tp->tp) { ct_dpif_set_timeout_policy_attr_by_name(&cdtp, node->name, node->data); -@@ -5535,6 +5557,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, +@@ -5535,6 +5559,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, ct_timeout_policy_unref(backer, ct_zone->ct_tp); ct_zone->ct_tp = ct_tp; ct_tp->ref_count++; @@ -25033,7 +25118,7 @@ index fd0b2fdea0..12781d6ae0 100644 } } else { struct ct_zone *new_ct_zone = ct_zone_alloc(zone_id); -@@ -5542,6 +5565,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, +@@ -5542,6 +5567,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, cmap_insert(&backer->ct_zones, &new_ct_zone->node, hash_int(zone_id, 0)); ct_tp->ref_count++; @@ -25041,7 +25126,7 @@ index fd0b2fdea0..12781d6ae0 100644 } } -@@ -5558,6 +5582,7 @@ ct_del_zone_timeout_policy(const char *datapath_type, uint16_t zone_id) +@@ -5558,6 +5584,7 @@ ct_del_zone_timeout_policy(const char *datapath_type, uint16_t zone_id) if (ct_zone) { ct_timeout_policy_unref(backer, ct_zone->ct_tp); ct_zone_remove_and_destroy(backer, ct_zone); @@ -25049,7 +25134,7 @@ index fd0b2fdea0..12781d6ae0 100644 } } -@@ -5603,6 +5628,7 @@ get_datapath_cap(const char *datapath_type, struct smap *cap) +@@ -5603,6 +5630,7 @@ get_datapath_cap(const char *datapath_type, struct smap *cap) smap_add(cap, "explicit_drop_action", s.explicit_drop_action ? "true" :"false"); smap_add(cap, "lb_output_action", s.lb_output_action ? "true" : "false"); @@ -25057,7 +25142,7 @@ index fd0b2fdea0..12781d6ae0 100644 } /* Gets timeout policy name in 'backer' based on 'zone', 'dl_type' and -@@ -5757,15 +5783,7 @@ ofproto_dpif_lookup_by_name(const char *name) +@@ -5757,15 +5785,7 @@ ofproto_dpif_lookup_by_name(const char *name) struct ofproto_dpif * ofproto_dpif_lookup_by_uuid(const struct uuid *uuid) { @@ -25074,7 +25159,7 @@ index fd0b2fdea0..12781d6ae0 100644 } static void -@@ -6375,6 +6393,7 @@ ofproto_unixctl_dpif_show_dp_features(struct unixctl_conn *conn, +@@ -6375,6 +6395,7 @@ ofproto_unixctl_dpif_show_dp_features(struct unixctl_conn *conn, dpif_show_support(&ofproto->backer->bt_support, &ds); unixctl_command_reply(conn, ds_cstr(&ds)); @@ -26861,6 +26946,19 @@ index e3173fb88f..2347c690ef 100644 diff --git a/tests/fuzz-regression/ofp_print_fuzzer-6540965472632832 b/tests/fuzz-regression/ofp_print_fuzzer-6540965472632832 new file mode 100644 index 0000000000..e69de29bb2 +diff --git a/tests/library.at b/tests/library.at +index 1702b7556b..e27d9e8bce 100644 +--- a/tests/library.at ++++ b/tests/library.at +@@ -247,7 +247,7 @@ AT_CHECK([ovstest test-ofpbuf], [0], []) + AT_CLEANUP + + AT_SETUP([rcu]) +-AT_CHECK([ovstest test-rcu-quiesce], [0], []) ++AT_CHECK([ovstest test-rcu], [0], []) + AT_CLEANUP + + AT_SETUP([stopwatch module]) diff --git a/tests/mcast-snooping.at b/tests/mcast-snooping.at index 757cf7186e..fe475e7b38 100644 --- a/tests/mcast-snooping.at @@ -31218,6 +31316,50 @@ index a196802743..123f89f081 100644 step += 1 seqno = idl.change_seqno +diff --git a/tests/test-rcu.c b/tests/test-rcu.c +index 965f3c49f3..bb17092bf0 100644 +--- a/tests/test-rcu.c ++++ b/tests/test-rcu.c +@@ -35,7 +35,7 @@ quiescer_main(void *aux OVS_UNUSED) + } + + static void +-test_rcu_quiesce(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) ++test_rcu_quiesce(void) + { + pthread_t quiescer; + +@@ -48,4 +48,29 @@ test_rcu_quiesce(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) + xpthread_join(quiescer, NULL); + } + +-OVSTEST_REGISTER("test-rcu-quiesce", test_rcu_quiesce); ++static void ++add_count(void *_count) ++{ ++ unsigned *count = (unsigned *)_count; ++ (*count) ++; ++} ++ ++static void ++test_rcu_barrier(void) ++{ ++ unsigned count = 0; ++ for (int i = 0; i < 10; i ++) { ++ ovsrcu_postpone(add_count, &count); ++ } ++ ++ ovsrcu_barrier(); ++ ovs_assert(count == 10); ++} ++ ++static void ++test_rcu(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { ++ test_rcu_quiesce(); ++ test_rcu_barrier(); ++} ++ ++OVSTEST_REGISTER("test-rcu", test_rcu); diff --git a/tests/test-reconnect.py b/tests/test-reconnect.py index f0ad9f9793..cea48eb527 100644 --- a/tests/test-reconnect.py diff --git a/SPECS/openvswitch2.15.spec b/SPECS/openvswitch2.15.spec index c958827..51603c7 100644 --- a/SPECS/openvswitch2.15.spec +++ b/SPECS/openvswitch2.15.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.15.0 -Release: 103%{?dist} +Release: 104%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -702,6 +702,13 @@ exit 0 %endif %changelog +* Wed Jun 01 2022 Open vSwitch CI - 2.15.0-104 +- Merging upstream branch-2.15 [RH git: 873c041417] + Commit list: + 22ccbc1dba ofproto-dpif: Fix meter use-after-free. + ffc10739a2 ovs-rcu: Add ovsrcu_barrier. + + * Thu May 26 2022 Open vSwitch CI - 2.15.0-103 - Merging upstream branch-2.15 [RH git: d93e08b22f] Commit list: