Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test_security/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ if(BUILD_TESTING)
set(TEST_PUBLISHER_EXECUTABLE "$<TARGET_FILE:test_secure_publisher_cpp>")
set(TEST_SUBSCRIBER_EXECUTABLE "$<TARGET_FILE:test_secure_subscriber_cpp>")

# On Windows, FastDDS SHM transport causes an Access Violation (exit code 0xC0000005)
# when sending large secured messages (e.g. UnboundedSequences). Inject a FastDDS XML
# profile that forces UDPv4 transport to prevent the crash. Empty on non-Windows
# platforms so no behaviour change occurs there. (Issue #561)
set(FASTDDS_PROFILES_FILE "")
if(WIN32)
file(TO_NATIVE_PATH

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does this generate the backslashes? and eventually FASTRTPS_DEFAULT_PROFILES_FILE points at a garbage path and FastDDS silently keeps using SHM?

"${CMAKE_CURRENT_SOURCE_DIR}/test/test_security_files/fastdds_no_shm.xml"
FASTDDS_PROFILES_FILE)
endif()

# Test suite for communication without security
set(non_secure_comm_PUBLISHER_ROS_SECURITY_ENABLE_LIST "false;false;false;true;false")
set(non_secure_comm_SUBSCRIBER_ROS_SECURITY_ENABLE_LIST "false;false;false;false;true")
Expand Down
12 changes: 12 additions & 0 deletions test_security/test/test_secure_publisher_subscriber.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def generate_test_description():
publisher_env['ROS_SECURITY_KEYSTORE'] = '@PUBLISHER_ROS_SECURITY_KEYSTORE@'
if '@PUBLISHER_RMW@' == 'rmw_connextdds':
publisher_env['RTI_MONITORING2_ENABLE'] = 'false'
# On Windows, FastDDS SHM transport causes an Access Violation (0xC0000005) when
# sending large messages (e.g. UnboundedSequences) with security enabled.
# Force UDPv4 transport via a FastDDS XML profile to prevent the crash. (Issue #561)
if '@PUBLISHER_RMW@' in ('rmw_fastrtps_cpp', 'rmw_fastrtps_dynamic_cpp'):
if '@FASTDDS_PROFILES_FILE@':
publisher_env['FASTRTPS_DEFAULT_PROFILES_FILE'] = '@FASTDDS_PROFILES_FILE@'
publisher_env['RMW_FASTRTPS_USE_QOS_FROM_XML'] = '1'

launch_description.add_action(ExecuteProcess(
cmd=publisher_cmd,
Expand All @@ -61,6 +68,11 @@ def generate_test_description():
subscriber_env['ROS_SECURITY_KEYSTORE'] = '@SUBSCRIBER_ROS_SECURITY_KEYSTORE@'
if '@SUBSCRIBER_RMW@' == 'rmw_connextdds':
subscriber_env['RTI_MONITORING2_ENABLE'] = 'false'
# See publisher comment above. (Issue #561)
if '@SUBSCRIBER_RMW@' in ('rmw_fastrtps_cpp', 'rmw_fastrtps_dynamic_cpp'):
if '@FASTDDS_PROFILES_FILE@':
subscriber_env['FASTRTPS_DEFAULT_PROFILES_FILE'] = '@FASTDDS_PROFILES_FILE@'
subscriber_env['RMW_FASTRTPS_USE_QOS_FROM_XML'] = '1'

subscriber_process = ExecuteProcess(
cmd=subscriber_cmd,
Expand Down
33 changes: 33 additions & 0 deletions test_security/test/test_security_files/fastdds_no_shm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we even need this configuration xml file at all? FASTDDS_BUILTIN_TRANSPORTS=UDPv4 does the same work instead? if it does, it can be much simpler though.

<!--
FastDDS transport profile used by test_secure_publisher_subscriber tests on Windows.

On Windows, FastDDS uses Shared Memory (SHM) transport by default for intra-host
communication. When DDS-Security is enabled, the security overhead can cause the SHM
segment to overflow when sending large messages (e.g. UnboundedSequences), resulting
in an Access Violation crash (exit code 0xC0000005) in the publisher process.

This profile disables SHM and falls back to UDPv4 with enlarged send/receive buffers
to accommodate the security-layer overhead on large messages.

See: https://github.com/ros2/system_tests/issues/561
-->
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
<transport_descriptors>
<transport_descriptor>
<transport_id>udpv4_security</transport_id>
<type>UDPv4</type>
<sendBufferSize>1048576</sendBufferSize>
<receiveBufferSize>1048576</receiveBufferSize>
</transport_descriptor>
</transport_descriptors>

<participant profile_name="default_participant_profile" is_default_profile="true">
<rtps>
<userTransports>
<transport_id>udpv4_security</transport_id>
</userTransports>
<useBuiltinTransports>false</useBuiltinTransports>
</rtps>
</participant>
</profiles>