Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2a04600
feat(platform): add no-heap static allocation PAL backend for lockste…
vtz Jun 11, 2026
a33acfd
refactor(platform): remove #ifdef SOMEIP_STATIC_ALLOC from message.h/cpp
vtz Jun 12, 2026
71c63b0
fix(platform): address merge-readiness review findings
vtz Jun 12, 2026
95e99cd
fix(platform): resolve clang-tidy warnings from intrusive ptr changes
vtz Jun 12, 2026
34ffd73
fix(platform): add message_ptr_impl.h to all PAL backend directories
vtz Jun 12, 2026
2a32a98
feat(platform): add follow-up safety hardening for static-alloc backend
vtz Jun 12, 2026
e354267
feat(platform): add container conformance tests and fix doc traceability
vtz Jun 12, 2026
69bbeda
docs: align FMEA and architecture with implementation
vtz Jun 13, 2026
ce164e3
fix(platform): add CI coverage, fix traceability, guard double-release
vtz Jun 13, 2026
1dc6696
fix(platform): mark malloc_trap operator new as noexcept
vtz Jun 13, 2026
4539753
fix(platform): make malloc_trap armable for test compatibility
vtz Jun 13, 2026
9794ef0
fix(platform): add missing <new> include for std::bad_alloc
vtz Jun 13, 2026
75f24dc
feat(platform): migrate core protocol types to PAL abstractions
vtz Jun 19, 2026
1d4bf1c
fix: resolve CI failures across static-alloc, clang-tidy, and Zephyr
vtz Jun 19, 2026
4dd19e6
fix: use pointer+size deserialize overload in UDP transport
vtz Jun 19, 2026
f9e07fe
fix: resolve remaining clang-tidy and static-alloc build issues
vtz Jun 19, 2026
64bb20c
fix: add erase() and iterator-pair ctor to static ByteBuffer
vtz Jun 19, 2026
db0c4a6
fix: cast char iterators to uint8_t for ByteBuffer insert
vtz Jun 19, 2026
1ceeb51
fix: cast uint8_t* to char* for config string deserialization
vtz Jun 19, 2026
c32ab56
fix: resolve ETL string compatibility in SD subsystem
vtz Jun 19, 2026
3994a98
fix: migrate event_subscriber maps and string concat for ETL
vtz Jun 19, 2026
e0a6947
fix: suppress redundant-string-cstr for ETL dual-backend compat
vtz Jun 19, 2026
2e3d7f0
fix: migrate test_serialization.cpp to platform types
vtz Jun 19, 2026
7dc9b15
fix: use c_str()-only ctor for String in serialize_array
vtz Jun 19, 2026
3820c2c
fix: migrate all test files to platform:: types for ETL compat
vtz Jun 19, 2026
842b6a6
ci: disable examples in static-alloc CI job
vtz Jun 19, 2026
2f6a67e
fix: static-alloc test failures — capacity and pool exhaustion
vtz Jun 19, 2026
0cfbe26
fix: prevent segfault on pool exhaustion in UDP receive loop
vtz Jun 19, 2026
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
65 changes: 64 additions & 1 deletion .github/workflows/host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,69 @@ jobs:
path: ${{ github.workspace }}/gtest_results/
retention-days: 14

build-static:
name: Static allocation (no-heap)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify unpinned uses in this workflow.
# Expected: lines for new build-static steps appear in output.
rg -nP '^\s*-\s*uses:\s*[^@]+@(?![0-9a-fA-F]{40}\b)' .github/workflows/host.yml

Repository: vtz/opensomeip

Length of output: 247


🏁 Script executed:

cat -n .github/workflows/host.yml | sed -n '170,240p'

Repository: vtz/opensomeip

Length of output: 2762


Pin newly added GitHub Actions to immutable SHAs.

The new build-static job (lines 174–236) introduces five unpinned uses: references using floating version tags (@v4), which weakens workflow supply-chain integrity. Replace each with a pinned commit SHA.

