Skip to content

Commit

Permalink
iox-eclipse-iceoryx#2301 Temporalily deactivate alignment check
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jun 7, 2024
1 parent b036175 commit a5391d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions iceoryx_hoofs/memory/source/relative_pointer_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ namespace iox
// time, the supervisor reads corrupt data.
static_assert(sizeof(RelativePointerData) <= RelativePointerData::MAX_ALLOWED_SIZE_OF_RELATIVE_POINTER_DATA,
"The RelativePointerData size must not exceed 64 bit!");
/// @todo iox-#3201 temporarily disabled check
#if false
// This ensures that the address of the RelativePointerData object is appropriately aligned to be accessed within one
// CPU cycle, i.e. if the size is 8 and the alignment is 4 it could be placed at an address with modulo 4 which would
// also result in torn writes.
static_assert((sizeof(RelativePointerData)) == (alignof(RelativePointerData)),
"A RelativePointerData must be placed on an address which does not cross the native alignment!");
#endif
// This is important for the use in the SOFI where under some conditions the copy operation could work on partially
// obsolet data and therefore non-trivial copy ctor/assignment operator or dtor would work on corrupted data.
static_assert(std::is_trivially_copyable<RelativePointerData>::value,
Expand Down
3 changes: 3 additions & 0 deletions iceoryx_posh/source/mepoo/shm_safe_unmanaged_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ namespace mepoo
// application crashes at the wrong time. RouDi would then read corrupt data and try to access invalid memory.
static_assert(sizeof(ShmSafeUnmanagedChunk) <= 8U,
"The ShmSafeUnmanagedChunk size must not exceed 64 bit to prevent torn writes!");
/// @todo iox-#3201 temporarily disable check
#if false
// This ensures that the address of the ShmSafeUnmanagedChunk object is appropriately aligned to be accessed within one
// CPU cycle, i.e. if the size is 8 and the alignment is 4 it could be placed at an address with modulo 4 which would
// also result in torn writes.
static_assert(sizeof(ShmSafeUnmanagedChunk) == alignof(ShmSafeUnmanagedChunk),
"A ShmSafeUnmanagedChunk must be placed on an address which does not cross the native alignment!");
#endif
// This is important for the use in the SOFI where under some conditions the copy operation could work on partially
// obsolet data and therefore non-trivial copy ctor/assignment operator or dtor would work on corrupted data.
static_assert(std::is_trivially_copyable<ShmSafeUnmanagedChunk>::value,
Expand Down

0 comments on commit a5391d7

Please sign in to comment.