Skip to content

[24364 & 24365] Add UBSan workflow and solve its errors#6386

Merged
MiguelCompany merged 27 commits into
masterfrom
add_ubsan
Jun 3, 2026
Merged

[24364 & 24365] Add UBSan workflow and solve its errors#6386
MiguelCompany merged 27 commits into
masterfrom
add_ubsan

Conversation

@cferreiragonz
Copy link
Copy Markdown
Contributor

@cferreiragonz cferreiragonz commented Apr 30, 2026

Description

This PR adds a new workflow to Fast DDS: UBSan.

  • It adds a new valid value for -DSANITIZER=Undefined, which sets -fsanitize=undefined -fno-omit-frame-pointer -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero -fsanitize=bounds-strict
  • It fixes build of Tests with the new UBSan flags and solves one ODR warning
  • It adds a new regression test which must fail as it guarantees an UB error.
  • It fixes every UB error of the whole Fast DDS Suite. Most of the errors where test-related, although some minor fixes also applied to the library itself.

@Mergifyio backport 3.2.x 2.14.x

Related PRs

Merge after

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A: Any new/modified methods have been properly documented using Doxygen.
  • N/A: Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • Changes are API compatible.
  • N/A: New feature has been added to the versions.md file (if applicable).
  • N/A: New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@cferreiragonz cferreiragonz added this to the v3.6.2 milestone Apr 30, 2026
@cferreiragonz cferreiragonz requested review from richiprosima and removed request for richiprosima April 30, 2026 13:43
@github-actions github-actions Bot added the ci-pending PR which CI is running label Apr 30, 2026
@cferreiragonz
Copy link
Copy Markdown
Contributor Author

cferreiragonz commented Apr 30, 2026

I am expecting the ubsan_fastdds_test step to fail due to failing tests. They will be solved in the following commits once it has been verified that the workflow properly fails when it should

@cferreiragonz cferreiragonz changed the title Add ubsan [24364 & 24365] Add UBSan workflow and solve its errors Apr 30, 2026
Comment thread .github/workflows/config/ubsan.meta Outdated
@cferreiragonz cferreiragonz requested a review from richiprosima May 4, 2026 08:22
@cferreiragonz cferreiragonz changed the base branch from master to bugfix/security-tests May 12, 2026 12:29
@cferreiragonz cferreiragonz requested review from richiprosima and removed request for richiprosima May 12, 2026 12:33
Base automatically changed from bugfix/security-tests to master May 14, 2026 07:28
@cferreiragonz cferreiragonz requested a review from richiware May 14, 2026 07:34
@cferreiragonz cferreiragonz requested review from richiprosima and removed request for richiprosima May 18, 2026 09:00
@cferreiragonz cferreiragonz requested review from richiprosima and removed request for richiprosima May 18, 2026 09:02
@cferreiragonz cferreiragonz requested review from richiprosima and removed request for richiprosima May 18, 2026 14:54
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
@cferreiragonz
Copy link
Copy Markdown
Contributor Author

I have rebased and removed ABI-breaking commits. Ready to review

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
@cferreiragonz cferreiragonz requested review from richiprosima and removed request for richiprosima June 1, 2026 12:39
@Danipiza Danipiza self-requested a review June 3, 2026 06:43
Copy link
Copy Markdown
Contributor

@Danipiza Danipiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread .github/workflows/reusable-sanitizers-ci.yml
@MiguelCompany MiguelCompany merged commit 25a43a7 into master Jun 3, 2026
47 of 53 checks passed
@MiguelCompany MiguelCompany deleted the add_ubsan branch June 3, 2026 13:17
@MiguelCompany
Copy link
Copy Markdown
Member

@Mergifyio backport 3.2.x 2.14.x 2.6.x

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Jun 3, 2026

backport 3.2.x 2.14.x 2.6.x

✅ Backports have been created

Details

Cherry-pick of 25a43a7 has failed:

On branch mergify/bp/3.2.x/pr-6386
Your branch is up to date with 'origin/3.2.x'.

