safety/safety_overview.html · safety/safety_overview.rst 공식 원문 ↗

Zephyr 3.7.0 · Safety

Zephyr 안전 개요

기존 Zephyr codebase를 audit 가능한 안전 범위로 만들고 인증 release까지 이어가는 기준과 역할을 설명합니다.

Official pathsafety/safety_overview.html
Source filesafety/safety_overview.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

IEC 61508 인증 목표, coding·requirements tracing·coverage 품질 기준, layered architecture와 main·LTS·auditable branch 사이의 안전 process를 설명합니다.

Target

IEC 61508 · SIL 3 · SC 3

Evidence

Traceability · Coverage · Architecture

Workflow

Main · LTS · Auditable · Release

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 86D674013E8A86660C1CA0D302972852A5985E2A07A4A6C038E806AFD091D708
.. _safety_overview:

Zephyr Safety Overview
########################

Introduction
************

This document is the safety documentation providing an overview over the safety-relevant activities
and what the Zephyr Project and the Zephyr Safety Working Group / Committee try to achieve.

This overview is provided for people who are interested in the functional safety development part
of the Zephyr RTOS and project members who want to contribute to the safety aspects of the
project.

Overview
********

In this section we give the reader an overview of what the general goal of the safety certification
is, what standard we aim to achieve and what quality standards and processes need to be implemented
to reach such a safety certification.

Safety Document update
**********************

This document is a living document and may evolve over time as new requirements, guidelines, or
processes are introduced.

#. Changes will be submitted from the interested party(ies) via pull requests to the Zephyr
   documentation repository.

#. The Zephyr Safety Committee will review these changes and provide feedback or acceptance of
   the changes.

#. Once accepted, these changes will become part of the document.

General safety scope
********************

The general scope of the Safety Committee is to achieve a certification for the `IEC 61508
<https://en.wikipedia.org/wiki/IEC_61508>`__ standard and the Safety Integrity Level (SIL) 3 /
Systematic Capability (SC) 3 for a limited source scope (see certification scope TBD). Since the
code base is pre-existing, we use the route 3s/1s approach defined by the IEC 61508 standard.

Route 3s
   *Assessment of non-compliant development. Which is basically the route 1s with existing
   sources.*

Route 1s
   *Compliant development. Compliance with the requirements of this standard for the avoidance and
   control of systematic faults in software.*

Summarization IEC 61508 standard
================================

The IEC 61508 standard is a widely recognized international standard for functional safety of
electrical, electronic, and programmable electronic safety-related systems. Here's an overview of
some of the key safety aspects of the standard:

#. **Hazard and Risk Analysis**: The IEC 61508 standard requires a thorough analysis of potential
   hazards and risks associated with a system in order to determine the appropriate level of safety
   measures needed to reduce those risks to acceptable levels.

#. **Safety Integrity Level (SIL)**: The standard introduces the concept of Safety Integrity Level
   (SIL) to classify the level of risk reduction required for each safety function. The higher the
   SIL, the greater the level of risk reduction required.

#. **System Design**: The IEC 61508 standard requires a systematic approach to system design that
   includes the identification of safety requirements, the development of a safety plan, and the
   use of appropriate safety techniques and measures to ensure that the system meets the required
   SIL.

#. **Verification and Validation**: The standard requires rigorous testing and evaluation of the
   safety-related system to ensure that it meets the specified SIL and other safety requirements.
   This includes verification of the system design, validation of the system's functionality, and
   ongoing monitoring and maintenance of the system.

#. **Documentation and Traceability**: The IEC 61508 standard requires a comprehensive
   documentation process to ensure that all aspects of the safety-related system are fully
   documented and that there is full traceability from the safety requirements to the final system
   design and implementation.

Overall, the IEC 61508 standard provides a framework for the design, development, and
implementation of safety-related systems that aims to reduce the risk of accidents and improve
overall safety. By following the standard, organizations can ensure that their safety-related
systems are designed and implemented to the highest level of safety integrity.

Quality
*******