Affected lines: 179, 185, 193, 223, 231

🧰 Tools
🪛 zizmor (1.25.2)

[warning] 179-179: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 179-179: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/host.yml at line 179, The build-static job contains five
GitHub Actions references using floating version tags (`@v4`) instead of pinned
commit SHAs, which weakens supply-chain security. Replace each floating version
tag with its corresponding immutable commit SHA for the actions/checkout
reference at line 179 and the four other unpinned uses references at lines 185,
193, 223, and 231. Look up the latest commit SHA for each action version and
update the uses field from the format `@vX` to `@COMMIT_SHA` for all five affected
lines to ensure workflow integrity.

Source: Linters/SAST tools


- name: Install ccache
run: sudo apt-get update -qq && sudo apt-get install -y ccache

- name: Cache ccache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ runner.os }}-static-alloc-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-static-alloc-

- name: Cache CMake FetchContent
uses: actions/cache@v4
with:
path: build/_deps
key: fetchcontent-${{ runner.os }}-static-alloc-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
fetchcontent-${{ runner.os }}-static-alloc-

- name: Configure CMake (static allocation)
run: >
cmake -B build
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_C_COMPILER=gcc
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=Release
-DSOMEIP_USE_STATIC_ALLOC=ON
-DENABLE_WERROR=ON

- name: Build
run: cmake --build build --config Release

- name: Test
working-directory: build
run: |
mkdir -p "$GITHUB_WORKSPACE/gtest_results"
export GTEST_OUTPUT="xml:$GITHUB_WORKSPACE/gtest_results/"
ctest --build-config Release --output-on-failure --timeout 30 --no-tests=error --output-junit junit_results.xml

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-host-static-alloc
path: build/junit_results.xml
retention-days: 14

- name: Upload GTest detailed results
uses: actions/upload-artifact@v4
if: always()
with:
name: gtest-results-host-static-alloc
path: ${{ github.workspace }}/gtest_results/
retention-days: 14

coverage:
runs-on: ubuntu-latest
needs: build
Expand Down Expand Up @@ -360,7 +423,7 @@ jobs:
publish-test-results:
name: Publish Test Results
runs-on: ubuntu-latest
needs: [build, build-fedora, coverage, sanitizers]
needs: [build, build-fedora, build-static, coverage, sanitizers]
if: always()
permissions:
checks: write
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/preset-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
preset:
- host-linux
- host-linux-tests
- static-alloc-linux-tests
- freertos-compile-check
- threadx-compile-check
steps:
Expand Down
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ option(ENABLE_WERROR "Treat compiler warnings as errors (recommended for CI)" OF
option(SOMEIP_USE_FREERTOS "Use FreeRTOS for threading primitives" OFF)
option(SOMEIP_USE_THREADX "Use ThreadX for threading primitives" OFF)
option(SOMEIP_USE_LWIP "Use lwIP for network sockets" OFF)
option(SOMEIP_USE_STATIC_ALLOC "Use static allocation (no heap)" OFF)

# RTOS linux/POSIX port runtime tests (Linux only)
option(SOMEIP_FREERTOS_LINUX_TESTS "Build and run FreeRTOS runtime tests using FreeRTOS POSIX port" OFF)
Expand Down Expand Up @@ -196,6 +197,19 @@ if(SOMEIP_USE_LWIP)
)
endif()

