JP2015156053A - Information processor, its control method and program - Google Patents
Information processor, its control method and program Download PDFInfo
- Publication number
- JP2015156053A JP2015156053A JP2014029959A JP2014029959A JP2015156053A JP 2015156053 A JP2015156053 A JP 2015156053A JP 2014029959 A JP2014029959 A JP 2014029959A JP 2014029959 A JP2014029959 A JP 2014029959A JP 2015156053 A JP2015156053 A JP 2015156053A
- Authority
- JP
- Japan
- Prior art keywords
- program
- verification
- verified
- information processing
- processing apparatus
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、モデル検証プログラムを用いた情報処理装置、その制御方法、及びプログラムに関する。 The present invention relates to an information processing apparatus using a model verification program, a control method thereof, and a program.
プログラムの振る舞いを自動的且つ網羅的に検証する為の方法として、モデル検証プログラムを用いたプログラム検証方法がある。検証方法では、ユーザーの作成したプログラム(以下、被検証プログラムコードと称する。)及び検証式が、SPINやSMVのようなモデル検証プログラムを利用できる言語のプログラムコード(以下、検証用プログラムコードと称する。)に変換される。変換された上でモデル検証プログラムに入力・実行し、検証式違反の有無の確認が行われる。 As a method for automatically and comprehensively verifying the behavior of a program, there is a program verification method using a model verification program. In the verification method, a program created by a user (hereinafter referred to as a program code to be verified) and a verification formula are written in a language that can use a model verification program such as SPIN or SMV (hereinafter referred to as a verification program code). .). After being converted, it is input and executed in the model verification program, and whether or not there is a violation of the verification formula is confirmed.
このプログラム検証方法において、被検証プログラムコードの規模により、一般的に状態爆発と言われる状態数の多さ故にメモリ不足に陥りプログラム検証を実行できなくなってしまう問題がある。その為、モデル検証プログラムにおいては、特許文献1のように、取り扱える状態数を増加させる必要がある。また、モデル検証プログラムのユーザーは、検証を行う検証用プログラムコードをモデル検証プログラムを取り扱えるだけの、小ささに留める必要がある。
In this program verification method, there is a problem that the program verification cannot be executed due to a shortage of memory due to the large number of states generally referred to as state explosion depending on the scale of the program code to be verified. Therefore, in the model verification program, as in
検証用プログラムコードを小さくする為には、被検証プログラムコードを各々の検証式毎にした検証用プログラムコードを複数生成し、且つ各々の検証に関係の無いプログラムコード及び変数シンボルを削除(以下、プログラムスライスと称する)する方法がある。或いは、使用メモリサイズを必要最小限のビット長さまで小さくする、意味的に有意性のある代表インデックス値に変換する(以下、データ抽象化と称する)等の方法がある。 In order to reduce the verification program code, a plurality of verification program codes are generated for each verification formula of the program code to be verified, and program codes and variable symbols not related to each verification are deleted (hereinafter, There is a method called a program slice. Alternatively, there are methods such as reducing the used memory size to the necessary minimum bit length and converting it to a semantically significant representative index value (hereinafter referred to as data abstraction).
しかしながら、上記従来技術には以下に記載する問題がある。上記従来技術では、被検証プログラムコードの動作の検証を行うことが可能である。しかし、この方法を用いた場合、大域的な制御に対する検証を行う場合に、より多くの検証用プログラムコード・メモリが必要となり、状態爆発が発生して検証を実行することができない場合がある。 However, the above prior art has the following problems. In the above prior art, it is possible to verify the operation of the program code to be verified. However, when this method is used, when verification for global control is performed, more verification program code memory is required, and a state explosion may occur and verification may not be executed.
大域的な制御に対する検証を行う場合には、大域的な制御に含まれる全ての被検証プログラムコードから検証用プログラムコードを作成する。そのため、本来検証したい内容との関係はあるものの、関連性の低い被検証プログラムコード断片や、別の方法によって既に十分に検証が行われている被検証プログラムコード断片も検証用プログラムコードに組み込まれてしまう。したがって、検証用プログラムコードの使用するメモリ数やステップ数が増大してしまい、状態爆発が発生してしまう。 When verifying global control, verification program code is created from all program codes to be verified included in global control. Therefore, although there is a relationship with the content that you want to verify, the program code fragment to be verified that is less relevant or the program code fragment to be verified that has already been sufficiently verified by another method is also incorporated into the verification program code. End up. Therefore, the number of memories and steps used by the verification program code increases, and a state explosion occurs.
本発明は、上述の問題に鑑みて成されたものであり、モデル検証器を用いたプログラム検証において、関連性の低い部分の検証用プログラムを好適に削減することにより、モデル検証に必要な状態数を削減する仕組みを提供することを目的とする。 The present invention has been made in view of the above-described problems, and in the program verification using the model verifier, the state necessary for the model verification is preferably reduced by suitably reducing the verification program of the portion having low relevance. The purpose is to provide a mechanism to reduce the number.
本発明は、情報処理装置であって、被検証プログラムの検証する内容を示す検証式を作成する作成手段と、前記作成手段によって作成された検証式に関連するプログラムであるか否かを所定単位の被検証プログラムごとに判定する判定手段と、前記判定手段によって前記検証式に関連するプログラムであると判定された前記被検証プログラムについては、該被検証プログラムの状態を網羅的に探索して検証するモデル検証プログラムを実行するためのプログラムに該被検証プログラムを変換する変換手段と、前記判定手段によって前記検証式に関連するプログラムでないと判定された前記被検証プログラムについては、予め定義されたテンプレート適用データを用いて、前記モデル検証プログラムで実行する簡易的なプログラムを生成する生成手段と、前記変換手段によって変換されたプログラム、及び前記生成手段によって生成されたプログラムを前記モデル検証プログラムによって検証する検証手段とを備えることを特徴とする。 The present invention is an information processing apparatus, and includes a creation unit that creates a verification formula indicating the contents to be verified by a program to be verified, and whether the program is related to the verification formula created by the creation unit. Determining means for each program to be verified, and for the program to be verified determined by the determining means to be a program related to the verification formula, the state of the verified program is exhaustively searched and verified A conversion unit that converts the program to be verified into a program for executing the model verification program, and a template defined in advance for the program to be verified determined by the determination unit as not being a program related to the verification formula Using the application data, a raw program that generates a simple program to be executed by the model verification program Means, characterized in that it comprises a verification means for verifying the conversion program, and the program generated by the generating means and the model verification program by said converting means.
本発明によれば、モデル検証器を用いたプログラム検証において、関連性の低い部分の検証用プログラムを好適に削減することにより、モデル検証に必要な状態数を削減することができる。 According to the present invention, in the program verification using the model verifier, the number of states necessary for the model verification can be reduced by suitably reducing the verification program of the portion having low relevance.
以下、添付図面を参照して本発明の実施形態を詳しく説明する。なお、以下の実施形態は特許請求の範囲に係る本発明を限定するものでなく、また本実施形態で説明されている特徴の組み合わせの全てが本発明の解決手段に必須のものとは限らない。 Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. The following embodiments do not limit the present invention according to the claims, and all combinations of features described in the present embodiments are not necessarily essential to the solution means of the present invention. .
<第1の実施形態>
以下では、図1乃至図4Fを参照して本発明の第1の実施形態について説明する。検証すべきプログラムの性質の例として、被検証コードがC言語で記述されたソースコードである場合、「配列外へのメモリアクセスは行ってはならない」(以下、配列外参照と称する。)等の言語仕様からもたらされる検証仕様がある。配列外参照の検証を行うには、被検証プログラムを解析して配列アクセスを行うプログラム断片の関数名と位置を求め、配列の添え字が配列に対して確保されたメモリ容量を超えないことを確認するための検証式を生成する。配列の添え字や割り算の分母が定数である場合には、静的プログラム解析のみで検証を終了することが可能である。一方、配列の添え字や割り算の分母が変数である場合には、静的プログラム解析だけで検証を終えられない場合が多い。本実施形態は、配列の添え字が定数ではなく変数である場合について、モデル検証プログラムとしてSPINを用いて、性質についてのプログラム検証を行う場合について説明する。SPINとは、チャネル通信オートマトンを記述するための言語であるPromelaによる記述を入力として、網羅的に状態を探索し、その性質を検証するモデル検証プログラムである。
<First Embodiment>
Hereinafter, a first embodiment of the present invention will be described with reference to FIGS. 1 to 4F. As an example of the nature of the program to be verified, when the code to be verified is source code written in C language, “memory access outside the array must not be performed” (hereinafter referred to as an out-of-array reference) or the like. There is a verification specification that comes from the language specification. To verify an out-of-array reference, analyze the program to be verified to determine the function name and position of the program fragment that performs array access, and check that the array subscript does not exceed the memory capacity reserved for the array. Generate a verification formula to confirm. If the array subscript or division denominator is a constant, the verification can be completed only by static program analysis. On the other hand, when array subscripts and division denominators are variables, verification is often not completed by static program analysis alone. In the present embodiment, a case where program verification of properties is performed using SPIN as a model verification program when the array subscript is not a constant but a variable will be described. SPIN is a model verification program that searches a state exhaustively and verifies its properties by using a description by Promela, which is a language for describing a channel communication automaton, as an input.
<ソフトウェア構成>
まず、図1を参照して、本実施形態に係るプログラム検証装置である情報処理装置のソフトウェア構成について説明する。プログラム検証プログラム101は、図2に示す情報処理装置201において実行される。プログラム検証プログラム101は、動作制御ブロック102、被検証プログラムコード使用判断ブロック105、テンプレートコード生成ブロック106、コード縮小ブロック107、言語変換ブロック108、及びモデル検証プログラム110を含む。
<Software configuration>
First, a software configuration of an information processing apparatus that is a program verification apparatus according to the present embodiment will be described with reference to FIG. The
動作制御ブロック102は、プログラム検証プログラムの様々な処理を行う為の動作制御ブロックである。被検証プログラムコード103は、検証を行う対象である様々なユーザープログラムである。テンプレート適用データ104は、プログラム検証プログラム101内の被検証プログラムコード使用判断ブロック105及びテンプレートコード生成ブロック106で解釈可能な形式仕様記述言語で記述されている。テンプレート適用データ104は、プログラムコード断片の振る舞いやメモリの性質を示すデータであり、モデル検証プログラム110に入力する検証対象のプログラムコードを生成するためのデータである。当該テンプレート適用データ104を用いて、モデル検証プログラム110で実行されるコードを生成すると、当該被検証プログラムをそのままモデル検証プログラムで実行可能な形式に変換するよりも、簡略化されたコードを生成することができる。
The
動作制御ブロック102は、被検証プログラムコード使用判断ブロック105に、被検証プログラムコード103とテンプレート適用データ104の両方を入力し、被検証プログラムコード103を解析した後に使用するコードを判断させる。具体的には、被検証プログラムコード103を使用するのか、又は、テンプレート適用データ104から生成したプログラムコードを使用するのかを判断する。被検証プログラムコード使用判断ブロック105が被検証プログラムコード103を使用すると判断した場合には、動作制御ブロック102は、被検証プログラムコード103をコード縮小ブロック107に入力する。コード縮小ブロック107は、コード縮小を行ったプログラムコード断片を出力する。その後、動作制御ブロック102は、当該プログラムコード断片を、言語変換ブロック108に入力して検証用プログラム109の断片を作成する。
The
一方、テンプレート適用データ104を使用する場合には、動作制御ブロック102は、テンプレート適用データ104をテンプレートコード生成ブロック106に入力して検証用プログラム109の断片を作成する。モデル検証プログラム110を実行するのに必要な全ての検証用プログラム109の断片を作成した後、動作制御ブロック102は、検証用プログラム109をモデル検証プログラム110に入力し、検証結果111を作成、取得し、当該検証結果をユーザーに報知する。
On the other hand, when the
<ハードウェア構成>
次に、図2に、本提案のプログラム検証装置を構成するハードウェアブロック図を示す。情報処理装置201は、ユーザーの作成したプログラムの検証を行う装置である。情報処理装置201は、本体部202、表示装置203、キーボード204、及びマウス205を備える。また、本体部202は、中央処理装置206、主記憶装置207、及びハードディスク208を備える。図1に示したモデル検証プログラム110及びプログラム検証装置用プログラム100は、ハードディスク208に格納されており、実行時には主記憶装置207にロードされ、中央処理装置(CPU)206によって実行される。
<Hardware configuration>
Next, FIG. 2 shows a hardware block diagram of the proposed program verification apparatus. The
<プログラム例>
次に、図4を参照して、本実施形態で説明する被検証プログラムコード103と、モデル検証プログラム110としてSPINを用いる場合の検証用プログラム109との一例について説明する。本実施形態では、図4Aに示すC言語の被検証プログラムコードを一般的なコンパイラで、図4Bに示すように、3番地コード化した上でプログラム検証作業を行う。また、本実施形態では、図4BのtargetSub関数の4行目の配列アクセス(data[i]=0;)についての配列外参照について説明する。図4BのBIT_FIELD_REF<xx,y,z>は、xx変数のzbit目からybitだけのデータを示す。
<Program example>
Next, an example of the
図4Cは、上記配列外参照についてプログラム検証プログラム101の作成した検証式データである。検証式には、図4Cに示すように、関数名と、当該関数内における行番号と、当該行番号における検証内容(検証式)とが含まれる。図4Cでは、1つの検証式のみが例示されているが、複数の検証式が予め定義されてもよい。また、図4Dは、比較例となる検証用プログラム109を全て被検証プログラムコード103から作成した場合の検証プログラムを示す。図4Fは、updatePaperPa関数について被検証プログラムコード103ではなく、テンプレート適用データ104から生成した検証用プログラム109を示す。
FIG. 4C shows verification formula data created by the
図4Eは、updatePaperPap関数についてのテンプレート適用データである。図4EはXML形式でプログラム動作中に値が変化する変数を定義している。本実施形態ではvolatileMemoryタグは、プログラム動作中に値が変化する変数の定義に用いられるタグである。nameOfSymbolは上記変数の名称の記述例である。SettleFuncは上記変数を定義する関数名の記述例である。updateIntervalは上記関数を指定回数呼び出した場合に変数が更新される間隔を定義する場合の記述例である。即ち、図4Eにおいては、sensor.papはupdateSensorPapが10回呼び出される毎に、いずれかの値に変化する変数であることを示す。 FIG. 4E shows template application data for the updatePaperPap function. FIG. 4E defines a variable whose value changes during the program operation in the XML format. In this embodiment, the volumeMemory tag is a tag used for defining a variable whose value changes during a program operation. nameOfSymbol is a description example of the name of the variable. SettleFunc is a description example of a function name that defines the variable. updateInterval is a description example for defining an interval at which a variable is updated when the above function is called a specified number of times. That is, in FIG. pap is a variable that changes to any value every time updateSensorPap is called 10 times.
<処理フロー>
次に、図3A及び図3Bを参照して、本実施形態のプログラム検証における処理フローについて説明する。本実施形態では、targetSub関数内の配列外参照(data[i]=0;)を検証するケースについて説明する。以下で説明する処理は、中央処理装置(CPU)206が、ハードディスク208に格納されたプログラム検証プログラム101を主記憶装置207に読み出して実行することにより実現される。図3Aの300は、プログラム検証の全体フローを示す。図3Bの310は、フローチャート300内のS304のサブフローチャートを示す。図3Bの320は、フローチャート300のS305内のサブフローチャートを示す。
<Processing flow>
Next, with reference to FIG. 3A and FIG. 3B, the processing flow in the program verification of this embodiment is demonstrated. In this embodiment, a case will be described in which an out-of-array reference (data [i] = 0;) in the targetSub function is verified. The processing described below is realized by the central processing unit (CPU) 206 reading out the
S301、S302において、CPU206は、図4Aに示す被検証プログラムコード103と、図4Eに示すテンプレート適用データ104とを読み出し、被検証プログラムコード103を解析する。途中、CPU206は、図4Bのように3番地コード化して副作用動作プログラムコードを単一動作プログラムコードに変換し、検証式と行番号の対応を簡便化することが可能である。
In S301 and S302, the
S303において、CPU206は、図4Cのような検証式リストを作成する。つまり、ここでは、被検証プログラムコード103において検証する項目を作成している。これは、例えば、ユーザ指示に基づいて行われてもよい。当該ユーザ指示については、予め定義されたリスト等から選択する形式でもよい。CPU206は、検証式リストの番号に対応する各々の検証プログラムを作成する。そのため、検証式によって、targetSubの4行目における変数iについてコード縮小ブロック107を用いて被検証プログラムコード103を縮小化し、必要な被検証プログラム断片を取得する。その結果、targetSubは、main関数から呼び出されており、グローバル変数sensor.papによって実行されるか否かの到達性が定義され、且つ、グローバル変数sensor.papは、main関数の呼び出すupdateSensorPapによって値が設定されることを理解する。
In S303, the
S304において、CPU206は、被検証プログラムコード103を使用するか否かを判断する。即ち、被検証プログラムコードをモデル検証プログラムで実行できる形式にそのまま変換した詳細な被検証プログラムに変換するか、或いは、被検証プログラムの代わりにテンプレート適用データを使用した簡易的な被検証プログラムを生成するかを判断している。本実施形態によれば、プログラムの所定単位ごと、例えば関数ごとにこの判定を行い、検証を網羅的に行うか否かを決定している。なお、判断基準としては、S303で作成した検証リストに含まれる項目が当該関数を実行することにより実行されるか否かで判断することが望ましい。S304の詳細な処理についてはフローチャート310を用いて後述する。被検証プログラムコード103を使用する場合はS306に進み、使用しない場合はS305に進む。targetSub関数及びmain関数は、図4Eのテンプレート適用データに含まれていない。updateSensorPap関数はテンプレート適用データに含まれており、10回呼び出された場合に、sensor.papをいずれかの値に設定する関数である。さらに、sensor.papは、1bit長さである。CPU206は、このように、検証対象のプログラムを理解する。したがって、targetSub関数及びmain関数については、S306に進み、updateSensorPap関数についてはS305に進む。
In step S <b> 304, the
被検証プログラムコード103を使用する場合、S306において、CPU206は、main関数とtargetSub関数については、被検証プログラムコード103を変換した上で、検証式をプログラム断片に変換して検証プログラム断片を埋め込む。一方、S305において、CPU206は、updateSensorPap関数について、テンプレート適用データ104をテンプレートコード生成ブロック106に入力してテンプレートコードを生成しS308に進む。S305の詳細については、フローチャート305を用いて後述する。
When using the
S308において、CPU206は、モデル検証プログラムへ、S305又はS306からのプログラムを入力して実行する。仮にupdateSensorPap関数をテンプレート適用データ104から生成せず、被検証プログラムコード103から生成した場合の検証用プログラム109を図4Dに示す。io.papは誰からも設定されることのない外部モデルに含まれる変数であるため、別スレッドとして、検証用プログラム断片を生成し不定性を定義する必要がある。また、updateSensorPapは、図4Bの被検証プログラムコードから変換したコードである。
In S308, the
図3Aの説明に戻る。S309において、CPU206は、検証結果111を取得し、ユーザーに提示する。これにより、検証式が不成立な場合があること等をユーザーに報知することができる。
Returning to the description of FIG. In S309, the
次に、図3Bのフローチャート310について説明する。フローチャート310はフローチャート300のS304の詳細を示す。
Next, the
まず、S3041において、CPU206は、図4Cに示す検証式に関連する被検証プログラムコードを抽出する。続いて、S3042において、CPU206は、S3041で抽出した被検証プログラムコードに図4Cに示す検証式が含まれるか否かを判定する。該当する検証式が含まれる場合はS3043に進み、含まれない場合S3045に進む。
First, in S3041, the
S3043において、CPU206は、当該検証式が被検証プログラムの制御フローにのみ関連するものであるか否かを判定する。当該検証式が被検証プログラムの制御フローにのみ関連するものであれば、S3045に進み、そうでなければS3044に進む。
In step S3043, the
S3044において、CPU206は、被検証プログラムコードを使用すると判断し、処理を終了する。一方、S3045において、CPU206は、テンプレートコードを使用する(生成する)と判断し、処理を終了する。
In step S3044, the
次に、図3Bのフローチャート320について説明する。フローチャート320はフローチャート300のS305の詳細を示す。つまり、フローチャート320は、テンプレートコード生成ブロック106の処理に相当する。
Next, the
S3051において、CPU206は、出力変数名と、ビット長さとを記憶する。続いて、S3052において、CPU206は、入力変数のビット長さを記憶する。S3053において、CPU206は、出力変数の更新頻度(10)を記憶する。S3054において、CPU206は、プログラムコード(テンプレートコード)を出力し、処理を終了する。出力されたテンプレートコードは、例えば、図4Fに示すupdateSensorPap関数のコードとなる。なお、上述のフローチャートでは、説明を容易にするため、各関数ごと検証する例を示したが、本実施形態では、各関数ごとのプログラムコードを変換又は生成し、それらを合成した被検証プログラムをモデル検証プログラム110で検証することが望ましい。
In S3051, the
図4Dと図4Fを比べると、図4Fはio.papとcnt1が不要になっていること、sensor.papを合成する論理が無くなっていることから、モデル検証プログラム110の使用メモリは削減されている。実際にSPINを用いて調べると、状態ベクタは28バイトから20バイトに削減されている。図4Aに示す被検証プログラムコードの例では、図4Dでも図4Fでもモデル検証プログラムは実行可能であったものの、実際のプログラム検証ではより複雑なアルゴリズムも存在し、その場合にもより簡単な検証プログラムを合成することが可能である。
Comparing FIG. 4D and FIG. 4F, FIG. pap and cnt1 are unnecessary, sensor. Since the logic for synthesizing the pap is lost, the memory used by the
以上説明したように、本実施形態に係る情報処理装置は、所定単位の被検証プログラムごとに、検証対象のコードを有するか(検証式に関連するプログラムであるか)否かに応じて、被検証プログラムコードを使用するか否かを切り替える。つまり、本実施形態に係る情報処理装置は、検証対象のコード、例えば、配列外参照のコードを有する場合には詳細な検証を実行し、配列外参照のコードを含まなければテンプレートコードを用いた簡易的な検証を行う。なお、本実施形態では、所定単位のプログラムを関数ごとの例で説明したが、本発明をこれに限定する意図はなく他の単位のプログラムごとに上記判定を行ってもよい。このように、本実施形態によれば、所定の検証プログラムごとに、モデル検証プログラムの利用するメモリ使用量を削減し、状態爆発を低減することが可能である。 As described above, the information processing apparatus according to the present embodiment depends on whether each verification target program has a code to be verified (whether it is a program related to a verification expression) or not. Switch whether to use verification program code. In other words, the information processing apparatus according to the present embodiment performs detailed verification when a verification target code, for example, an out-of-sequence reference code is included, and uses a template code if the out-of-sequence reference code is not included. Perform simple verification. In the present embodiment, the program of a predetermined unit has been described by an example for each function. However, the present invention is not intended to be limited to this, and the above determination may be made for each program of another unit. Thus, according to the present embodiment, it is possible to reduce the amount of memory used by the model verification program for each predetermined verification program and reduce state explosion.
<第2の実施形態>
以下では、図5乃至図6Fを参照して、本発明の第2の実施形態について説明する。本実施形態は、配列の添え字が定数ではなく変数である場合について、モデル検証プログラム110としてSPINを用いて、「配列外へのメモリアクセスは行ってはならない」などの性質についてのプログラム検証を行う場合について説明する。上記第1の実施形態では、テンプレートを適用する関数が検証式を調査するためのプログラム断片への到達性に関連するものであった。一方、本実施形態では、テンプレートを適用する関数の振る舞いが、検証式内の変数値に関連する場合で、関数の振る舞いが複数存在する場合について説明する。
<Second Embodiment>
Hereinafter, a second embodiment of the present invention will be described with reference to FIGS. 5 to 6F. In the present embodiment, when the array subscript is a variable instead of a constant, program verification is performed using SPIN as the
<プログラム例>
図6を参照して、本実施形態で説明する被検証プログラムコード103と、モデル検証プログラム110としてSPINを用いる場合の検証用プログラム109との一例について説明する。図6Aは、C言語で記述された被検証プログラムコードと併記されたコメント文601中のテンプレート適用データを示す。
<Program example>
With reference to FIG. 6, an example of the
コメント文601中における、DataAbstructionタグはデータに対する振る舞いを抽象化した例を示す。nameOfSymbolタグは上記振る舞いを抽象化したデータの変数名称を示す。本実施形態では、nameOfFuncタグの示す関数の振る舞いについて、テンプレートデータを用いて検証プログラムを生成する。
The DataAbstraction tag in the
Abstructionタグは各々のテンプレートを示す。Conditionタグは条件文を意味し、valueタグはConditionタグを満たす場合の値の定義式を記述する。1つ目のテンプレート適用データ(第1のテンプレート適用データ)は、条件式((_b&1)==1)が真の場合にはcalc_b関数の返し値がb集合要素のいずれかから256を引いた値である。一方、偽の場合にはcalc_b関数の返し値がbb集合要素のいずれかから256を引いた値であることを意味する。2つ目のテンプレート適用データ(第2のテンプレート適用データ)は、calc_b関数の返し値がbとbbの和集合の集合要素のいずれかから256を引いた値であることを意味する。 The Abstract tag indicates each template. The Condition tag means a conditional statement, and the value tag describes a value defining expression when the Condition tag is satisfied. The first template application data (first template application data) is obtained by subtracting 256 from any of the b set elements when the conditional expression ((_b & 1) == 1) is true. Value. On the other hand, if it is false, it means that the return value of the calc_b function is a value obtained by subtracting 256 from any of the bb set elements. The second template application data (second template application data) means that the return value of the calc_b function is a value obtained by subtracting 256 from one of the set elements of the union of b and bb.
本実施形態ではC言語の図6Aに示す被検証プログラムコードを一般的なコンパイラで、図6Bに示すように、3番地コード化した上でプログラム検証作業を行う。また、本実施形態では、図6Bのmain関数の5行目の配列アクセス(c[B]=(unsigned char)_b;)についての配列外参照について説明する。図6Cは、配列外参照についてプログラム検証プログラム101の作成した検証式データである。図6Dは、比較例となる検証プログラムを全て被検証プログラムコード103から作成した場合の検証プログラムを示す。図6Eは、図6Aの被検証プログラムコードに併記されたコメント文601中に記述された第1のテンプレート適用データを元にして検証プログラムコードを生成したものである。図6Fは、第2のテンプレート適用データを元にして検証用プログラム109を生成したものである。
In this embodiment, the verification program code shown in FIG. 6A in C language is converted into a 3-address code as shown in FIG. Further, in the present embodiment, an out-of-array reference for array access (c [B] = (unsigned char) _b;) in the fifth row of the main function in FIG. 6B will be described. FIG. 6C shows verification formula data created by the
<処理フロー>
次に、図5A及び図5Bを参照して、本実施形態のプログラム検証における処理フローについて説明する。以下で説明する処理は、中央処理装置(CPU)206が、ハードディスク208に格納されたプログラム検証プログラム101を主記憶装置207に読み出して実行することにより実現される。図5Aの500は、プログラム検証の全体フローを示す。図5Bの510は、フローチャート500内のS504のサブフローチャートを示す。図5Bの520は、フローチャート500のS505内のサブフローチャートを示す。
<Processing flow>
Next, with reference to FIG. 5A and FIG. 5B, the processing flow in the program verification of this embodiment is demonstrated. The processing described below is realized by the central processing unit (CPU) 206 reading out the
S501、S502において、CPU206は、図6Aに示す被検証プログラムコード103と、テンプレート適用データ104とを読み出し、被検証プログラムコード103を解析する。途中、CPU206は、図6Bのように3番地コード化して副作用動作プログラムコードを単一動作プログラムコードに変換し、検証式と行番号の対応を簡便化することが可能である。また、CPU206は、図6Aのコメント文601中に記述されるテンプレート適用データを解析し、テンプレートコード利用時の適用方法、即ち、2つのテンプレート適用データ(第1及び第2のテンプレート適用データ)を取得する。更に、CPU206は、定数配列bとbbに対する記述を解析し、定数配列、即ちb集合の要素は258,257,255で要素数は3の集合であることを理解する。さらに、bb定数配列、即ちbb集合の要素は、256,257,258で要素数が3の集合であることを理解することができる。
In S501 and S502, the
S503において、CPU206は、図6Cに示す検証式リストを作成する。さらに、CPU206は、検証式リストの番号に対応する各々の検証プログラムを作成する。そのため、検証式によって、main関数の5行目における変数Bについてコード縮小ブロック107を用いて被検証プログラムコード103の縮小化と必要最小限な被検証プログラムコード103の断片を取得する。ここで、検証式は、関数名と、行番号と、行番号における検証内容とを示すものである。その結果、変数Bはcalc_b関数の返し値であり、calc_b関数はmain関数から呼び出しされることを理解する。
In step S503, the
S504において、CPU206は、被検証プログラムコード使用判断ブロック105を用いて、被検証プログラムコード103を使用するか否かを判断する。被検証プログラムコード103を使用する場合はS506に進み、使用しない場合はS505に進む。main関数はテンプレート適用データに含まれておらず、且つ、calc_b関数及びcalc_b関数の返し値はテンプレート適用データに含まれている。なお、calc_b関数の返し値は、S503で作成した図6Cに示す検証式内に含まれているため、S506に進む。
In step S <b> 504, the
S506において、CPU206は、コード縮小ブロック107を用いて、被検証プログラムコード103のみを用いて図6Cに示す検証を行うのに必要最小限な被検証プログラム断片を作成する。さらに、モデル検証プログラムの理解できる検証用プログラム109に変換する。その後、S508において、CPU206は、動作制御ブロック102によって、検証用プログラム109をモデル検証プログラム110に入力して、S509で検証結果111を取得する。S510において、CPU206は、モデル検証プログラム110を実行した検証結果111が、状態爆発を起こしたことを示すか否かを判定する。状態爆発を起こしていることを示す場合には、S511に進み、状態爆発を起こすことなく検証を終了することができたことを示す場合には、検証結果111をユーザーに表示してプログラム検証を終了する。S511において、CPU206は、利用可能なテンプレート適用データがあるか否かを判定し、あればS505に進み、無ければ処理を終了する。
In step S <b> 506, the
S505において、CPU206は、動作制御ブロック102によって、テンプレート適用データ104の第1のテンプレートコードをテンプレートコード生成ブロック106に入力し、出力される検証用プログラム断片で検証用プログラム109を更新する。その後、S508に進み、上述したように、モデル検証プログラム110を実行し、S509で検証結果111を取得し、S510以降の処理を実行する。なお、モデル検証プログラム110を実行した際に状態爆発を発生し、結果を取得できない場合には、CPU206は、S511においてS505から検証を再度行う。また、S511で既に適用可能なテンプレート適用データが存在しないと判定すると、CPU206は、検証作業が終了しなかったことをユーザーに報知した上で、処理を終了する。
In step S <b> 505, the
次に、図5Bのフローチャート510について説明する。フローチャート510はフローチャート500のS504の詳細を示す。
Next, the
まず、S5041において、CPU206は、図6Cに示す検証式に関連する被検証プログラムコードを抽出する。続いて、S5042において、CPU206は、S5041で抽出した被検証プログラムコードに図6Cに示す検証式が含まれるか否かを判定する。該当する検証式が含まれる場合はS5043に進み、含まれない場合はS5046に進む。
First, in S5041, the
S5043において、CPU206は、当該検証式が被検証プログラムの制御フローにのみ関連するものであるか否かを判定する。当該検証式が被検証プログラムの制御フローにのみ関連するものであれば、S5045に進み、そうでなければS5044に進む。S5044において、CPU206は、プログラム検証が初回であるか否かを判定する。ここでの判定は、モデル検証プログラムを既に実行しているか否かを判定する。例えば、一度S508のモデル検証プログラムを実行して、S510で状態爆発が発生したと判断してテンプレートコードを生成してやり直した場合は、初回ではないと判定される。したがって、CPU206は、S508でモデル検証プログラムを実行した場合に、実行回数等を保持しておくようにしてもよい。初回であればS5045に進み、初回でなければS5046に進む。
In S5043, the
S5045において、CPU206は、被検証プログラムコードを使用すると判断し、処理を終了する。一方、S5046において、CPU206は、テンプレートコードを使用すると判断し、処理を終了する。
In step S5045, the
次に、図5Bのフローチャート520について説明する。フローチャート520はフローチャート500のS505の詳細を示す。つまり、フローチャート520は、テンプレートコード生成ブロック106の処理に相当する。
Next, the
S5051において、CPU206は、利用するテンプレートを選択する。ここでは、例えば、第1のテンプレート適用データ又は第2のテンプレート適用データが選択される。なお、選択方法は、予め定めれた順で選択されてもよいし、ユーザーの指示に基づくようにしてもよい。続いて、S5052において、CPU206は、出力変数名と、ビット長さとを記憶する。S5053において、CPU206は、入力変数のビット長さを記憶する。S5054において、CPU206は、出力変数の更新頻度(10)を記憶する。S5055において、CPU206は、プログラムコード(テンプレートコード)を出力する。出力されたテンプレートコードは、第1のテンプレート適用データを使用した場合、例えば、図6Eに示すコードとなる。一方、第2のテンプレート適用データを使用した場合は、図6Fに示すコードとなる。最後に、S5056において、CPU206は、利用したテンプレートを記憶して処理を終了する。
In step S5051, the
本実施形態で示した図6Aの被検証プログラムコード103は、実際には全て被検証プログラムコード103を用いても、検証プログラムは状態爆発を起こさずに配列外参照を指摘することができる。しかし、使用する状態ベクタ容量は、全ての検証プログラム断片を被検証プログラムコード103から作成した場合は48バイトとなり、第1のテンプレート適用データ104を使用した場合が20バイトとなった。また、第2のテンプレート適用データを使用した場合が16バイトと大幅に削減できており、実際には様々に複雑化する、ユーザーの作成する被検証プログラムコード103を検証するために有効である。
The
以上説明したように、本実施形態に係る情報処理装置は、モデル検証プログラムの利用するメモリ使用量を削減し、状態爆発を低減することが可能である。 As described above, the information processing apparatus according to the present embodiment can reduce the amount of memory used by the model verification program and reduce state explosion.
<その他の実施形態>
また、本発明は、以下の処理を実行することによっても実現される。即ち、上述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(又はCPUやMPU等)がプログラムを読み出して実行する処理である。
<Other embodiments>
The present invention can also be realized by executing the following processing. That is, software (program) that realizes the functions of the above-described embodiments is supplied to a system or apparatus via a network or various storage media, and a computer (or CPU, MPU, etc.) of the system or apparatus reads the program. It is a process to be executed.
Claims (13)
被検証プログラムの検証する内容を示す検証式を作成する作成手段と、
前記作成手段によって作成された検証式に関連するプログラムであるか否かを所定単位の被検証プログラムごとに判定する判定手段と、
前記判定手段によって前記検証式に関連するプログラムであると判定された前記被検証プログラムについては、該被検証プログラムの状態を網羅的に探索して検証するモデル検証プログラムを実行するためのプログラムに該被検証プログラムを変換する変換手段と、
前記判定手段によって前記検証式に関連するプログラムでないと判定された前記被検証プログラムについては、予め定義されたテンプレート適用データを用いて、前記モデル検証プログラムで実行する簡易的なプログラムを生成する生成手段と、
前記変換手段によって変換されたプログラム、及び前記生成手段によって生成されたプログラムを前記モデル検証プログラムによって検証する検証手段と
を備えることを特徴とする情報処理装置。 An information processing apparatus,
Creating means for creating a verification expression indicating the contents to be verified by the program to be verified;
Determining means for determining whether the program is related to the verification formula created by the creating means for each program to be verified in a predetermined unit;
For the program to be verified that is determined to be a program related to the verification formula by the determination means, the program for executing a model verification program that comprehensively searches and verifies the state of the program to be verified Conversion means for converting the program to be verified;
Generating means for generating a simple program to be executed by the model verification program using predefined template application data for the program to be verified determined by the determination means as not being a program related to the verification formula When,
An information processing apparatus comprising: a program converted by the conversion unit; and a verification unit that verifies the program generated by the generation unit by the model verification program.
作成手段が、被検証プログラムの検証する内容を示す検証式を作成する作成工程と、
判定手段が、前記作成工程において作成された検証式に関連するプログラムであるか否かを所定単位の被検証プログラムごとに判定する判定工程と、
変換手段が、前記判定工程において前記検証式に関連するプログラムであると判定された前記被検証プログラムについては、該被検証プログラムの状態を網羅的に探索して検証するモデル検証プログラムを実行するためのプログラムに該被検証プログラムを変換する変換工程と、
生成手段が、前記判定工程において前記検証式に関連するプログラムでないと判定された前記被検証プログラムについては、予め定義されたテンプレート適用データを用いて、前記モデル検証プログラムで実行する簡易的なプログラムを生成する生成工程と、
検証手段が、前記変換工程において変換されたプログラム、及び前記生成工程において生成されたプログラムを前記モデル検証プログラムによって検証する検証工程と
を実行することを特徴とする情報処理装置の制御方法。 A method for controlling an information processing apparatus,
A creating step in which the creating means creates a verification expression indicating the contents to be verified by the program to be verified;
A determination step of determining whether or not the determination means is a program related to the verification formula created in the creation step for each program to be verified;
In order to execute a model verification program in which the conversion means comprehensively searches and verifies the state of the verified program for the verified program determined to be a program related to the verification formula in the determining step A conversion step of converting the program to be verified into a program of
A simple program executed by the model verification program using the template application data defined in advance for the program to be verified that has been determined by the generation means not to be a program related to the verification formula in the determination step. A generation process to generate;
A control method for an information processing apparatus, wherein the verification means executes a program converted in the conversion step and a verification step of verifying the program generated in the generation step with the model verification program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014029959A JP2015156053A (en) | 2014-02-19 | 2014-02-19 | Information processor, its control method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014029959A JP2015156053A (en) | 2014-02-19 | 2014-02-19 | Information processor, its control method and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2015156053A true JP2015156053A (en) | 2015-08-27 |
Family
ID=54775345
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014029959A Pending JP2015156053A (en) | 2014-02-19 | 2014-02-19 | Information processor, its control method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2015156053A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014205280A (en) * | 2013-04-11 | 2014-10-30 | 三菱樹脂株式会社 | Transparent laminated film and transparent substrate |
-
2014
- 2014-02-19 JP JP2014029959A patent/JP2015156053A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014205280A (en) * | 2013-04-11 | 2014-10-30 | 三菱樹脂株式会社 | Transparent laminated film and transparent substrate |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10878086B2 (en) | Dynamic code extraction-based automatic anti analysis evasion and code logic analysis apparatus | |
WO2013058118A1 (en) | Text implication assessment device, text implication assessment method, and computer-readable recording medium | |
US8707273B2 (en) | Precondition generating apparatus | |
US20170255877A1 (en) | Heterogeneous computing method | |
CN104077265B (en) | Utilize the method for shared memory transmitting mixed messaging | |
KR102074909B1 (en) | Apparatus and method for classifying software vulnerability | |
US20130318540A1 (en) | Data flow graph processing device, data flow graph processing method, and data flow graph processing program | |
WO2020075644A1 (en) | Hyperparameter tuning method, device and program | |
US9507852B2 (en) | Techniques for discriminative dependency parsing | |
US20180025162A1 (en) | Application program analysis apparatus and method | |
US9507693B2 (en) | Method, device and computer-readable storage medium for closure testing | |
US20120150886A1 (en) | Placeholders returned for data representation items | |
US9274755B2 (en) | Infrastructure for generating code using annotation and template generators | |
US9298480B2 (en) | Programmatic editing of text files | |
Xu et al. | Empowering R with high performance computing resources for big data analytics | |
KR20210061284A (en) | System and method for dependent parsing | |
JP2015156053A (en) | Information processor, its control method and program | |
US20120291019A1 (en) | Program verification apparatus based on model verifying and storage medium | |
Luckow et al. | Symbolic pathfinder v7 | |
KR20160098794A (en) | Apparatus and method for skeleton code generation based on device program structure modeling | |
JP5530469B2 (en) | Natural language analysis processing apparatus, method, and program | |
KR20170129225A (en) | Declarative cascade reordering of styles | |
JP6937589B2 (en) | License management device, license management method, and program | |
Friedmann et al. | Ramsey-based inclusion checking for visibly pushdown automata | |
JP2009295122A (en) | Structured document processing system, structured document processing method, and structured document processing program |