Quality is a mandatory expectation for software across the industry. The code base of the project
must achieve various software quality goals in order to be considered an auditable code base from a
safety perspective and to be usable for certification purposes. But software quality is not an
additional requirement caused by functional safety standards. Functional safety considers quality
as an existing pre-condition and therefore the "quality managed" status should be pursued for any
project regardless of the functional safety goals. The following list describes the quality goals
which need to be reached to achieve an auditable code base:

1. Basic software quality standards

   a. :ref:`coding_guidelines` (including: static code analysis, coding style, etc.)
   b. :ref:`safety_requirements` and requirements tracing
   c. Test coverage

2. Software architecture design principles

   a. Layered architecture model
   b. Encapsulated components
   c. Encapsulated single functionality (if not fitable and manageable in safety)

Basic software quality standards - Safety view
==============================================

In this chapter the Safety Committee describes why they need the above listed quality goals as
pre-condition and what needs to be done to achieve an auditable code base from the safety
perspective. Generally speaking, it can be said that all of these quality measures regarding safety
are used to minimize the error rate during code development.

Coding Guidelines
-----------------

The coding guidelines are the basis to a common understanding and a unified ruleset and development
style for industrial software products. For safety the coding guidelines are essential and have
another purpose beside the fact of a unified ruleset. It is also necessary to prove that the
developers follow a unified development style to prevent **systematic errors** in the process of
developing software and thus to minimize the overall **error rate** of the complete software
system.

Also the **IEC 61508 standard** sets a pre-condition and recommendation towards the use of coding
standards / guidelines to reduce likelihood of errors.

Requirements and requirements tracing
-------------------------------------

Requirements and requirement management are not only important for software development, but also
very important in terms of safety. On the one hand, this specifies and describes in detail and on a
technical level what the software should do, and on the other hand, it is an important and
necessary tool to verify whether the described functionality is implemented as expected. For this
purpose, tracing the requirements down to the code level is used. With the requirements management
and tracing in hand, it can now be verified whether the functionality has been tested and
implemented correctly, thus minimizing the systematic error rate.

Also the IEC 61508 standard highly recommends (which is like a must-have for the certification)
requirements and requirements tracing.

Test coverage
-------------

A high test coverage, in turn, is evidence of safety that the code conforms precisely to what it
was developed for and does not execute any unforeseen instructions. If the entire code is tested
and has a high (ideally 100%) test coverage, it has the additional advantage of quickly detecting
faulty changes and further minimizing the error rate. However, it must be noted that different
requirements apply to safety for test coverage, and various metrics must be considered, which are
prescribed by the IEC 61508 standard for the SIL 3 / SC3 target. The following must be fulfilled,
among other things:

* Structural test coverage (entry points) 100%
* Structural test coverage (statements) 100%
* Structural test coverage (branches) 100%

If the 100% cannot be reached (e.g. statement coverage of defensive code) that part needs to be
described and justified in the documentation.

Software architecture design principles
=======================================

To create and maintain a structured software product it is also necessary to consider individual
software architecture designs and implement them in accordance with safety standards because some
designs and implementations are not reasonable in safety, so that the overall software and code
base can be used as auditable code. However, most of these software architecture designs have
already been implemented in the Zephyr project and need to be verified by the Safety Committee /
Safety Working Group and the safety architect.

Layered architecture model
--------------------------

The **IEC 61508 standard** strongly recommends a modular approach to software architecture. This
approach has been pursued in the Zephyr project from the beginning with its layered architecture.
The idea behind this architecture is to organize modules or components with similar functionality
into layers. As a result, each layer can be assigned a specific role in the system. This model has
the advantage in safety that interfaces between different components and layers can be shown at a
very high level, and thus it can be determined which functionalities are safety-relevant and can be
limited. Furthermore, various analyses and documentations can be built on top of this architecture,
which are important for certification and the responsible certification body.

Encapsulated components
-----------------------

Encapsulated components are an essential part of the architecture design for safety at this point.
The most important aspect is the separation of safety-relevant components from non-safety-relevant
components, including their associated interfaces. This ensures that the components have no
**repercussions** on other components.