# --- ETL (Embedded Template Library) for static-allocation containers ---
if(SOMEIP_USE_STATIC_ALLOC)
set(BUILD_TESTS_SAVED ${BUILD_TESTS})
set(BUILD_TESTS OFF)
FetchContent_Declare(etl
GIT_REPOSITORY https://github.com/ETLCPP/etl.git
GIT_TAG 20.47.1
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(etl)
set(BUILD_TESTS ${BUILD_TESTS_SAVED})
endif()

# Set policy for FetchContent timestamp handling (CMake 3.24+)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
Expand Down Expand Up @@ -251,6 +265,15 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Include directories
include_directories(include)

# Allocation backend (selects containers_impl.h, buffer_pool_impl.h, memory_impl.h)
# SOMEIP_STATIC_ALLOC is set via target_compile_definitions on opensomeip (PUBLIC),
# so it propagates to dependents but NOT to PAL mock tests that compile sources directly.
if(SOMEIP_USE_STATIC_ALLOC)
include_directories(include/platform/static)
else()
include_directories(include/platform/dynamic)
endif()

# Platform backend include directories (selects which *_impl.h files are found)
if(SOMEIP_USE_FREERTOS)
include_directories(include/platform/freertos)
Expand Down Expand Up @@ -611,6 +634,11 @@ elseif(WIN32)
else()
message(STATUS " Networking ............ BSD sockets")
endif()
if(SOMEIP_USE_STATIC_ALLOC)
message(STATUS " Allocation ............ Static (ETL, no heap)")
else()
message(STATUS " Allocation ............ Dynamic (STL)")
endif()
message(STATUS " Build tests ............. ${BUILD_TESTS}")
message(STATUS " Build examples .......... ${BUILD_EXAMPLES}")
message(STATUS " Dev tools ............... ${SOMEIP_DEV_TOOLS}")
Expand Down
26 changes: 26 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@
"SOMEIP_THREADX_RENODE_TESTS": "ON",
"ARM_FLOAT_ABI": "soft"
}
},
{
"name": "static-alloc-linux-tests",
"displayName": "Static Allocation (No-Heap) with Tests",
"description": "Host build with static allocation backend and unit tests. Exercises slab pools, ETL containers, malloc trap, and PAL conformance for no-heap lockstep mode.",
"inherits": "base",
"cacheVariables": {
"SOMEIP_USE_STATIC_ALLOC": "ON",
"BUILD_TESTS": "ON",
"BUILD_EXAMPLES": "OFF"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -232,6 +243,10 @@
{
"name": "threadx-cortexm4-renode",
"configurePreset": "threadx-cortexm4-renode"
},
{
"name": "static-alloc-linux-tests",
"configurePreset": "static-alloc-linux-tests"
}
],
"testPresets": [
Expand Down Expand Up @@ -289,6 +304,17 @@
"timeout": 30,
"noTestsAction": "error"
}
},
{
"name": "static-alloc-linux-tests",
"configurePreset": "static-alloc-linux-tests",
"output": {
"outputOnFailure": true
},
"execution": {
"timeout": 30,
"noTestsAction": "error"
}
}
]
}
21 changes: 21 additions & 0 deletions docs/requirements/implementation/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,27 @@ Testing Infrastructure

**Code Location**: ``tests/``

Static Allocation
-----------------

.. requirement:: Static Allocation Policy
:id: REQ_ARCH_008
:satisfies: REQ_ARCH_003
:status: implemented
:priority: high
:category: happy_path
:verification: Build with ``SOMEIP_USE_STATIC_ALLOC=ON`` and run unit tests with heap-interception enabled (``REQ_PAL_NOOP_HEAP_VERIFY``). Verify no ``malloc``, ``free``, ``new``, or ``delete`` calls occur during protocol operation. Inspect container and pool types for compile-time capacity bounds.

When ``SOMEIP_USE_STATIC_ALLOC`` is enabled, the stack shall not perform
dynamic memory allocation (heap) at runtime. All buffers, containers, and
object pools shall use compile-time-sized static storage.

**Rationale**: Freedom from interference per ISO 26262 Part 6 clause 7.4.6;
WCET determinism per clause 7.4.11.

**Code Location**: ``CMakeLists.txt``, ``include/platform/static/``,
``src/platform/static/``

Traceability
============

Expand Down
Loading
Loading