静的解析ツール klocworkによる 機能安全規格への対応

25
1 2002-2014 Rogue Wave Software, Inc. All Rights Reserved. 1 2002-2014 Rogue Wave Software, Inc. All Rights Reserved.

Upload: masaru-horioka

Post on 12-Apr-2017

569 views

Category:

Software


2 download

TRANSCRIPT

Page 1: 静的解析ツール Klocworkによる 機能安全規格への対応

12002-2014 Rogue Wave Software, Inc. All Rights Reserved.

12002-2014 Rogue Wave Software, Inc. All Rights Reserved.

Page 2: 静的解析ツール Klocworkによる 機能安全規格への対応

22002-2014 Rogue Wave Software, Inc. All Rights Reserved.

22002-2014 Rogue Wave Software, Inc. All Rights Reserved.

機能安全規格対応ソースコード解析ツールKlocwork のご紹介

Masaru HoriokaSenior Sales Engineer – APACRogue Wave Software

Page 3: 静的解析ツール Klocworkによる 機能安全規格への対応

32002-2014 Rogue Wave Software, Inc. All Rights Reserved.

32002-2014 Rogue Wave Software, Inc. All Rights Reserved.

静的コード解析とは

Page 4: 静的解析ツール Klocworkによる 機能安全規格への対応

42002-2014 Rogue Wave Software, Inc. All Rights Reserved.

42002-2014 Rogue Wave Software, Inc. All Rights Reserved.

静的コード解析とは?ソースコードを解析し、パターンマッチや仮想実行により、ソフトウェアを実行することなく欠陥発見する

テストツールまるわかりガイド(入門編)より

Page 5: 静的解析ツール Klocworkによる 機能安全規格への対応

52002-2014 Rogue Wave Software, Inc. All Rights Reserved.

52002-2014 Rogue Wave Software, Inc. All Rights Reserved.

Goto Fail 問題の静的解析による指摘例

Page 6: 静的解析ツール Klocworkによる 機能安全規格への対応

62002-2014 Rogue Wave Software, Inc. All Rights Reserved.

62002-2014 Rogue Wave Software, Inc. All Rights Reserved.

静的コード解析が注目されている理由1 バグの発見の前倒し、テスト網羅性の向上• 大規模で複雑なソフトウェア開発において、人手によるコードレ

ビューや、既存のテスト手法ではカバーしにくい領域を補完• 自動実行可能、コード変更毎のくり返し実行が容易

仕様デザイン

コード単体テスト

システムテスト受け入れテスト

リリース

修正

コスト

ソフトウェア・ライフサイクル

Page 7: 静的解析ツール Klocworkによる 機能安全規格への対応

72002-2014 Rogue Wave Software, Inc. All Rights Reserved.

72002-2014 Rogue Wave Software, Inc. All Rights Reserved.

静的コード解析が注目されている理由2近年納入条件の一つとして「静的解析ツールの利用とそのエビデンスの提供」が指定されるケースが増えてきている

– 機能安全規格準拠– コーディング標準対応– 複雑度の増加等、下流工程に影響をあたえるコードの弱

点を早期検出し、問題を未然に防ぐ

Page 8: 静的解析ツール Klocworkによる 機能安全規格への対応

82002-2014 Rogue Wave Software, Inc. All Rights Reserved.

82002-2014 Rogue Wave Software, Inc. All Rights Reserved.

静的解析ツールKlocwork による機能安全規格サポート

Page 9: 静的解析ツール Klocworkによる 機能安全規格への対応

92002-2014 Rogue Wave Software, Inc. All Rights Reserved.

92002-2014 Rogue Wave Software, Inc. All Rights Reserved.

機能安全規格と静的解析何が求められている?何ができる?

IEC61508 part 3 や ISO26262 part 6 で記載されるソフトウェア設計指針やコーディング規約の順守、ソフトウェア検証としての静的解析ツールの使用 静的解析ツールを用いると、上記に対するチェックおよびエビデンス作成