Encapsulated single functionality (if not reasonable and manageable in safety)
------------------------------------------------------------------------------

Another requirement for the overall system and software environment is that individual
functionalities can be disabled within components. This is because if a function is absolutely
unacceptable for safety (e.g. complete dynamic memory management), then these individual
functionalities should be able to be turned off. The Zephyr Project already offers such a
possibility through the use of Kconfig and its flexible configurability.

Processes and workflow
**********************

.. figure:: ../../../safety/images/zephyr-safety-process.svg
   :align: center
   :alt: Safety process and workflow overview
   :figclass: align-center

   Safety process and workflow overview

The diagram describes the rough process defined by the Safety Committee to ensure safety in the
development of the Zephyr project. To ensure understanding, a few points need to be highlighted and
some details explained regarding the role of the safety architect and the role of the safety
committee in the whole process. The diagram only describes the paths that are possible when a
change is related to safety.

#. On the main branch, the safety scope of the project should be identified, which typically
   represents a small subset of the entire code base. This subset should then be made auditable
   during normal development on “main”, which means that special attention is paid to quality goals
   (`Quality`_) and safety processes within this scope. The Safety Architect works alongside the
   Technical Steering Committee (TSC) in this area, monitoring the development process to ensure
   that the architecture meets the safety requirements.

#. At this point, the safety architect plays an increasingly important role. For PRs/issues that
   fall within the safety scope, the safety architect should ideally be involved in the discussions
   and decisions of minor changes in the safety scope to be able to react to safety-relevant
   changes that are not conformant. If a pull request or issue introduces a significant and
   influential change or improvement that requires extended discussion or decision-making, the
   safety architect should bring it to the attention of the Safety Committee or the Technical
   Steering Committee (TSC) as appropriate, so that they can make a decision on the best course of
   action.

#. This section describes the certification side. At this point, the code base has to be in an
   "auditable" state, and ideally no further changes should be necessary or made to the code base.
   There is still a path from the main branch to this area. This is needed in case a serious bug or
   important change is found or implemented on the main branch in the safety scope, after the LTS
   and the auditable branch were created. In this case, the Safety Committee, together with the
   safety architect, must decide whether this bug fix or change should be integrated into the LTS
   so that the bug fix or change could also be integrated into the auditable branch. This
   integration can take three forms: First either as only a code change or second as only an update
   to the safety documentation or third as both.

#. This describes the necessary safety process required for certification itself. Here, the final
   analyses, tests, and documents are created and conducted which must be created and conducted
   during the certification, and which are prescribed by the certifying authority and the standard
   being certified. If the certification body approves everything at this stage and the safety
   process is completed, a safety release can be created and published.

#. This transition from the auditable branch to the main branch should only occur in exceptional
   circumstances, specifically when something has been identified during the certification process
   that needs to be quickly adapted on the “auditable” branch in order to obtain certification. In
   order to prevent this issue from arising again during the next certification, there needs to be
   a path to merge these changes back into the main branch so that they are not lost, and to have
   them ready for the next certification if necessary.

.. important::
   Safety should not block the project and minimize the room to grow in any way.

.. important::
   **TODO:** Find and define ways, guidelines and processes which minimally impact the daily work
   of the maintainers, reviewers and contributors and also the safety architect itself.
   But which are also suitable for safety.

Part 3

한국어 전문 번역

소개

이 문서는 안전 관련 활동 전반과 Zephyr Project 및 Zephyr Safety Working Group/Committee가 달성하려는 목표를 개괄하는 안전 문서입니다.

Zephyr RTOS의 functional safety 개발에 관심 있는 사람과 project의 안전 측면에 기여하려는 project member를 대상으로 합니다.

개요

이 절에서는 안전 인증의 일반적인 목표, 달성하려는 표준, 그리고 그러한 안전 인증에 도달하기 위해 구현해야 하는 품질 표준과 process를 설명합니다.

안전 문서 갱신