You are currently cherry-picking commit 25a43a7c3.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   .github/workflows/config/ubsan.meta
	modified:   .github/workflows/reusable-sanitizers-ci.yml
	modified:   .github/workflows/sanitizers-ci.yml
	modified:   .github/workflows/utils/log_parser.py
	modified:   CMakeLists.txt
	modified:   include/fastdds/statistics/dds/domain/DomainParticipant.hpp
	modified:   src/cpp/fastdds/domain/DomainParticipantFactory.cpp
	modified:   src/cpp/fastdds/publisher/DataWriterImpl.cpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.cpp
	modified:   src/cpp/rtps/common/SerializedPayload.cpp
	modified:   src/cpp/rtps/history/PoolConfig.h
	modified:   src/cpp/rtps/messages/CDRMessage.cpp
	modified:   src/cpp/rtps/resources/TimedEvent.cpp
	modified:   src/cpp/rtps/resources/TimedEvent.h
	modified:   src/cpp/rtps/security/SecurityManager.cpp
	modified:   src/cpp/rtps/security/logging/LogOptions.h
	modified:   src/cpp/statistics/fastdds/domain/DomainParticipant.cpp
	modified:   test/blackbox/common/BlackboxTestsDeadlineQos.cpp
	modified:   test/blackbox/common/BlackboxTestsDiscovery.cpp
	modified:   test/blackbox/common/BlackboxTestsLifespanQoS.cpp
	modified:   test/blackbox/common/BlackboxTestsLivelinessQos.cpp
	modified:   test/blackbox/common/BlackboxTestsNetworkConf.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubBasic.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubFragments.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubHistory.cpp
	modified:   test/blackbox/common/BlackboxTestsRealtimeAllocations.cpp
	modified:   test/blackbox/common/BlackboxTestsSecurity.cpp
	modified:   test/blackbox/common/BlackboxTestsTransportTCP.cpp
	modified:   test/blackbox/common/BlackboxTestsTransportUDP.cpp
	modified:   test/blackbox/common/BlackboxTestsVolatile.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsDataReader.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsDataWriter.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsListeners.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsMonitorService.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPersistence.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPersistenceGuid.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPropertyQos.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsTransportSHMUDP.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsUserDataQos.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsBasic.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPersistence.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPersistenceGuid.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPools.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsReader.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsVolatile.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsWriter.cpp
	new file:   test/mock/rtps/SharedSecretHandle/rtps/security/common/SharedSecretHandle.h
	modified:   test/mock/rtps/TimedEvent/rtps/resources/TimedEvent.h
	modified:   test/performance/latency/LatencyTestPublisher.cpp
	modified:   test/unittest/dds/participant/ParticipantTests.cpp
	modified:   test/unittest/dds/publisher/DataWriterTests.cpp
	modified:   test/unittest/dds/status/ListenerTests.cpp
	modified:   test/unittest/rtps/writer/CMakeLists.txt
	modified:   test/unittest/security/authentication/CMakeLists.txt
	modified:   test/unittest/security/cryptography/CMakeLists.txt
	modified:   test/unittest/statistics/dds/StatisticsDomainParticipantMockTests.cpp
	modified:   test/unittest/statistics/dds/StatisticsDomainParticipantStatusQueryableTests.cpp
	modified:   test/unittest/statistics/dds/StatisticsQosTests.cpp
	modified:   test/unittest/statistics/rtps/RTPSStatisticsTests.cpp
	modified:   test/unittest/statistics/rtps/mock/StatisticsBase/statistics/rtps/monitor-service/MonitorService.hpp
	modified:   test/unittest/transport/CMakeLists.txt
	modified:   test/unittest/transport/TCPv4Tests.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   test/mock/dds/DataWriterHistory/fastdds/publisher/DataWriterHistory.hpp
	both modified:   test/unittest/rtps/discovery/CMakeLists.txt
	both modified:   test/unittest/statistics/rtps/CMakeLists.txt

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Cherry-pick of 25a43a7 has failed:

On branch mergify/bp/2.14.x/pr-6386
Your branch is up to date with 'origin/2.14.x'.