が自動化できる Klocwork ならデスクトップ解析により効率的なチェック・指摘への対応が

可能

使用するツールの Qualification 事前に Certification を得ているものを使用すると、 Qualification を自前

でやる労力を削減することができる

Page 10: 静的解析ツール Klocworkによる 機能安全規格への対応

102002-2014 Rogue Wave Software, Inc. All Rights Reserved.

102002-2014 Rogue Wave Software, Inc. All Rights Reserved.

Klocwork の ISO 26262 サポート• Klocwork の機能と 26262 の要件のマッピング :

http://goo.gl/KHc36f

• MISRA チェッカー、メトリクス機能によるサポート– ISO 26262-6 の中でもコーディング規約として

MISRA が言及・推奨されている

Page 11: 静的解析ツール Klocworkによる 機能安全規格への対応

112002-2014 Rogue Wave Software, Inc. All Rights Reserved.

112002-2014 Rogue Wave Software, Inc. All Rights Reserved.

ISO26262-6 Table 1GUIDELINE KLOCWORK

SUPPORTDESCRIPTION OF SUPPORT

Additional Detail

(1a) Enforcement of Low Complexity

FULL Full support for McCabe cyclomatic complexity, including the ability to enforce threshold levels across the development.

Use Complexity report or metrics checker using .mconf file.

(1b) Use of Language Subsets

FULL Wide array of relevant code checks are available across MISRA and standard checkers, for example “Assignment in Condition”

Use MISRA checker and built-in Klocwork checker ASSIGNCOND.*, CWARN.*

(1c)Enforcement of strong typing

FULL A full family of strong type defect checkers are provided in the too

Use STRONG.* checker

(1d) Use of defensive implementation techniques

FULL Wide array of checkers and coding standards (e.g. MISRA) are available that would be considered defensive programming.

Use MISRA checker and built-in checker such as SV.RVT.RETVAL.NOTTESTED

複雑度

C 言語サブセットの使用強い型

防御的プログラミング

Page 12: 静的解析ツール Klocworkによる 機能安全規格への対応

122002-2014 Rogue Wave Software, Inc. All Rights Reserved.

122002-2014 Rogue Wave Software, Inc. All Rights Reserved.

ISO26262-6 Table 1GUIDELINE KLOCWO

RK SUPPORT

DESCRIPTION OF SUPPORT

Additional Detail

(1e) Use of established design principles

FULL WITH INTEGRATION/CUSTOMIZATION

Graphical visualization tool available to generate architecture rules that can be enforced.

Klocwork support integration with architecture visualization tool such as Structure 101 and Lattix or customization with kwarchitect API

(1g) Use of style guides

FULL Out-of-the-box support for MISRA is provided, as well as ability to extend the product with custom checkers

Use MISRA checkers such as MISRA.IF, MISRA.SWITCH, etc (Note Klocwork does support guide line for space such as indent things). You also create custom rules. See custom rule examples.

(1h) Using of naming conventions

FULL Out-of-the-box support for MISRA is provided, as well as ability to extend the product with custom checkers.

Use MISRA rule such as MISRA.IDENT, MISRA.DEFINE. You also create custom rules. See custom rule examples.

設計規則

コーディングスタイル

命名規則

Page 13: 静的解析ツール Klocworkによる 機能安全規格への対応

132002-2014 Rogue Wave Software, Inc. All Rights Reserved.

132002-2014 Rogue Wave Software, Inc. All Rights Reserved.

ISO26262-6 Table 3GUIDELINE KLOCWORK

SUPPORTDESCRIPTION OF SUPPORT

Additional Detail

(1a) Hierarchical structure of software components

FULL A graphical visualization of your source code is available that enables the creation of a hierarchical code structure.

Klocwork support integration with architecture visualization tool such as Structure 101 and Lattix or customization with kwarchitect API

(1b) Restricted size of software components