이 문서는 계속 관리되는 living document이며 새 요구사항, guideline 또는 process가 도입되면 시간이 지나면서 바뀔 수 있습니다.

  1. 관심 당사자는 Zephyr documentation repository에 pull request를 제출해 변경을 제안합니다.
  2. Zephyr Safety Committee는 변경을 검토하고 의견을 제시하거나 변경을 승인합니다.
  3. 승인된 변경은 이 문서의 일부가 됩니다.

일반 안전 범위

Safety Committee의 일반적인 범위는 제한된 source 범위에 대해 IEC 61508 표준과 Safety Integrity Level(SIL) 3/Systematic Capability(SC) 3 인증을 달성하는 것입니다. 인증 범위는 아직 정해야 합니다. 기존 codebase를 대상으로 하므로 IEC 61508이 정의한 route 3s/1s 접근법을 사용합니다.

Route 3s
표준을 따르지 않고 개발된 기존 source를 평가하는 경로입니다. 본질적으로 기존 source에 route 1s를 적용합니다.
Route 1s
표준을 준수하는 개발 경로입니다. Software의 systematic fault를 회피하고 제어하기 위한 이 표준의 요구사항을 따릅니다.

IEC 61508 표준 요약

IEC 61508은 전기·전자·programmable electronic 안전 관련 system의 functional safety를 다루는 국제적으로 널리 인정된 표준입니다. 핵심 안전 측면은 다음과 같습니다.

  1. Hazard and Risk Analysis: System과 관련된 잠재적 hazard와 risk를 철저히 분석하고, 그 위험을 허용 가능한 수준으로 낮추는 데 필요한 안전 조치의 수준을 결정해야 합니다.
  2. Safety Integrity Level(SIL): 각 안전 기능에 필요한 risk reduction 수준을 분류하기 위해 SIL 개념을 도입합니다. SIL이 높을수록 더 큰 risk reduction이 필요합니다.
  3. System Design: 안전 요구사항 식별, safety plan 개발, 필요한 SIL을 충족하기 위한 적절한 안전 기법과 조치를 포함하는 체계적인 system 설계 접근법을 요구합니다.
  4. Verification and Validation: 안전 관련 system이 지정된 SIL과 다른 안전 요구사항을 충족하는지 확인하기 위해 엄격한 test와 평가를 요구합니다. System 설계 verification, system 기능 validation, 지속적인 monitoring과 maintenance가 포함됩니다.
  5. Documentation and Traceability: 안전 관련 system의 모든 측면을 빠짐없이 문서화하고 안전 요구사항에서 최종 system 설계와 구현까지 완전하게 추적할 수 있도록 포괄적인 documentation process를 요구합니다.

IEC 61508은 사고 위험을 줄이고 전반적인 안전을 높이기 위한 안전 관련 system의 설계·개발·구현 framework를 제공합니다.

조직은 이 표준을 따르면 안전 관련 system이 최고 수준의 safety integrity에 맞게 설계되고 구현됐음을 확인할 수 있습니다.

품질

품질은 산업 전반의 software에 필수적으로 기대되는 조건입니다. Project codebase가 안전 관점에서 audit할 수 있고 인증에 사용할 수 있으려면 여러 software 품질 목표를 달성해야 합니다. 다만 software 품질은 functional safety 표준 때문에 새로 생기는 추가 요구사항이 아닙니다. Functional safety는 품질이 이미 갖춰졌다는 것을 전제로 하므로, functional safety 목표와 관계없이 모든 project는 quality-managed 상태를 추구해야 합니다. Audit 가능한 codebase를 만들기 위한 품질 목표는 다음과 같습니다.

  1. 기본 software 품질 표준
    1. Coding Guidelines: static code analysis와 coding style 등을 포함합니다.
    2. 안전 요구사항과 requirements tracing
    3. Test coverage
  2. Software architecture 설계 원칙
    1. Layered architecture model
    2. Encapsulated component
    3. 안전 범위에서 적합하지 않거나 관리하기 어려운 경우 개별 기능을 캡슐화

기본 software 품질 표준: 안전 관점