You are currently cherry-picking commit 25a43a7c3.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   .github/workflows/config/ubsan.meta
	modified:   .github/workflows/reusable-sanitizers-ci.yml
	modified:   .github/workflows/sanitizers-ci.yml
	modified:   .github/workflows/utils/log_parser.py
	modified:   CMakeLists.txt
	modified:   include/fastdds/rtps/messages/CDRMessage.hpp
	modified:   include/fastdds/rtps/resources/TimedEvent.h
	modified:   include/fastdds/rtps/security/logging/LogOptions.h
	modified:   src/cpp/fastdds/publisher/DataWriterImpl.cpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.cpp
	modified:   src/cpp/rtps/resources/TimedEvent.cpp
	modified:   src/cpp/rtps/security/SecurityManager.cpp
	modified:   test/blackbox/common/BlackboxTestsDeadlineQos.cpp
	modified:   test/blackbox/common/BlackboxTestsDiscovery.cpp
	modified:   test/blackbox/common/BlackboxTestsLifespanQoS.cpp
	modified:   test/blackbox/common/BlackboxTestsLivelinessQos.cpp
	modified:   test/blackbox/common/BlackboxTestsNetworkConf.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubBasic.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubFragments.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubHistory.cpp
	modified:   test/blackbox/common/BlackboxTestsRealtimeAllocations.cpp
	modified:   test/blackbox/common/BlackboxTestsSecurity.cpp
	modified:   test/blackbox/common/BlackboxTestsTransportTCP.cpp
	modified:   test/blackbox/common/BlackboxTestsTransportUDP.cpp
	modified:   test/blackbox/common/BlackboxTestsVolatile.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsListeners.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsMonitorService.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPersistence.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPersistenceGuid.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPropertyQos.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsTransportSHMUDP.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsUserDataQos.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsBasic.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPersistence.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPersistenceGuid.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPools.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsVolatile.cpp
	new file:   test/mock/rtps/SharedSecretHandle/rtps/security/common/SharedSecretHandle.h
	modified:   test/performance/latency/LatencyTestPublisher.cpp
	modified:   test/unittest/rtps/writer/CMakeLists.txt
	modified:   test/unittest/security/cryptography/CMakeLists.txt
	modified:   test/unittest/statistics/dds/StatisticsDomainParticipantMockTests.cpp
	modified:   test/unittest/transport/CMakeLists.txt

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   include/fastdds/statistics/dds/domain/DomainParticipant.hpp
	both modified:   src/cpp/fastdds/domain/DomainParticipantFactory.cpp
	deleted by us:   src/cpp/rtps/common/SerializedPayload.cpp
	both modified:   src/cpp/rtps/history/PoolConfig.h
	both modified:   src/cpp/statistics/fastdds/domain/DomainParticipant.cpp
	both modified:   test/blackbox/common/DDSBlackboxTestsDataReader.cpp
	both modified:   test/blackbox/common/DDSBlackboxTestsDataWriter.cpp
	deleted by us:   test/blackbox/common/RTPSBlackboxTestsReader.cpp
	deleted by us:   test/blackbox/common/RTPSBlackboxTestsWriter.cpp
	both modified:   test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp
	both modified:   test/mock/rtps/TimedEvent/fastdds/rtps/resources/TimedEvent.h
	both modified:   test/unittest/dds/participant/ParticipantTests.cpp
	both modified:   test/unittest/dds/publisher/DataWriterTests.cpp
	both modified:   test/unittest/dds/status/ListenerTests.cpp
	both modified:   test/unittest/rtps/discovery/CMakeLists.txt
	both modified:   test/unittest/security/authentication/CMakeLists.txt
	both modified:   test/unittest/statistics/dds/StatisticsDomainParticipantStatusQueryableTests.cpp
	both modified:   test/unittest/statistics/dds/StatisticsQosTests.cpp
	both modified:   test/unittest/statistics/rtps/CMakeLists.txt
	both modified:   test/unittest/statistics/rtps/RTPSStatisticsTests.cpp
	both modified:   test/unittest/statistics/rtps/mock/StatisticsBase/statistics/rtps/monitor-service/MonitorService.hpp
	both modified:   test/unittest/transport/TCPv4Tests.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Cherry-pick of 25a43a7 has failed:

On branch mergify/bp/2.6.x/pr-6386
Your branch is up to date with 'origin/2.6.x'.

