Re: [ovs-dev] [PATCH ovn] northd: Fix NULL pointer deref within build_bfd_table.
I pushed this to main and branch-24.03. On 3/11/24 11:02, Mark Michelson wrote: Thanks for fixing the crash, and thanks for taking the extra effort to ensure BFD tests are run by CI. Acked-by: Mark Michelson On 3/11/24 10:48, Ales Musil wrote: The cb_bt pointer was pointing to different struct and might have been NULL at this point. Make sure we are using the correct pointer in the strcmp() and sbrec_bfd_set_chassis_name() call. At the same time make sure we are actually running all tests that do require the BFD beacon, as it was skipped in all CI stages. The OpenBFDD project is not available as rpm, so we need to compile it from source. Fixes: 4885e337f929 ("rbac: Only allow relevant chassis to update BFD.") Signed-off-by: Ales Musil --- northd/northd.c | 5 ++-- utilities/automake.mk | 1 + utilities/containers/fedora/Dockerfile | 18 utilities/containers/openbfdd.patch | 39 ++ utilities/containers/ubuntu/Dockerfile | 18 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 utilities/containers/openbfdd.patch diff --git a/northd/northd.c b/northd/northd.c index 4b39137e7..1839b7d8b 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -9804,8 +9804,9 @@ build_bfd_table(struct ovsdb_idl_txn *ovnsb_txn, } build_bfd_update_sb_conf(nb_bt, bfd_e->sb_bt); if (op && op->sb && op->sb->chassis && - strcmp(op->sb->chassis->name, sb_bt->chassis_name)) { - sbrec_bfd_set_chassis_name(sb_bt, op->sb->chassis->name); + strcmp(op->sb->chassis->name, bfd_e->sb_bt->chassis_name)) { + sbrec_bfd_set_chassis_name(bfd_e->sb_bt, + op->sb->chassis->name); } hmap_remove(_only, _e->hmap_node); diff --git a/utilities/automake.mk b/utilities/automake.mk index c44563c26..ebb74ec34 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -38,6 +38,7 @@ EXTRA_DIST += \ utilities/ovndb-servers.ocf \ utilities/checkpatch.py \ utilities/containers/Makefile \ + utilities/containers/openbfdd.patch \ utilities/containers/py-requirements.txt \ utilities/containers/fedora/Dockerfile \ utilities/containers/ubuntu/Dockerfile \ diff --git a/utilities/containers/fedora/Dockerfile b/utilities/containers/fedora/Dockerfile index 4058d7f5b..bf3c293fc 100755 --- a/utilities/containers/fedora/Dockerfile +++ b/utilities/containers/fedora/Dockerfile @@ -52,6 +52,24 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ && \ make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install +# Compile OpenBFDD from source +WORKDIR /workspace/OpenBFDD + +COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch + +RUN git clone https://github.com/dyninc/OpenBFDD.git \ + /workspace/OpenBFDD \ + && \ + git apply /tmp/openbfdd.patch \ + && \ + ./autogen.sh \ + && \ + ./configure --enable-silent-rules \ + && \ + make \ + && \ + make install + WORKDIR /workspace COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt diff --git a/utilities/containers/openbfdd.patch b/utilities/containers/openbfdd.patch new file mode 100644 index 0..96e8095d9 --- /dev/null +++ b/utilities/containers/openbfdd.patch @@ -0,0 +1,39 @@ +diff --git a/Logger.cpp b/Logger.cpp +index f375b20..e72afba 100755 +--- a/Logger.cpp b/Logger.cpp +@@ -11,6 +11,8 @@ + #include + #include + #include ++#include ++#include + + const size_t Logger::MaxMessageLen; + +diff --git a/SchedulerBase.cpp b/SchedulerBase.cpp +index 3eab298..c1dffc4 100755 +--- a/SchedulerBase.cpp b/SchedulerBase.cpp +@@ -11,6 +11,8 @@ + #include + #include + #include ++#include ++#include + + using namespace std; + +diff --git a/utils.cpp b/utils.cpp +index 79c7b68..f846459 100755 +--- a/utils.cpp b/utils.cpp +@@ -13,6 +13,8 @@ + #include + #include + #include ++#include ++#include + + using namespace std; + diff --git a/utilities/containers/ubuntu/Dockerfile b/utilities/containers/ubuntu/Dockerfile index 5d5bedbd9..1371b3f70 100755 --- a/utilities/containers/ubuntu/Dockerfile +++ b/utilities/containers/ubuntu/Dockerfile @@ -51,6 +51,24 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ && \ make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install +# Compile OpenBFDD from source +WORKDIR /workspace/OpenBFDD + +COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch + +RUN git clone https://github.com/dyninc/OpenBFDD.git \ + /workspace/OpenBFDD \ + && \ + git apply /tmp/openbfdd.patch \ + && \ + ./autogen.sh \ + && \ + ./configure --enable-silent-rules \ + && \ + make \ + && \ + make install + WORKDIR /workspace COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt
Re: [ovs-dev] [PATCH ovn] northd: Fix NULL pointer deref within build_bfd_table.
Thanks for fixing the crash, and thanks for taking the extra effort to ensure BFD tests are run by CI. Acked-by: Mark Michelson On 3/11/24 10:48, Ales Musil wrote: The cb_bt pointer was pointing to different struct and might have been NULL at this point. Make sure we are using the correct pointer in the strcmp() and sbrec_bfd_set_chassis_name() call. At the same time make sure we are actually running all tests that do require the BFD beacon, as it was skipped in all CI stages. The OpenBFDD project is not available as rpm, so we need to compile it from source. Fixes: 4885e337f929 ("rbac: Only allow relevant chassis to update BFD.") Signed-off-by: Ales Musil --- northd/northd.c| 5 ++-- utilities/automake.mk | 1 + utilities/containers/fedora/Dockerfile | 18 utilities/containers/openbfdd.patch| 39 ++ utilities/containers/ubuntu/Dockerfile | 18 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 utilities/containers/openbfdd.patch diff --git a/northd/northd.c b/northd/northd.c index 4b39137e7..1839b7d8b 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -9804,8 +9804,9 @@ build_bfd_table(struct ovsdb_idl_txn *ovnsb_txn, } build_bfd_update_sb_conf(nb_bt, bfd_e->sb_bt); if (op && op->sb && op->sb->chassis && -strcmp(op->sb->chassis->name, sb_bt->chassis_name)) { -sbrec_bfd_set_chassis_name(sb_bt, op->sb->chassis->name); +strcmp(op->sb->chassis->name, bfd_e->sb_bt->chassis_name)) { +sbrec_bfd_set_chassis_name(bfd_e->sb_bt, + op->sb->chassis->name); } hmap_remove(_only, _e->hmap_node); diff --git a/utilities/automake.mk b/utilities/automake.mk index c44563c26..ebb74ec34 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -38,6 +38,7 @@ EXTRA_DIST += \ utilities/ovndb-servers.ocf \ utilities/checkpatch.py \ utilities/containers/Makefile \ +utilities/containers/openbfdd.patch \ utilities/containers/py-requirements.txt \ utilities/containers/fedora/Dockerfile \ utilities/containers/ubuntu/Dockerfile \ diff --git a/utilities/containers/fedora/Dockerfile b/utilities/containers/fedora/Dockerfile index 4058d7f5b..bf3c293fc 100755 --- a/utilities/containers/fedora/Dockerfile +++ b/utilities/containers/fedora/Dockerfile @@ -52,6 +52,24 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ && \ make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install +# Compile OpenBFDD from source +WORKDIR /workspace/OpenBFDD + +COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch + +RUN git clone https://github.com/dyninc/OpenBFDD.git \ +/workspace/OpenBFDD \ +&& \ +git apply /tmp/openbfdd.patch \ +&& \ +./autogen.sh \ +&& \ +./configure --enable-silent-rules \ +&& \ +make \ +&& \ +make install + WORKDIR /workspace COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt diff --git a/utilities/containers/openbfdd.patch b/utilities/containers/openbfdd.patch new file mode 100644 index 0..96e8095d9 --- /dev/null +++ b/utilities/containers/openbfdd.patch @@ -0,0 +1,39 @@ +diff --git a/Logger.cpp b/Logger.cpp +index f375b20..e72afba 100755 +--- a/Logger.cpp b/Logger.cpp +@@ -11,6 +11,8 @@ + #include + #include + #include ++#include ++#include + + const size_t Logger::MaxMessageLen; + +diff --git a/SchedulerBase.cpp b/SchedulerBase.cpp +index 3eab298..c1dffc4 100755 +--- a/SchedulerBase.cpp b/SchedulerBase.cpp +@@ -11,6 +11,8 @@ + #include + #include + #include ++#include ++#include + + using namespace std; + +diff --git a/utils.cpp b/utils.cpp +index 79c7b68..f846459 100755 +--- a/utils.cpp b/utils.cpp +@@ -13,6 +13,8 @@ + #include + #include + #include ++#include ++#include + + using namespace std; + diff --git a/utilities/containers/ubuntu/Dockerfile b/utilities/containers/ubuntu/Dockerfile index 5d5bedbd9..1371b3f70 100755 --- a/utilities/containers/ubuntu/Dockerfile +++ b/utilities/containers/ubuntu/Dockerfile @@ -51,6 +51,24 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ && \ make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install +# Compile OpenBFDD from source +WORKDIR /workspace/OpenBFDD + +COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch + +RUN git clone https://github.com/dyninc/OpenBFDD.git \ +/workspace/OpenBFDD \ +&& \ +git apply /tmp/openbfdd.patch \ +&& \ +./autogen.sh \ +&& \ +./configure --enable-silent-rules \ +&& \ +make \ +&& \ +make install + WORKDIR /workspace COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt ___ dev mailing list d...@openvswitch.org
Re: [ovs-dev] [PATCH ovn] northd: Fix NULL pointer deref within build_bfd_table.
Bleep bloop. Greetings Ales Musil, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: WARNING: Line has non-spaces leading whitespace WARNING: Line has trailing whitespace #99 FILE: utilities/containers/openbfdd.patch:11: WARNING: Line has non-spaces leading whitespace WARNING: Line has trailing whitespace #101 FILE: utilities/containers/openbfdd.patch:13: WARNING: Line has non-spaces leading whitespace WARNING: Line has trailing whitespace #112 FILE: utilities/containers/openbfdd.patch:24: WARNING: Line has non-spaces leading whitespace WARNING: Line has trailing whitespace #114 FILE: utilities/containers/openbfdd.patch:26: WARNING: Line has non-spaces leading whitespace WARNING: Line has trailing whitespace #125 FILE: utilities/containers/openbfdd.patch:37: WARNING: Line has non-spaces leading whitespace WARNING: Line has trailing whitespace #127 FILE: utilities/containers/openbfdd.patch:39: Lines checked: 160, Warnings: 12, Errors: 0 Please check this out. If you feel there has been an error, please email acon...@redhat.com Thanks, 0-day Robot ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH ovn] northd: Fix NULL pointer deref within build_bfd_table.
The cb_bt pointer was pointing to different struct and might have been NULL at this point. Make sure we are using the correct pointer in the strcmp() and sbrec_bfd_set_chassis_name() call. At the same time make sure we are actually running all tests that do require the BFD beacon, as it was skipped in all CI stages. The OpenBFDD project is not available as rpm, so we need to compile it from source. Fixes: 4885e337f929 ("rbac: Only allow relevant chassis to update BFD.") Signed-off-by: Ales Musil --- northd/northd.c| 5 ++-- utilities/automake.mk | 1 + utilities/containers/fedora/Dockerfile | 18 utilities/containers/openbfdd.patch| 39 ++ utilities/containers/ubuntu/Dockerfile | 18 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 utilities/containers/openbfdd.patch diff --git a/northd/northd.c b/northd/northd.c index 4b39137e7..1839b7d8b 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -9804,8 +9804,9 @@ build_bfd_table(struct ovsdb_idl_txn *ovnsb_txn, } build_bfd_update_sb_conf(nb_bt, bfd_e->sb_bt); if (op && op->sb && op->sb->chassis && -strcmp(op->sb->chassis->name, sb_bt->chassis_name)) { -sbrec_bfd_set_chassis_name(sb_bt, op->sb->chassis->name); +strcmp(op->sb->chassis->name, bfd_e->sb_bt->chassis_name)) { +sbrec_bfd_set_chassis_name(bfd_e->sb_bt, + op->sb->chassis->name); } hmap_remove(_only, _e->hmap_node); diff --git a/utilities/automake.mk b/utilities/automake.mk index c44563c26..ebb74ec34 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -38,6 +38,7 @@ EXTRA_DIST += \ utilities/ovndb-servers.ocf \ utilities/checkpatch.py \ utilities/containers/Makefile \ +utilities/containers/openbfdd.patch \ utilities/containers/py-requirements.txt \ utilities/containers/fedora/Dockerfile \ utilities/containers/ubuntu/Dockerfile \ diff --git a/utilities/containers/fedora/Dockerfile b/utilities/containers/fedora/Dockerfile index 4058d7f5b..bf3c293fc 100755 --- a/utilities/containers/fedora/Dockerfile +++ b/utilities/containers/fedora/Dockerfile @@ -52,6 +52,24 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ && \ make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install +# Compile OpenBFDD from source +WORKDIR /workspace/OpenBFDD + +COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch + +RUN git clone https://github.com/dyninc/OpenBFDD.git \ +/workspace/OpenBFDD \ +&& \ +git apply /tmp/openbfdd.patch \ +&& \ +./autogen.sh \ +&& \ +./configure --enable-silent-rules \ +&& \ +make \ +&& \ +make install + WORKDIR /workspace COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt diff --git a/utilities/containers/openbfdd.patch b/utilities/containers/openbfdd.patch new file mode 100644 index 0..96e8095d9 --- /dev/null +++ b/utilities/containers/openbfdd.patch @@ -0,0 +1,39 @@ +diff --git a/Logger.cpp b/Logger.cpp +index f375b20..e72afba 100755 +--- a/Logger.cpp b/Logger.cpp +@@ -11,6 +11,8 @@ + #include + #include + #include ++#include ++#include + + const size_t Logger::MaxMessageLen; + +diff --git a/SchedulerBase.cpp b/SchedulerBase.cpp +index 3eab298..c1dffc4 100755 +--- a/SchedulerBase.cpp b/SchedulerBase.cpp +@@ -11,6 +11,8 @@ + #include + #include + #include ++#include ++#include + + using namespace std; + +diff --git a/utils.cpp b/utils.cpp +index 79c7b68..f846459 100755 +--- a/utils.cpp b/utils.cpp +@@ -13,6 +13,8 @@ + #include + #include + #include ++#include ++#include + + using namespace std; + diff --git a/utilities/containers/ubuntu/Dockerfile b/utilities/containers/ubuntu/Dockerfile index 5d5bedbd9..1371b3f70 100755 --- a/utilities/containers/ubuntu/Dockerfile +++ b/utilities/containers/ubuntu/Dockerfile @@ -51,6 +51,24 @@ RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ && \ make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install +# Compile OpenBFDD from source +WORKDIR /workspace/OpenBFDD + +COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch + +RUN git clone https://github.com/dyninc/OpenBFDD.git \ +/workspace/OpenBFDD \ +&& \ +git apply /tmp/openbfdd.patch \ +&& \ +./autogen.sh \ +&& \ +./configure --enable-silent-rules \ +&& \ +make \ +&& \ +make install + WORKDIR /workspace COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt -- 2.44.0 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev