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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ ScoreReq.CompReq OpenFailsIfAccessIsDenied {
version = 1
}

ScoreReq.CompReq OpenObjectOfRequestedName {
description = """When Open is called for a name that is not contained in the process-local registry, the shared memory library shall open
the shared memory object of exactly that name."""
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.FEAT_OpenSharedMemoryObject@1]
version = 1
}

ScoreReq.CompReq CreateObjectOfRequestedName {
description = """When Create is called for a name that is not contained in the process-local registry, the shared memory library shall create
the shared memory object of exactly that name."""
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.FEAT_OpenSharedMemoryObject@1]
version = 1
}

ScoreReq.CompReq OpenMapsObjectWithItsActualSize {
description = """When opening an existing shared memory object, the shared memory library shall map it with the size
reported by the operating system for that object."""
Expand All @@ -53,6 +69,14 @@ ScoreReq.CompReq OpenMapsObjectWithItsActualSize {
version = 1
}

ScoreReq.CompReq UsePosixSharedMemoryOnHostOperatingSystem {
description = """On an operating system other than QNX, the shared memory library shall create, open and remove shared memory objects
via the POSIX shared memory interface."""
safety = ScoreReq.Asil.QM
derived_from = [MemoryShared.FEAT_HostOperatingSystemSupport@1]
version = 1
}

ScoreReq.CompReq RemoveMakesNameUnavailable {
description = """When Remove is called for a shared memory object that is contained in the process-local registry, the shared memory library
shall remove it from the process-local registry and request the removal of its name, so that, once its name has been removed,
Expand All @@ -63,14 +87,6 @@ ScoreReq.CompReq RemoveMakesNameUnavailable {
version = 1
}

ScoreReq.CompReq RemoveKeepsMapping {
description = """When Remove is called for a shared memory object that is contained in the process-local registry, the shared memory library
shall not unmap the object from the calling process."""
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.FEAT_RemoveSharedMemoryObject@1]
version = 1
}

ScoreReq.CompReq RemoveIgnoresUnregisteredObject {
description = """When Remove is called for a name that is not contained in the process-local registry, the shared memory library shall not request
the removal of that name."""
Expand Down Expand Up @@ -255,6 +271,20 @@ ScoreReq.CompReq OpenReadWrite {
version = 1
}

ScoreReq.CompReq OpenReturnsResourceOnSuccess {
description = """When the requested shared memory object has been successfully opened and mapped and all requested checks have succeeded, SharedMemoryFactory::Open shall return the corresponding SharedMemoryResource."""
safety = ScoreReq.Asil.QM
derived_from = [MemoryShared.FEAT_OpenSharedMemoryObject@1]
version = 1
}

ScoreReq.CompReq CreateReturnsResourceOnSuccess {
description = """When the requested shared memory object has been successfully created, mapped and initialized, SharedMemoryFactory::Create shall return the corresponding SharedMemoryResource."""
safety = ScoreReq.Asil.QM
derived_from = [MemoryShared.FEAT_CreateSharedMemoryObject@1]
version = 1
}

ScoreReq.CompReq CreatorMapsReadWrite {
description = """When Create or CreateOrOpen opens and maps a shared memory object that is not contained in the process-local registry,
the shared memory library shall do so with read and write access."""
Expand Down Expand Up @@ -397,6 +427,21 @@ ScoreReq.CompReq TerminateIfObjectBoundsCannotBeRegistered {
version = 1
}

ScoreReq.CompReq UnregisterObjectBoundsOnDestruction {
description = "When a SharedMemoryResource is destroyed, the shared memory library shall remove the bounds of its shared memory object from the registry before unmapping the object."
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.FEAT_PointerBoundsChecking@1]
version = 1
}

ScoreReq.CompReq MemoryResourceRegistryReturnsBoundsOfRegisteredObject {
description = """For an address within the bounds of a registered shared memory object, the memory resource registry shall return the bounds of that object,
and for an address outside the bounds of all registered shared memory objects, it shall return no bounds."""
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.FEAT_PointerBoundsChecking@1]
version = 1
}

ScoreReq.CompReq TerminateIfAllocationDoesNotFit {
description = """The shared memory library shall terminate the process if a requested allocation does not fit into the remaining usable region
of the shared memory object, as long as the allocation position stored in the object has only been modified by the shared memory library."""
Expand Down Expand Up @@ -467,3 +512,11 @@ ScoreReq.CompReq UsableRegionOfRequestedSize {
derived_from = [MemoryShared.FEAT_CreateSharedMemoryObject@1]
version = 1
}

ScoreReq.CompReq AllocationsDoNotOverlap {
description = """The shared memory library shall return memory allocated from a shared memory object that comprises at least the requested
number of bytes and does not overlap with any other allocation from that object or with the library's management data in it."""
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.FEAT_AllocationWithinSharedMemoryObject@1]
version = 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ import ScoreReq
ScoreReq.FeatReq FEAT_CreateSharedMemoryObject {
description = "The shared memory library shall allow creating a named shared memory object of a requested size."
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.ASR_InterProcessDataSharing@1, MemoryShared.ASR_QnxAsilBQualifiedImplementation@1, MemoryShared.ASR_PlatformAbstraction@1]
derived_from = [MemoryShared.ASR_InterProcessDataSharing@1, MemoryShared.ASR_QnxAsilBQualifiedImplementation@1]
version = 1
}