FULL Size of components can be restricted by LOC using a LOC metric.

Use *LOC_METHOD for method. LOC_FILE for file.

(1c) Restricted size of interfaces

FULL WITH INTEGRATION/CUSTOMIZATION

A graphical visualization of your source code is available that enables the identification of software interfaces, which can be restricted.

Klocwork support integration with architecture visualization tool such as Structure 101 and Lattix or customization with kwarchitect API

設計規則

コードが巨大化していないか?

インターフェイスが複雑化していなか

Page 14: 静的解析ツール Klocworkによる 機能安全規格への対応

142002-2014 Rogue Wave Software, Inc. All Rights Reserved.

142002-2014 Rogue Wave Software, Inc. All Rights Reserved.

ISO26262-6 Table 3GUIDELINE KLOCWORK

SUPPORTDESCRIPTION OF SUPPORT

Additional Detail

(1d) High cohesion within each software component

FULL Cohesion can be measured with a cohesion metric.

Use COHESIONx metrics. There is no standard threshold. User need to decide it.

(1e) Restricted coupling between software components

FULL Coupling can be measured with a coupling metric.

Use COUPLINGx metrics. There is no standard threshold. User need to decide it.

(1f) Restricted use of interrupts

PARTIAL WITH CUSTOMIZATION

A custom checker can be written to identify and restrict the use of interrupts.

Need to identify how to find interrupts. Then create customer checkers if possible.

凝集度

結合度

割り込みの使用

Page 15: 静的解析ツール Klocworkによる 機能安全規格への対応

152002-2014 Rogue Wave Software, Inc. All Rights Reserved.

152002-2014 Rogue Wave Software, Inc. All Rights Reserved.

ISO26262-6 Table 8GUIDELINE KLOCWORK

SUPPORTDESCRIPTION OF SUPPORT

Additional Detail

(1a) One entry and one exit point in subprograms and functions

PARTIAL Exits points can be identified through the use of a return statement metric.