이 장에서는 앞서 나열한 품질 목표가 왜 전제 조건인지, 안전 관점에서 audit 가능한 codebase를 만들려면 무엇을 해야 하는지 Safety Committee의 관점으로 설명합니다. 일반적으로 이러한 안전 품질 조치는 모두 code 개발 중 오류율을 최소화하기 위해 사용됩니다.

Coding Guidelines

Coding guideline은 산업용 software product에서 공통 이해, 통일된 규칙 집합과 개발 style을 만드는 기반입니다. 안전 분야에서는 통일된 규칙 외에도 중요한 목적이 있습니다. 개발자가 일관된 개발 style을 따른다는 사실을 입증함으로써 software 개발 process의 systematic error를 막고 전체 software system의 error rate를 최소화해야 합니다.

IEC 61508 표준도 오류 발생 가능성을 줄이기 위해 coding standard 또는 guideline 사용을 전제 조건이자 권고사항으로 둡니다.

요구사항과 requirements tracing

요구사항과 requirement management는 software 개발뿐 아니라 안전에서도 매우 중요합니다. 한편으로는 software가 무엇을 해야 하는지 기술 수준에서 자세히 명세하고, 다른 한편으로는 설명된 기능이 예상대로 구현됐는지 검증하는 필수 도구입니다. 이를 위해 요구사항을 code 수준까지 추적합니다.

Requirement management와 tracing을 이용하면 기능이 올바르게 test되고 구현됐는지 검증해 systematic error rate를 최소화할 수 있습니다. IEC 61508도 요구사항과 requirements tracing을 강하게 권고하며, 실제 인증에서는 사실상 필수 조건입니다.

Test coverage

높은 test coverage는 code가 개발 목적에 정확히 부합하고 예상하지 못한 instruction을 실행하지 않는다는 안전 증거입니다. 전체 code를 test해 높은 coverage, 이상적으로 100%를 달성하면 잘못된 변경을 빠르게 감지하고 오류율을 더 줄일 수 있습니다.

다만 안전 분야의 test coverage에는 일반 test와 다른 요구사항이 적용됩니다. IEC 61508이 SIL 3/SC 3 목표에 대해 규정한 여러 metric을 고려해야 하며, 특히 다음 항목을 충족해야 합니다.

  • Structural test coverage(entry point) 100%
  • Structural test coverage(statement) 100%
  • Structural test coverage(branch) 100%

100%에 도달할 수 없는 부분, 예를 들어 defensive code의 statement coverage는 문서에서 해당 부분과 사유를 설명하고 정당화해야 합니다.

Software architecture 설계 원칙

구조화된 software product를 만들고 유지하려면 개별 software architecture 설계를 검토하고 안전 표준에 맞게 구현해야 합니다. 안전 분야에 적합하지 않은 설계와 구현이 있기 때문입니다. 그래야 전체 software와 codebase를 audit 가능한 code로 사용할 수 있습니다. 이러한 architecture 설계의 대부분은 Zephyr project에 이미 구현돼 있으며, Safety Committee/Safety Working Group과 safety architect가 검증해야 합니다.

Layered architecture model

IEC 61508은 software architecture에 modular 접근법을 강하게 권고합니다. Zephyr project는 시작부터 layered architecture를 통해 이 접근법을 따랐습니다. 비슷한 기능을 가진 module이나 component를 layer로 구성하고 각 layer에 system의 특정 역할을 부여하는 방식입니다.

안전 관점에서 이 model은 서로 다른 component와 layer 사이의 interface를 높은 수준에서 드러냅니다. 따라서 안전 관련 기능을 판별하고 범위를 제한할 수 있습니다. 또한 인증과 담당 인증 기관에 필요한 여러 분석과 문서를 이 architecture 위에 구축할 수 있습니다.

Encapsulated component

캡슐화된 component는 안전을 위한 architecture 설계의 핵심 요소입니다. 가장 중요한 점은 관련 interface를 포함해 안전 관련 component를 비안전 component와 분리하는 것입니다. 이렇게 해야 component가 다른 component에 repercussion, 즉 의도하지 않은 영향을 주지 않습니다.