ScoreReq.FeatReq FEAT_OpenSharedMemoryObject {
description = "The shared memory library shall allow opening an existing shared memory object by its name."
safety = ScoreReq.Asil.B
derived_from = [MemoryShared.ASR_InterProcessDataSharing@1, MemoryShared.ASR_QnxAsilBQualifiedImplementation@1, MemoryShared.ASR_PlatformAbstraction@1]
derived_from = [MemoryShared.ASR_InterProcessDataSharing@1, MemoryShared.ASR_QnxAsilBQualifiedImplementation@1]
version = 1
}

ScoreReq.FeatReq FEAT_HostOperatingSystemSupport {
description = "The shared memory library shall provide creating, opening and removing shared memory objects on Linux in addition to QNX 8.x."
safety = ScoreReq.Asil.QM
derived_from = [MemoryShared.ASR_PlatformAbstraction@1]
version = 1
}

Expand Down
41 changes: 38 additions & 3 deletions score/memory/shared/dependability/safety_analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,37 @@

load(
"@score_tooling//bazel/rules/rules_score:rules_score.bzl",
"assumptions_of_use",
"dependability_analysis",
"failure_modes",
"fault_trees",
"safety_analysis",
)

# No FailureMode records yet: wiring this empty source still activates the
# Public API coverage check, so every public_api interface element is
# reported as missing a failure-mode link.
filegroup(
name = "fta_files",
srcs = [
"FTA_CreateOpenShmObject_DoesNotHandleBoundsMechanismCorrectly.puml",
"FTA_CreateOpenShmObject_DoesNotHandleLockFileMechanismCorrectly.puml",
"FTA_CreateOrOpenShmObject_ExecutesInitializerIncorrectly.puml",
"FTA_CreateShmObject_LossOfFunction.puml",
"FTA_CreateShmObject_OverwritesExistingShmObject.puml",
"FTA_CreateShmObject_WrongPath.puml",
"FTA_CreateShmObject_WrongPermissions.puml",
"FTA_OpenShmObject_LossOfFunction.puml",
"FTA_OpenShmObject_OfNotAllowedProvider.puml",
"FTA_OpenShmObject_WrongAccessMode.puml",
"FTA_OpenShmObject_WrongPath.puml",
"FTA_RemoveShmObject_LossOfFunction.puml",
"FTA_RemoveShmObject_WrongPath.puml",
"FTA_SharedMemoryResource_AllocatesAlreadyAllocatedMemory.puml",
"FTA_SharedMemoryResource_AllocatesMemoryOutsideObject.puml",
"FTA_SharedMemoryResource_AllocatesUnalignedMemory.puml",
"FTA_SharedMemoryResource_FailsToAllocateAvailableMemory.puml",
"FTA_SharedMemoryResource_ProvidesProxyOfOtherResource.puml",
],
)