Use MISRA.RETURN.NOT_LAST or "NORET"(Number of returns" metrics

(1c) Initialization of variables

FULL Full family of uninitialized variable checks are available

Use UNINIT.* checkers.

(1e) Avoid global variables or else justify their usage

PARTIAL Global variables can be identified through MISRA checker, custom checker, graphical visualization of the architecture, and documented for the purposes of justifying their usage

Create custom checker for detecting global variables. Also, MISRA.ONEDEFRULE.* can be used for inappropriate declaration for global variable/functions.

(1g) No implicit type conversions

FULL A family of type conversion checks are available as part of the MISRA family of checkers.

Use MISRA.CONV.*, MISRA.CVALUE.CIMPL.*

関数エントリポイント変数初期化

グローバル変数

型変換

Page 16: 静的解析ツール Klocworkによる 機能安全規格への対応

162002-2014 Rogue Wave Software, Inc. All Rights Reserved.

162002-2014 Rogue Wave Software, Inc. All Rights Reserved.

ISO26262-6 Table 8GUIDELINE KLOCWORK

SUPPORTDESCRIPTION OF SUPPORT

Additional Detail

(1h) No hidden data flow or control flow

PARTIAL MISRA family of checkers includes support for identifying jumps. Or you can create custom checker for specific pattern like goto pointer, etc

Use MISRA.GOTO*

(1i) No unconditional jumps

FULL MISRA family of checkers includes support for identifying “goto” statements

Use MISRA.GOTO*

(1j) No recursions FULL MISRA family of checkers for identifying "recursion"

Use MISRA.FUNC.RECUR

把握しにくい制御フロー

無条件ジャンプ

再帰呼び出し

Page 17: 静的解析ツール Klocworkによる 機能安全規格への対応

172002-2014 Rogue Wave Software, Inc. All Rights Reserved.

172002-2014 Rogue Wave Software, Inc. All Rights Reserved.

様々な環境で利用可能なデスクトップ解析Visual Studio, Eclipse 向けプラグインに加え、その他の任意のエディタと併用可能な Klocwork Desktop を提供

Page 18: 静的解析ツール Klocworkによる 機能安全規格への対応

182002-2014 Rogue Wave Software, Inc. All Rights Reserved.

182002-2014 Rogue Wave Software, Inc. All Rights Reserved.

静的解析活用のベスト・プラクティス:コーディング段階から解析

編集 保存 解析 & 修正コンパイル テスト チェックイン ビルド

開発サイクル

ポイント : • コーディング段階から活用• 不具合を含むコードがチェックインされることを防ぐ• 手戻りが少ない• コーディング段階から品質の見える化

Page 19: 静的解析ツール Klocworkによる 機能安全規格への対応

192002-2014 Rogue Wave Software, Inc. All Rights Reserved.

192002-2014 Rogue Wave Software, Inc. All Rights Reserved.

コーディング段階から品質の見える化• 指摘の種類の分析• 指摘数の推移• 修正、利用状況の管理• 複雑度等メトリクス取得

品質を見える化するためのレポーティング機能

Page 20: 静的解析ツール Klocworkによる 機能安全規格への対応

202002-2014 Rogue Wave Software, Inc. All Rights Reserved.

202002-2014 Rogue Wave Software, Inc. All Rights Reserved.

Web API による独自レポート作成

Page 21: 静的解析ツール Klocworkによる 機能安全規格への対応

212002-2014 Rogue Wave Software, Inc. All Rights Reserved.

212002-2014 Rogue Wave Software, Inc. All Rights Reserved.

Qualification と certification

• Version 9.6.4 に対しては Certified (pre-qualified)取得済み–最新バージョンについては取得準備中

• 利用者自ら Qualification が必要な場合、一連のテストケースを含む Qualification Deployment Package (QDP) を提供

Page 22: 静的解析ツール Klocworkによる 機能安全規格への対応

222002-2014 Rogue Wave Software, Inc. All Rights Reserved.

222002-2014 Rogue Wave Software, Inc. All Rights Reserved.

デモ

Page 23: 静的解析ツール Klocworkによる 機能安全規格への対応

232002-2014 Rogue Wave Software, Inc. All Rights Reserved.

232002-2014 Rogue Wave Software, Inc. All Rights Reserved.

まとめKlocwork: 機能安全規格対応ソースコード解析ツール

• ISO 26262 や IEC61508 で要求されているソフトウェア静的検証が可能• MISRA• 実行時エラー• メトリクス

• 26262 や 61508 は特定バージョンでは認証取得済み。それ以外の環境では利用者による認証を支援する Qualification Deployment Package を提供

• デスクトップ解析、 Web レポーティング機能により、機能安全への取り組みを開発プロセスに自然な形で統合することが可能

Page 24: 静的解析ツール Klocworkによる 機能安全規格への対応

242002-2014 Rogue Wave Software, Inc. All Rights Reserved.

242002-2014 Rogue Wave Software, Inc. All Rights Reserved.

無料トライアルのご紹介

• 対象– 導入を検討されているお客様

• 概要– 試用ライセンスを提供します。– 御社の環境に Klocwork を導入にいただき、開発中のコードなどを解析いただき、解析結果を確認

いただけます。– 導入から解析結果の見方までサポートいたします。– 解析結果を用いて御社コードの品質状況を解析結果報告会としてご報告いたします。

• ステップ– お申込み– 環境の確認(言語、使用コンパイラ、 OS 、マシンスペック、導入規模など)– 導入および解析の実行– 解析結果のレビューおよび重要な指摘例のピックアップ– 解析結果報告会– 評価および導入に向けたご相談

Page 25: 静的解析ツール Klocworkによる 機能安全規格への対応

252002-2014 Rogue Wave Software, Inc. All Rights Reserved.

252002-2014 Rogue Wave Software, Inc. All Rights Reserved.