You are currently cherry-picking commit 25a43a7c3.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   .github/workflows/config/ubsan.meta
	modified:   .github/workflows/reusable-sanitizers-ci.yml
	modified:   .github/workflows/sanitizers-ci.yml
	modified:   .github/workflows/utils/log_parser.py
	modified:   include/fastdds/rtps/messages/CDRMessage.hpp
	modified:   include/fastdds/rtps/resources/TimedEvent.h
	modified:   include/fastdds/rtps/security/logging/LogOptions.h
	modified:   src/cpp/rtps/resources/TimedEvent.cpp
	modified:   src/cpp/rtps/security/SecurityManager.cpp
	modified:   test/blackbox/common/BlackboxTestsDeadlineQos.cpp
	modified:   test/blackbox/common/BlackboxTestsDiscovery.cpp
	modified:   test/blackbox/common/BlackboxTestsLifespanQoS.cpp
	modified:   test/blackbox/common/BlackboxTestsLivelinessQos.cpp
	modified:   test/blackbox/common/BlackboxTestsNetworkConf.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubBasic.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubFragments.cpp
	modified:   test/blackbox/common/BlackboxTestsPubSubHistory.cpp
	modified:   test/blackbox/common/BlackboxTestsRealtimeAllocations.cpp
	modified:   test/blackbox/common/BlackboxTestsTransportTCP.cpp
	modified:   test/blackbox/common/BlackboxTestsTransportUDP.cpp
	modified:   test/blackbox/common/BlackboxTestsVolatile.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsListeners.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPersistence.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsPersistenceGuid.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsTransportSHMUDP.cpp
	modified:   test/blackbox/common/DDSBlackboxTestsUserDataQos.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsBasic.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPersistence.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPersistenceGuid.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsPools.cpp
	modified:   test/blackbox/common/RTPSBlackboxTestsVolatile.cpp
	new file:   test/mock/rtps/SharedSecretHandle/rtps/security/common/SharedSecretHandle.h
	modified:   test/performance/latency/LatencyTestPublisher.cpp
	modified:   test/unittest/rtps/writer/CMakeLists.txt
	modified:   test/unittest/security/cryptography/CMakeLists.txt
	modified:   test/unittest/statistics/dds/StatisticsDomainParticipantMockTests.cpp
	modified:   test/unittest/transport/CMakeLists.txt

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   CMakeLists.txt
	both modified:   include/fastdds/statistics/dds/domain/DomainParticipant.hpp
	both modified:   src/cpp/fastdds/domain/DomainParticipantFactory.cpp
	both modified:   src/cpp/fastdds/publisher/DataWriterImpl.cpp
	both modified:   src/cpp/fastdds/subscriber/DataReaderImpl.cpp
	deleted by us:   src/cpp/rtps/common/SerializedPayload.cpp
	both modified:   src/cpp/rtps/history/PoolConfig.h
	both modified:   src/cpp/statistics/fastdds/domain/DomainParticipant.cpp
	both modified:   test/blackbox/common/BlackboxTestsSecurity.cpp
	both modified:   test/blackbox/common/DDSBlackboxTestsDataReader.cpp
	both modified:   test/blackbox/common/DDSBlackboxTestsDataWriter.cpp
	deleted by us:   test/blackbox/common/DDSBlackboxTestsMonitorService.cpp
	deleted by us:   test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp
	deleted by us:   test/blackbox/common/DDSBlackboxTestsPropertyQos.cpp
	deleted by us:   test/blackbox/common/RTPSBlackboxTestsReader.cpp
	deleted by us:   test/blackbox/common/RTPSBlackboxTestsWriter.cpp
	both modified:   test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp
	both modified:   test/mock/rtps/TimedEvent/fastdds/rtps/resources/TimedEvent.h
	both modified:   test/unittest/dds/participant/ParticipantTests.cpp
	both modified:   test/unittest/dds/publisher/DataWriterTests.cpp
	both modified:   test/unittest/dds/status/ListenerTests.cpp
	both modified:   test/unittest/rtps/discovery/CMakeLists.txt
	both modified:   test/unittest/security/authentication/CMakeLists.txt
	deleted by us:   test/unittest/statistics/dds/StatisticsDomainParticipantStatusQueryableTests.cpp
	both modified:   test/unittest/statistics/dds/StatisticsQosTests.cpp
	both modified:   test/unittest/statistics/rtps/CMakeLists.txt
	both modified:   test/unittest/statistics/rtps/RTPSStatisticsTests.cpp
	deleted by us:   test/unittest/statistics/rtps/mock/StatisticsBase/statistics/rtps/monitor-service/MonitorService.hpp
	both modified:   test/unittest/transport/TCPv4Tests.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-pending PR which CI is running

Projects

None yet

4 participants