failure_modes(
name = "memory_shared_failure_modes",
srcs = ["failure_modes.trlc"],
Expand All @@ -31,14 +53,27 @@ failure_modes(

fault_trees(
name = "memory_shared_fault_trees",
srcs = [":fta_files"],
fta_package = "memory_shared_fta",
target_compatible_with = ["@platforms//os:linux"],
deps = [":memory_shared_failure_modes"],
)

assumptions_of_use(
name = "memory_shared_aous",
srcs = ["aou.trlc"],
target_compatible_with = ["@platforms//os:linux"],
)

safety_analysis(
name = "memory_shared_safety_analysis",
assessments = ["assessments.trlc"],
failure_modes = [":memory_shared_failure_modes"],
fault_trees = ":memory_shared_fault_trees",
safety_measures = [
":memory_shared_aous",
"//score/memory/shared/dependability/requirements:component_requirements",
],
visibility = ["//score/memory/shared/dependability:__pkg__"],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
' *******************************************************************************
' Copyright (c) 2026 Contributors to the Eclipse Foundation
'
' See the NOTICE file(s) distributed with this work for additional
' information regarding copyright ownership.
'
' This program and the accompanying materials are made available under the
' terms of the Apache License Version 2.0 which is available at
' https://www.apache.org/licenses/LICENSE-2.0
'
' SPDX-License-Identifier: Apache-2.0
' *******************************************************************************

' *******************************************************************************


@startuml

!include fta_metamodel.puml

$FailureMode("Memory-bounds mechanism of the shm-object not handled correctly", "MemoryShared.SharedMemoryBoundsMechanismHandledIncorrectly")

$OrGate("Gate1", "MemoryShared.SharedMemoryBoundsMechanismHandledIncorrectly")

$IntermediateEvent("Wrong bounds are registered for the shm-object", "MemoryShared.ShmObjectRegisteredBoundsIncorrect", "Gate1")
$RootCause("Memory bounds not registered at all", "ShmObjectBoundsNotRegistered", "Gate1")
$RootCause("Bounds stay registered after the shm-object is unmapped", "ShmObjectBoundsNotUnregistered", "Gate1")

$OrGate("Gate2", "MemoryShared.ShmObjectRegisteredBoundsIncorrect")
$RootCause("SharedMemoryResource provides incorrect memory bounds", "ShmObjectIncorrectBoundsProvided", "Gate2")
$RootCause("MemoryResourceRegistry fails to store or look up the bounds correctly", "MemoryResourceRegistryStoreOrLookupFails", "Gate2")
$RootCause("Platform reports an incorrect size for the opened shm-object", "ShmObjectPlatformReportsIncorrectObjectSize", "Gate2")

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
' *******************************************************************************
' Copyright (c) 2026 Contributors to the Eclipse Foundation
'
' See the NOTICE file(s) distributed with this work for additional
' information regarding copyright ownership.
'
' This program and the accompanying materials are made available under the
' terms of the Apache License Version 2.0 which is available at
' https://www.apache.org/licenses/LICENSE-2.0
'
' SPDX-License-Identifier: Apache-2.0
' *******************************************************************************

' *******************************************************************************


@startuml

!include fta_metamodel.puml

$FailureMode("LockFile mechanism not handled correctly", "MemoryShared.SharedMemoryLockFileMechanismHandledIncorrectly")

$OrGate("Gate1", "MemoryShared.SharedMemoryLockFileMechanismHandledIncorrectly")

$IntermediateEvent("Creation lock is not established for the shm-object", "MemoryShared.ShmObjectCreationLockNotEstablished", "Gate1")
$IntermediateEvent("Creation lock is removed before initialization is complete", "MemoryShared.ShmObjectCreateLockFileRemovedEarly", "Gate1")
$RootCause("Create proceeds although the creation lock is already held", "ShmObjectCreateExistingLockFileIgnored", "Gate1")
$RootCause("Open proceeds without acquiring the creation lock", "ShmObjectOpenCreationLockNotHonoured", "Gate1")

$OrGate("Gate2", "MemoryShared.ShmObjectCreationLockNotEstablished")
$RootCause("Create does not request creation of the lock file", "ShmObjectCreateNoCreateLockFile", "Gate2")
$RootCause("Create creates the lock file under a path other than the shm-object lock path", "ShmObjectCreateLockFileWrongPath", "Gate2")
$RootCause("Lock-file creation reports success although no lock file was created", "ShmObjectCreateLockFileFalselyReported", "Gate2")

$OrGate("Gate3", "MemoryShared.ShmObjectCreateLockFileRemovedEarly")
$RootCause("Create releases the lock file before initialization is complete", "ShmObjectCreateLockFileRemovedTooEarly", "Gate3")
$RootCause("Another process removes the lock file while initialization is in progress", "ShmObjectCreateLockFileRemovedBySomeoneElse", "Gate3")


@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
' *******************************************************************************
' Copyright (c) 2026 Contributors to the Eclipse Foundation
'
' See the NOTICE file(s) distributed with this work for additional
' information regarding copyright ownership.
'
' This program and the accompanying materials are made available under the
' terms of the Apache License Version 2.0 which is available at
' https://www.apache.org/licenses/LICENSE-2.0
'
' SPDX-License-Identifier: Apache-2.0
' *******************************************************************************

' *******************************************************************************


@startuml

!include fta_metamodel.puml

$FailureMode("CreateOrOpen executes the initializer incorrectly", "MemoryShared.CreateOrOpenExecutesInitializerIncorrectly")

$OrGate("Gate1", "MemoryShared.CreateOrOpenExecutesInitializerIncorrectly")

$IntermediateEvent("Initializer is executed for an already existing shm-object", "MemoryShared.CreateOrOpenInitializerExecutedForExistingObject", "Gate1")
$IntermediateEvent("Initializer is not executed for a newly created shm-object", "MemoryShared.CreateOrOpenInitializerNotExecutedForNewObject", "Gate1")

$OrGate("Gate2", "MemoryShared.CreateOrOpenInitializerExecutedForExistingObject")
$RootCause("CreateOrOpen creates the shm-object although it exists", "ShmObjectCreateOrOpenCreatesDespiteExistingObject", "Gate2")
$RootCause("Concurrent CreateOrOpen calls both create and initialize the shm-object", "ShmObjectCreateOrOpenConcurrentCreators", "Gate2")

$OrGate("Gate3", "MemoryShared.CreateOrOpenInitializerNotExecutedForNewObject")
$RootCause("User provided initializer not called", "ShmObjectCreateInitializerNotCalled", "Gate3")
$RootCause("Process crashed before calling User provided initializer", "ShmObjectCreateInitializerNotCalledDueToCrash", "Gate3")

@enduml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
' *******************************************************************************
' Copyright (c) 2026 Contributors to the Eclipse Foundation
'
' See the NOTICE file(s) distributed with this work for additional
' information regarding copyright ownership.
'
' This program and the accompanying materials are made available under the
' terms of the Apache License Version 2.0 which is available at
' https://www.apache.org/licenses/LICENSE-2.0
'
' SPDX-License-Identifier: Apache-2.0
' *******************************************************************************

' *******************************************************************************


@startuml

!include fta_metamodel.puml

$FailureMode("shm-object is not created although it can be created", "MemoryShared.CreateShmObjectLossOfFunction")

$OrGate("Gate1", "MemoryShared.CreateShmObjectLossOfFunction")
$RootCause("Library rejects or fails to create a shm-object that can be created", "ShmObjectCreateValidRequestRejected", "Gate1")
$RootCause("Operating system fails to create or map the shm-object", "ShmObjectCreateOsFailure", "Gate1")
$RootCause("Stale creation lock or shm-object of a previous run blocks the creation", "ShmObjectCreateBlockedByStaleArtefacts", "Gate1")

@enduml
Loading
Loading