캡슐화된 단일 기능

전체 system과 software 환경에는 component 내부의 개별 기능을 끌 수 있어야 한다는 요구사항도 있습니다. 완전한 dynamic memory management처럼 어떤 기능이 안전에 절대로 허용될 수 없다면 그 기능만 비활성화할 수 있어야 합니다. Zephyr Project는 Kconfig와 유연한 configuration을 통해 이미 이러한 기능을 제공합니다.

Process와 workflow

Zephyr 안전 process와 workflow 개요
1. Main branch

전체 codebase에서 제한된 safety scope를 식별하고 품질 목표와 안전 process를 적용해 audit 가능한 상태로 만듭니다.

2. Safety review

Safety architect가 safety scope의 PR과 issue에 참여하고 중대한 변경은 Safety Committee 또는 TSC로 올립니다.

3. LTS와 auditable branch

LTS 이후 중요한 수정은 code, 안전 문서 또는 둘 모두의 형태로 심의해 auditable branch에 반영합니다.

4. Certification

인증 기관과 표준이 요구하는 최종 분석·test·문서를 수행하고 승인되면 safety release를 발행합니다.

5. Main으로 환류

인증 중 auditable branch에서 긴급 변경한 내용은 다음 인증에서 잃지 않도록 예외적으로 main branch에 되돌려 반영합니다.

Safety 관련 변경에 적용되는 경로만 나타냅니다.

이 도식은 Zephyr project 개발에서 안전을 확보하기 위해 Safety Committee가 정한 대략적인 process를 나타냅니다. 전체 process에서 safety architect와 Safety Committee의 역할을 이해할 수 있도록, 안전 관련 변경에 가능한 경로와 주요 세부사항을 다음과 같이 설명합니다.

  1. Main branch에서 project의 safety scope를 식별해야 합니다. 일반적으로 전체 codebase의 작은 부분집합입니다. 이 범위는 일상적인 main 개발 과정에서 audit 가능한 상태가 되어야 하며, 해당 범위의 품질 목표와 안전 process에 각별히 주의해야 합니다. Safety Architect는 TSC와 함께 개발 process를 감시해 architecture가 안전 요구사항을 충족하도록 합니다.
  2. Safety architect는 safety scope에 속한 PR과 issue의 논의 및 경미한 변경 결정에 가능한 한 참여해, 안전 관련이지만 표준에 맞지 않는 변경에 대응해야 합니다. 광범위한 논의나 결정이 필요한 중요한 변경·개선이라면 적절한 결정을 내릴 수 있도록 Safety Committee 또는 TSC에 사안을 알려야 합니다.
  3. 인증 측면에서는 codebase가 audit 가능한 상태여야 하며 이상적으로는 더 이상 code 변경이 필요하지 않아야 합니다. 그러나 LTS와 auditable branch를 만든 뒤 main의 safety scope에서 심각한 bug나 중요한 변경이 발견될 수 있으므로 main에서 이 영역으로 이어지는 경로가 필요합니다. Safety Committee와 safety architect는 수정 또는 변경을 LTS와 auditable branch에 통합할지 결정합니다. 통합 형태는 code 변경만, 안전 문서 갱신만, 또는 둘 모두가 될 수 있습니다.
  4. 이 단계는 인증 자체에 필요한 안전 process입니다. 인증 기관과 인증 대상 표준이 규정하는 최종 분석·test·문서를 만들고 수행합니다. 인증 기관이 모든 항목을 승인하고 안전 process가 끝나면 safety release를 만들고 공개할 수 있습니다.
  5. Auditable branch에서 main branch로의 전환은 예외적인 상황에만 이루어져야 합니다. 인증을 받기 위해 auditable branch에서 빠르게 고쳐야 할 문제가 인증 과정에서 발견된 경우가 이에 해당합니다. 다음 인증에서 같은 문제가 되풀이되지 않고 변경이 사라지지 않도록, 필요한 경우 해당 변경을 main에 다시 merge하는 경로가 필요합니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.