WO2016121074A1 - ソフトウェア検査装置 - Google Patents

ソフトウェア検査装置 Download PDF

Info

Publication number
WO2016121074A1
WO2016121074A1 PCT/JP2015/052608 JP2015052608W WO2016121074A1 WO 2016121074 A1 WO2016121074 A1 WO 2016121074A1 JP 2015052608 W JP2015052608 W JP 2015052608W WO 2016121074 A1 WO2016121074 A1 WO 2016121074A1
Authority
WO
WIPO (PCT)
Prior art keywords
software
constraint
condition
inspection
list
Prior art date
Application number
PCT/JP2015/052608
Other languages
English (en)
French (fr)
Inventor
昌能 西
Original Assignee
株式会社日立製作所
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 株式会社日立製作所 filed Critical 株式会社日立製作所
Priority to JP2016571615A priority Critical patent/JP6469730B2/ja
Priority to US15/543,101 priority patent/US10372584B2/en
Priority to PCT/JP2015/052608 priority patent/WO2016121074A1/ja
Publication of WO2016121074A1 publication Critical patent/WO2016121074A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation

Definitions

  • the present invention relates to a technique for inspecting software.
  • model checking technique a technique for dynamically analyzing input / output relationships.
  • a software 002 model in which an output value is dynamically determined based on an input value to the software 002 and an internal state of the software 002 is constructed, and the software 002 observed as an output value string output in time series from the model. It is a method to evaluate the validity of the dynamic behavior of the. Thereby, it is searched that there exists an input value or an internal state corresponding to a defect that violates the functional requirement and the safety requirement.
  • the model checking method defines an internal state value that describes the internal state of the software 002, and uses a state transition model that implements a state transition rule corresponding to the input / output relationship of the software 002, to obtain a state transition sequence corresponding to a defect. It is a dynamic input / output relationship analysis method in the sense of discovery.
  • Patent Document 1 describes a conventional technique related to a model checking method.
  • a software inspection device 001 using a satisfiability determination function for speeding up analysis uses a state value as a bit value and performs a binary tree search at a bit level (Boolean SAT) solver and a satisfiability Modulo Theory (SMT) solver that uses background logic.
  • Boolean SAT bit level
  • SMT satisfiability Modulo Theory
  • a model checking method for a source code is effective as a means for reliably detecting a potential malfunction of the in-vehicle software 002. Since the in-vehicle software 002 calculates an internal state value sequence for an input value sequence given along a time series and outputs an output value sequence, it matches well with the characteristics of the model checking method described above. is there. Also in the ISO 26262 standard, a model checking method is requested as a means for proving that the authentication requirement of the software 002 is satisfied.
  • the solver used to solve the problem of nonlinear programming with constraints provides a function to determine whether there is a solution that satisfies the constraint equation under the range constraints for a given constraint condition and variable value. It can be judged sufficiently faster than this method.
  • Model checking problems using solvers that solve existing satisfiability determination problems can be solved in a shorter time. Therefore, the model checking method can be applied to a large-scale program.
  • Software inspection device 001 Processing flow of software inspection device 001
  • Control flow graph representation Components of partial order graphing SSA format
  • Example of partial order graphing SSA format A semi-order graph of control flow graph including recursive processing by loop expansion
  • Input value constraint / inspection condition merge
  • constraint form list generation List of constraint types Satisfiability determination problem for software 002 inspection
  • Constrained numerical optimization solver interface Program variable / solver variable conversion table
  • In-solver variable range constraint generation Derivative function generation for each constraint form Inspection conditions for overflow detection during computation
  • Output information from the constraint format converter for numerical optimization solvers Conversion from constraint form connected by logical sum to constraint form connected by logical product
  • FIG. 1 shows the internal configuration, input, and output information of the software inspection apparatus 001.
  • the software inspection apparatus 001 receives the inspection target software 002, the input value constraint condition 003 for the software 002, and the inspection condition 004 related to the software 002, and outputs an inspection condition determination result 005.
  • Software 002 uniquely determines an output value sequence based on an initial value of a program internal state value and an input value sequence received from the outside. Therefore, the input value constraint condition 003 limits the initial value of the program internal state value and the degree of freedom that the input value sequence can take, and designates a constraint condition corresponding to the precondition that the software 002 actually receives. As a result, the software 002 to which an abnormal initial value or an abnormal input value sequence is input outputs an abnormal output value sequence and naturally violates the inspection condition. It is used to solve misjudgments.
  • Software inspection apparatus 001 includes SSA (Static Single Assignment) format conversion unit 0011 with constraints, constraint format conversion unit 0012 for numerical optimization solver with constraints, numerical optimization solver 0013 with constraints, and test condition determination result output unit 0014.
  • FIG. 2 shows a processing flow of the software inspection apparatus 001.
  • the procedure is inherited from the SSA (Static Single Assignment) format, which is one of the intermediate representations of the software 002, and reduced to a satisfiability determination problem.
  • the procedure for conversion to the SSA format is a model checking method suitable when the language structure of the software 002 to be checked is mainly a procedural language. For example, when checking software 002 written in a functional language, As long as the problem is finally reduced to a satisfiability determination problem, another intermediate expression in accordance with the language structure may be used.
  • the SSA format conversion unit 0011 with constraints converts the software 002 into a parse tree, constructs a control flow graph, and converts it into an intermediate representation in SSA format. Subsequently, a branch condition included in the software 002 and a recursive execution processing unit represented by a loop are expanded and converted into a partial order graphing SSA format including only a branch condition expression and an assignment expression through an operation. Subsequently, the specified input value constraint condition 003 and the check condition 004 are merged with the partial order graphed SSA format to generate a list of the constraint format, and the check condition 004 is not included. Two of the constraint format list F1 and the constraint format list F2 including the inspection condition 004 are output.
  • FIG. 3 is an example of information input to the SSA format conversion unit 0011 with constraints.
  • procedural language software 002 can generally represent a combination of ordered arithmetic procedures, branch conditions, and recursion conditions.
  • An input value constraint condition 003 for limiting the input value x for the software 002 and an inspection condition 004 to be inspected for the return value z and the program internal state values x, y, z, and w from the inspection target software 002 are designated.
  • As the inspection condition 004 function requirements that describe behavior to be satisfied by the software 002, operation restrictions derived from safety requirements of the software 002, and the like are usually used.
  • Fig. 4 shows the control flow graph constructed by parsing the software 002.
  • the nodes constituting this graph include the components shown in FIG. That is, it is composed of a start point, an SSA allocation formula, a branch evaluation formula, a branch end formula called a phi function, and an end point.
  • the recursive processing corresponds to a special structure in which the branch path is locally a circular graph.
  • Fig. 6 shows the result of conversion to SSA format, which is converted to SSA format and reconstructed so that the execution order from the start point to the end point is the position direction.
  • a feature of the SSA format is that a new variable is set each time an operation result is stored in a program variable through an operation.
  • Fig. 7 shows a recursive execution process typified by a while loop statement, which is a semi-order graphed SSA format reconstructed by applying a technique called loop unwinding.
  • a technique called loop unwinding In the known Bounded Model check method, an upper limit value of the number of recursive executions is set for each part of a loop, and a branch condition is sequentially added for each number of recursive executions. To reduce.
  • FIG. 8 shows the detailed procedure of step 00102.
  • step 00110201 the intermediate representation of software 002 in the semi-order graph SSA format is acquired.
  • constraint form the relationship between in-program variables limited by operations, represented by SSA assignment formulas, is called a constraint form.
  • specified input value constraint condition 003 can be regarded as a constraint format for variables in the program.
  • the components are read sequentially from the start point of the program intermediate representation in the semi-ordered SSA format.
  • the evaluation formula EC is an SSA allocation formula (step 00110202)
  • an allocation formula is added to the list F.
  • the evaluation formula ED is an SSA branch evaluation formula (step 00110203)
  • only the number of demarcation destinations (Two examples will be described as an example).
  • Register each constraint type Until the branch processing ends, the constraint format corresponding to the SSA allocation expression is added to the respective constraint format lists Fp and Fq.
  • step 00100203 the constraint format list F is copied to F1 and output as a constraint format list not including the inspection condition 004.
  • step 00100204 the inspection condition 004 is converted into a constraint format, and the constraint format obtained by taking the negation logic is added to the list F, output as the constraint format F2, and the process ends.
  • the existing model checking technique is a reduction to the problem of searching for a satisfactory solution of the equation shown in FIG. Convert a variable in a program that is sequentially assigned at the time of conversion to SSA format into a bit value, use a BooleanSAT solver to search for a satisfying solution, and reduce the list of constraint formats using background logic to convert it to a bit value
  • a technique using an SMT solver that solves a satisfiability determination problem on a smaller scale than when searching for a satisfiability solution is used as a means for solving individual satisfiability determination problems.
  • the constraint format conversion unit 0012 for the numerical optimization solver receives the lists F1 and F2 of these two constraint formats and converts them into a format that can be processed by the numerical optimization solver for determining satisfiability.
  • the present invention interprets the list of constraints illustrated in FIG. 9 as a kind of simultaneous equations, and calculates the solution of the simultaneous equations numerically, so that it can be satisfied sufficiently faster than the Boolean SAT solver and the SMT solver. Is used, that is, the point that simultaneous equations can be solved.
  • Fig. 11 shows the interface of the numerical optimization solver 0013 with constraints.
  • Input information consists of objective function f, undetermined variable X, and constraint condition expression g.
  • the numerical optimization solver 0013 with constraints reports a specific allocation value when there is an allocation value X that satisfies all the constraint equations, and when there is no satisfaction solution, the numerical optimization solver 0013 Among them, a list of constraint condition expressions that could not be satisfied and a final assigned value X are reported.
  • the above-mentioned undetermined variable X includes a continuous value implemented as a floating point number and an integer value.
  • a numerical optimization solver with a constraint condition including an integer value is specially called a MINLP (Mixed Integrator Nonlinear Programming) solver.
  • fast and accurate evaluation can be performed by specifying upper and lower limit values, first-order and second-order derivatives in the constraint expression.
  • the constraint equation is not differentiable and the first-order derivative cannot be defined within the range of the inspection range, it is sufficient to divide it at discontinuous points and replace it with a constraint format that includes a branch condition.
  • the numerical optimization solver 013 with constraints in the present embodiment can determine satisfiability for a list of constraint formats connected by logical sums and logical products of a plurality of constraint formats.
  • the existing solver internally divides it into subproblems for each branch condition, and generates a problem connected only by logical product. This is because, in the worst case, the number of variables can be determined in polynomial time if it is satisfiability related to the logical product of the set constraint conditions.
  • the constraint format generated from the software 002 including the branch condition partially includes a constraint format linked by logical sum. Therefore, in this embodiment, a problem is divided for each branch condition, a plurality of problems connected by logical product and a constraint form group connected by logical sum are introduced as auxiliary variables, Two methods for rewriting the constraint form group connected by logical product are shown.
  • step 001201 a conversion table that holds the correspondence between the SSA-format program variables and the numerical optimization solver variables introduced to each element of the constraint format list is constructed.
  • An example constructed from the list of constraint formats illustrated in FIG. 9 is shown in FIG.
  • Program variables usually have a type and a range. For operations that deviate from the range, represented by the four arithmetic operations, the software 002 behaves unexpectedly, so this type is used to confirm that the range does not deviate before evaluating the inspection condition 004. Use information.
  • step 001202 the range of the undetermined variable in the interface of the constraint-optimized numerical optimization solver 0013 is derived from this type information, and the variable range constraint as illustrated in FIG. To pass.
  • step 001203 a constraint condition expression and a derivative group are generated from each component of the constraint format list using the in-program variable / solver variable conversion table constructed in step 001201.
  • the constraint format list F1 not including the check condition and the constraint format list F2 including the check condition are converted to obtain the constraint forms P1 and P2 for the numerical optimization solver.
  • step 001204 the range restriction condition of the undetermined variable X is further removed from the restriction form list P1, and the check condition for the overflow detection at the time of calculation shown in FIG.
  • FIG. 16 is an example of the constraint forms P1 and P2 for the numerical optimization solver, and shows a typical configuration when a branch condition is included in the program.
  • the constraint forms P1 and P2 for the numerical optimization solver are configured as the satisfiability determination problem divided for each branch condition and connected by logical sum.
  • the constraint form using negative logic is incorporated into the satisfiability determination problem. Therefore, it includes a logical OR of the constraint form. Since the numerical optimization solver can be processed at high speed when connected only by logical product, it needs to be converted into an expression composed of only constrained logical product. At this time, as shown in FIG. 17, some auxiliary variables may be added to the list of variables in the solver, and the constraint form connected by logical sum may be converted to the constraint form connected by logical product.
  • CNF format Conjunctive Normal Form
  • DNF form Disjunctive Normal Form
  • the inspection condition determination result output unit 0014 interprets the presence / absence of a satisfactory solution and outputs an inspection condition determination result 005.
  • the contents of the determination include the determination of whether or not to deviate from the value range defined for each type of variable in the program, represented by overflow at the time of calculation, and the inspection condition 004 under the specified input value constraint condition 003 It is to determine whether there is a program execution path that violates.
  • step 001401 it is determined whether or not the value deviates from the range defined in advance for each type of variable in the program. This step is necessary to prevent misjudgment caused by a divergence between the return value obtained as a result of the overflow of the actual program variable and the in-solver variable having no upper and lower boundary values.
  • step 001202 If there is a satisfactory solution, it means that an operation that exceeds the in-solver variable range specified in step 001202 occurs for the value that can be arbitrarily taken under the input value constraint condition 003.
  • the software 002 is a procedural language, in the process of receiving the value specified under the input value constraint 003 and proceeding with the calculation, there is always a return value for receiving the calculation result, but there is no satisfactory solution. Means things. The reason is that the constraint condition added in step 001202 cannot be satisfied, and the variable in the program corresponding to the return value does not fall within the upper and lower limits of the range defined by the specified type information. .
  • step 001402 a list of assigned values of in-solver variables at the time of the unsatisfactory determination is obtained, and assigned values of in-program variables using the in-program variable / in-solver variable conversion table constructed in step 001201 Convert back to a list of
  • Step 0051 an overflow report at the time of computation and the overflowed program variable are output and the process ends.
  • step 001401 if the evaluation result is acquired in step 001401 and there is no satisfactory solution, there is no overflow at the time of operation, the inspection range in the variable space in the solver to be inspected is linked, and depends on the value range of the program variable type It was confirmed that unintended calculation results were not invited. In this case, the process proceeds to step 001403.
  • step 001403 the evaluation result of the presence or absence of the satisfaction solution of the constraint form P2 for numerical optimization solver is acquired. If there is no satisfactory solution, report that the specified inspection condition is satisfied, and terminate.
  • step 001404 a reverse conversion is performed from the list of assigned values of in-solver variables satisfying the constraint format to the list of assigned values of in-program variables. Using this, a program execution path leading to the violation of the inspection condition 004 is generated, and it is reported as the inspection condition determination result 005 and the process is terminated.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

 ソフトウェアの不具合を検出するための手段としてモデル検査手法の有効性が知られているにも関わらず、検査に要する計算量の多さのため、大規模なソフトウェアを扱えない。 ソフトウェアのモデル検査問題を充足可能性判定問題に帰着させた上で、制約条件付き通知最適化問題を解く為に用いられるソルバが前記問題を解ける形に変換して、数値解析的に充足可能性を判定する。

Description

ソフトウェア検査装置
 本発明は、ソフトウェアを検査する技術に関する。
  近年、モデル検査手法と呼ばれる入出力関係を動的に解析する手法が効果的であることが知られるようになってきた。モデル検査手法は、ソフトウェア002に対する入力値とソフトウェア002の内部状態により出力値が動的に決定されるソフトウェア002モデルを構築し、モデルから時系列に出力される出力値列として観察されるソフトウェア002の動的挙動の妥当性を評価する手法である。これにより、機能要件および安全性要件に違反する不具合に相当する入力値または内部状態が存在することを探索する。
 モデル検査手法は、ソフトウェア002の内部状態を記述する内部状態値を定義し、ソフトウェア002の入出力関係に対応する状態遷移規則を実装した状態遷移モデルを用いて、不具合に相当する状態遷移列を発見するという意味で、動的な入出力関係解析手法である。下記特許文献1は、モデル検査手法に係る従来技術を記載している。
 特に、解析の高速化の為に、充足可能性判定機能を用いたソフトウェア検査装置001が開示されている。状態値をビット値化し、ビットレベルで二分木探索をする(Boolean SAT)ソルバと、背景論理を用いた充足可能性をするSMT(Satisfiability Modulo Theory)ソルバを用いる方法が知られている。
特開2012-155517号公報 実際、ソースコードを対象としたモデル検査手法が、車載ソフトウェア002の潜在的不具合を確実に検出する手段として有効である。車載ソフトウェア002は、時系列に沿って与えられる入力値列に対して内部状態値列を演算し、出力値列を出力するものであるため、上述のモデル検査手法の特性とよく合致するからである。ISO26262規格においてもソフトウェア002の認証要件を満たすことを証明する手段としてモデル検査手法を要請するようになっている。
 モデル検査手法の有効性が知られているにも関わらず、解析に要する計算量の多さのため、大規模なソフトウェア002を扱えないという課題がある。また、単純な四則演算よりも著しく複雑な演算をするプログラムを含む信号処理は制御ソフトウェア002等でも同様の課題に直面している。状態値をビット値化する方式では、状態値の数が増えてしまい、拡張性を損なっている。また状態値は通常はビット値ではなく数バイト単位の定型データであり、二分木探索をしたとしても効率が悪い。この点を解決するために提案されたSMTソルバを用いた方式であっても、背景論理として定義されていないプログラム処理部は扱えず、さらに実質的に、解析に要する計算量の削減効果が見込めない場合もある。
  ソフトウェア002のモデル検査問題を充足可能性判定問題に帰着させた上で、数値解析的に充足可能性を判定する方法が有効である。制約条件付き非線形計画法の問題を解く為に用いられるソルバは、所与の制約条件及び変数値に対する値域制約の元で、制約条件式を充足する解の有無を判定する機能を提供し、既存の方式よりも十分に高速に判定出来る。
 既存の充足可能性判定問題を解くソルバを用いたモデル検査問題を、より短時間で解けるようになる。その為、大規模なプログラムに対してモデル検査手法を適用出来るようになる。
ソフトウェア検査装置001 ソフトウェア検査装置001の処理フロー 入力値制約条件003、ソフトウェア002、検査条件の例 制御フローグラフ表現 半順序グラフ化SSA形式の構成要素 半順序グラフ化SSA形式の例 ループ展開による再帰処理を含む制御フローグラフの半順序グラフ化 入力値制約・検査条件併合、制約形式のリスト生成 制約形式のリスト ソフトウェア002検査に用いる充足可能性判定問題 制約条件付き数値最適化ソルバのインターフェース プログラム内変数/ソルバ内変数変換テーブル  ソルバ内変数値域制約生成 制約形式毎の導関数式生成 演算時オーバーフロー検出用の検査条件 数値最適化ソルバ用制約形式変換部からの出力情報 論理和で連結した制約形式から論理積で連結した制約形式への変換
 本発明を実現する具体的な手順を以下に開示する。
<実施の形態>
 図1はソフトウェア検査装置001内部の構成、入力、および出力情報を示す。
 ソフトウェア検査装置001は、検査対象のソフトウェア002、前記ソフトウェア002に対する入力値制約条件003、および前記ソフトウェア002に関する検査条件004を入力として、検査条件判定結果005を出力する。
 ソフトウェア002は、プログラム内部状態値の初期値、および外部から受けとる入力値列により、一意に出力値列を決定するものである。その為、入力値制約条件003は、プログラム内部状態値の初期値、および入力値列の取りうる自由度を制限し、実際にソフトウェア002が受け取るとした前提条件に相当する制約条件を指定する。この事により、異常な初期値や異常な入力値列を入力された前記ソフトウェア002が、異常な出力値列を出力して、当然の帰結として前記検査条件に違反するといった、ソフトウェア検査装置001の誤判定を解決する為に用いるものである。
 ソフトウェア検査装置001は、制約条件付きSSA(Static Single Assignment)形式変換部0011、制約条件付き数値最適化ソルバ用制約形式変換部0012、制約条件付き数値最適化ソルバ0013、および検査条件判定結果出力部0014で構成される。
図2は、ソフトウェア検査装置001の処理フローを示す。
  本実施例では、既存手法との構成上の差異が、主として充足可能性判定問題の解法にあることを明確にするために、Bounded Model Checkingとして知られている既存のモデル検査手法において通常用いられる手順であって、ソフトウェア002の中間表現の一つであるSSA(Static Single Assignment)形式を経て充足可能性判定問題に還元する手順を継承する。SSA形式に変換する手順は、検査対象のソフトウェア002の言語構造が主として手続き型言語である場合に適したモデル検査手法であり、一例として関数型言語で記述されたソフトウェア002を検査する場合には、最終的に充足可能性判定問題に還元される限りは、言語構造に即した別の中間表現を用いてもよい。
  制約条件付きSSA形式変換部0011は、ソフトウェア002をパースツリーに変換し、制御フローグラフを構築した上でSSA形式の中間表現に変換する。続いて、ソフトウェア002に含まれる分岐条件、及びループに代表される再帰実行処理部を展開して、分岐条件式および演算を通じた割り当て式のみで構成される半順序グラフ化SSA形式に変換するステップ001101、続いて、前記半順序グラフ化SSA形式に対して、指定した入力値制約条件003と検査条件004を併合して、制約形式のリストを生成するステップ001102を経て、検査条件004を含まない制約形式のリストF1と、検査条件004を含む制約形式のリストF2の二つを出力する。
 この手順は既知の手法ではあるものの、本発明の適用を容易にする為、変換過程の具体的な例を図3から図7にて示す。
 図3は、制約条件付きSSA形式変換部0011に入力する情報の例である。
構造化プログラム定理の為、一般的に手続き型言語のソフトウェア002は、順序付けられた演算手続き、分岐条件、および再帰条件を組み合わせて表現する事が出来る。ソフトウェア002に対する入力値xを限定する入力値制約条件003、および検査対象ソフトウェア002からの返り値zやプログラム内部状態値x、y、z、wについて検査したい検査条件004を指定する。検査条件004は通常、ソフトウェア002が満たすべき振る舞いを記述する機能要件や、ソフトウェア002の安全要件等から導かれる動作制約等が用いられる。
 図4は、ソフトウェア002をパースし、制御フローグラフを構築したものである。本グラフを構成するノードは、図5に示される構成要素を含む。つまり、開始地点、SSA割り当て式、分岐評価式、ファイ関数と呼称される分岐終了式、および終了地点で構成される。再帰処理は分岐経路が局所的に循環グラフとなる特殊な構造の場合に相当する。
  図6はSSA形式に変換して、開始地点から終了地点までの実行順序が位置方向となるように再構築した、半順序グラフ化SSA形式に変換した結果を示す。SSA形式の特徴は、演算を通じてプログラム内変数に演算結果を格納するたびに、新規の変数を設定していく事である。
  図7は、whileループ文に代表される再帰実行処理をする方法であって、loop unwindingと呼称される手法を適用して再構築した、半順序グラフ化SSA形式である。既知のBounded Model検査手法では、ループのある箇所毎に再帰実行する回数の上限値を設定し、再帰実行回数毎に分岐条件を逐次追加することで、図6と同様の半順序グラフ化SSA形式に還元する。
  図8は、ステップ001102の詳細な手順を示す。
  ステップ00110201 にて、半順序グラフ化SSA形式の、ソフトウェア002の中間表現を取得する。
  ここで、SSA割り当て式に代表される、演算を通じて限定されるプログラム内変数間の関係を制約形式と呼称する。指定した入力値制約条件003も同様に、プログラム内変数に対する制約形式とみなすことが出来る。
  新規に定義した空のリストFに、この入力値制約条件003に相当する制約形式を追加する。
  引き続き、前記半順序化SSA形式のプログラム中間表現の開始地点から順に構成要素を読み込む。
  評価式ECがSSA割り当て式である場合(ステップ00110202)には、割り当て式を前記リストFに追加し、評価式EDがSSA分岐評価式である場合(ステップ00110203)では、分記先の数だけ(一例として2つを例に説明する)、新規に空の制約形式のリストFp、Fqを生成して、分岐評価式が真である事を表現する制約形式、及び偽であることを表現する制約形式をそれぞれ登録する。分岐処理が終了する地点まで、それぞれの制約形式のリストFp,Fqに、SSA割り当て式に対応する制約形式を追加していく。
  分岐処理の完了時点で、前記制約形式のリストFに、F1とF2の論理和をとった制約形式(Fp||Fq)を追加し、ファイ関数と呼称されるSSA分岐終了式を追加する。終了地点出ない限りは本手続きを継続して、制約形式のリストFを更新する。
  終了時点に到達したら、ステップ00110203にて、制約形式のリストFをコピーしてF1とし、検査条件004を含まない制約形式のリストとして出力する。続いてステップ00110204では、検査条件004を制約形式に変換し、これの否定論理をとった前記制約形式を、リストFに追加して、制約形式F2として出力して終了する。
  図6にて例示した半順序グラフ化SSA形式から生成された制約形式のリストであって、検査条件を含むものは、図9に開示される通りである。
  なお、既存のモデル検査手法は、図10に示される式の充足解を探索する問題に還元させるものである。SSA形式に変換した時点で逐次割り当てされたプログラム内変数をビット値化して、充足解を探索するBooleanSATソルバを用いる方法、および背景論理を用いて制約形式のリストを縮約して、ビット値化して充足解を探索する場合よりは小規模な充足可能性判定問題を解くSMTソルバを用いる手法が、個の充足可能性判定問題を解く手段として用いられている。
  図2に戻り、ソフトウェア検査装置001の処理フローの説明を続ける。
  数値最適化ソルバ用制約形式変換部0012は、この二つの制約形式のリストF1とF2を受け取り、充足可能性判定をする数値最適化ソルバが処理できる形式に変換する。
  本発明は、図9に例示した制約条件のリストを一種の連立方程式と捉え直し、連立方程式の解を数値的に算出することで、BooleanSATソルバおよびSMTソルバよりも十分に高速に、充足可能性を判定する、つまり連立方程式を解ける点を活用したものである。
  図11は、制約条件付き数値最適化ソルバ0013のインターフェースを示す。
  入力情報は、目的関数f、未定変数X、および制約条件式gで構成される。
  制約条件付き数値最適化ソルバ0013は、すべての制約条件式を充足する割り当て値Xがある場合には、具体的な割り当て値を報告し、充足解が無い場合には、前記制約条件式gの内、充足不能にであった制約条件式のリストと、最終的な割り当て値Xを報告する。
  前記の未定変数Xは、浮動小数点数等で実装される連続値と、整数値を含む。整数値を含む制約条件付き数値最適化ソルバは、特別にMINLP(MixedIntegerNonlinear Programming)ソルバと呼称されている。
 目的関数fの引数となる未定変数それぞれに関する一階導関数を用いることで、高速かつ正確な評価が出来るようになる。自動微分手法及び局所数値微分等の手法で、厳密な一階導関数の指定を必要としないソルバもあるが、評価時間の短縮のためには、一階導関数を指定する事が望ましい。同様に、充足解が無い場合には無い事を保証する為に、未定変数には上下限の値域制約を付加して、評価範囲を有界にする。
 同様に、制約条件式にも上下限値、1階および2階導関数を指定する事で、高速かつ正確な評価をする事が出来る。
 前記制約条件式が微分可能でなく、検査範囲とした値域内で一階導関数が定義出来ない場合には、不連続になる点で分割し、分岐条件を含む制約形式に置換すればよい。
 本実施例における制約条件付き数値最適化ソルバ013は、一般的には、複数の制約形式の論理和、及び論理積で連結した制約形式のリストに対して充足可能性を判定出来る。しかし、本質的に組み合わせ複雑性を持ち、これを効率的に処理する方法は確立していない。既存のソルバは、内部で分岐条件毎に部分問題に分割し、論理積だけで連結した問題を生成している。これは、設定した制約条件式の論理積に関する充足可能性であれば、最悪でも変数の数に対して多項式時間で判定出来るためである。
  実際、図9に例示される通り、分岐条件を含むソフトウェア002から生成した制約形式は、論理和で連結した制約形式を一部に含む。そこで、本実施例では、分岐条件毎に問題を分割して、論理積で連結された複数の問題を生成する方法と、論理和で連結された制約形式群を、補助変数を導入して、論理積で連結した制約形式群に書き換える二つの方法を示しておく。
  このソルバ0013のインターフェースに合致するように、制約形式のリストF1,およびF2を変換する。
  ステップ001201では、制約形式のリストの各要素に導入された、SSA形式のプログラム内変数と数値最適化ソルバ内変数の対応関係を保持する変換テーブルを構築する。図9に例示した制約形式のリストから構築した例が、図12に示されている。
  プログラム内変数は通常、型と値域を持つ。四則演算に代表される、値域を逸脱するような演算に対しては、ソフトウェア002は予期しない振る舞いをするため、検査条件004を評価する前に、値域を逸脱しない事を確認するためにこの型情報を用いる。
  ステップ001202では、この型情報から制約条件付き数値最適化ソルバ0013のインターフェース内未定変数の値域を導きだし、図13に例示されるような変数値域制約を設定して制約条件付き数値最適化ソルバ0013に渡す。
  同様に、ステップ001203では、制約形式のリストの各構成要素から、ステップ001201で構築したプログラム内変数/ソルバ内変数変換テーブルを用いて、制約条件式の生成、および導関数群を生成する。
  検査条件を含まない制約形式のリストF1と検査条件を含む制約形式のリストF2それぞれを変換して、数値最適化ソルバ用制約形式P1,およびP2を得る。
  ステップ001204では制約形式のリストP1に対してさらに、未定変数Xの値域制約条件を外し、図15に示した演算時オーバーフロー検出用の検査条件をする。
  図16は、数値最適化ソルバ用制約形式P1,およびP2の一例であって、プログラム内に分岐条件を含む場合の典型的な構成を示す。前記数値最適化ソルバ用制約形式P1,P2は、分岐条件毎に充足可能性判定問題を分割して論理和で連結したものとして構成される。
  この個々の数値最適化ソルバ用制約形式P1-1~P1-X,P2-1~P2-Yを並列実行が他計算機で評価して、いずれか一つ以上の制約形式の充足解があるか否かを判定する。
  また、前述の演算時オーバーフロー検出用の検査条件に例示されるように、複数の制約形式を論理積で結合した検査条件を用いる場合、否定論理をとった制約形式が充足可能性判定問題に組み込まれる為、制約形式の論理和を含む。数値最適化ソルバは論理積だけで連結された場合には高速に処理出来るため、制約形式の論理積だけで構成される式に変換する必要がある。この際、図17に示されるように、いくつかの補助変数をソルバ内変数のリストに追加して、論理和で連結した制約形式を、論理積で連結した制約形式に変換すればよい。複数の制約形式の論理和をとった制約形式を論理積で結合した形式は、CNF形式(Conjunctive Normal Form)と呼称されている。複数の制約形式の論理積をとった制約形式を論理和で結合した形式はDNF形式(Disjunctive Normal Form)と呼称されている。多数の制約形式を任意に論理和・論理積・否定論理で連結したものは、機械的にCNF形式およびDNF形式に変換できる事が知られている。
  数値最適化ソルバ用制約形式P1,およびP2をソルバ0013に渡し、充足可能性を評価する。検査条件判定結果出力部0014は、充足解の有無とその解釈をして、検査条件判定結果005を出力する。
  判定内容は、演算時オーバーフローに代表される、プログラム内変数の型毎に定義された値域を逸脱する場合の有無を判定する事、および指定の入力値制約条件003の下で、検査条件004に違反するようなプログラム実行経路の有無を判定する事である。
 ステップ001401では、事前にプログラム内変数の型毎に定義された値域を逸脱する場合の有無を判定する。このステップは、実際のプログラム変数に対する演算時オーバーフローの結果得られる返り値と、上下限境界値がないソルバ内変数との間で乖離する事に起因した誤判定を防ぐために必要である。
  充足解がある場合は、入力値制約条件003の元で任意に取りうる値に対し、ステップ001202で指定したソルバ内変数値域を超える演算が起こる事を意味する。
  ソフトウェア002が手続き型言語である為に、入力値制約条件003の元で指定された値を受け取って演算を進める過程で、演算結果を受け取る返り値は必ず存在するにも関わらず充足解が無い事を意味する。その原因は、ステップ001202で追加した制約条件が充足できない事であり、返り値に対応するプログラム内変数が、指定の型情報により限定される値域の上下限値の範囲内に収まらないためである。
  この場合、ステップ001402に進み、充足不能判定時点でのソルバ内変数の割り当て値のリストを取得し、ステップ001201出構築したプログラム内変数/ソルバ内変数変換テーブルを用いて、プログラム内変数の割り当て値のリストに逆変換する。
  この逆変換の過程で、ステップ001202で指定した値域を逸脱するプログラム変数の位置を特定する。最後に、ステップ0051に進み、演算時オーバーフローの報告およびオーバーフローした前記プログラム内変数を出力して終了する。
  一方、ステップ001401で評価結果を取得し、充足解が無い場合には、演算時オーバーフローがなく、検査対象のソルバ内変数空間内の検査範囲が連結しており、プログラム変数の型の値域に依存した意図しない演算結果を招かない事が確認された。この場合には、ステップ001403に進む。
  ステップ001403では数値最適化ソルバ用制約形式P2の充足解の有無の評価結果を取得する。充足解が無い場合は、指定の検査条件を満たすことを報告して終了する。
  一方、充足解がある場合には、背理法により、入力値制約条件003で限定したソフトウェア002への入力値であって、検査条件004に違反する不正な入力値が存在する事を意味する。この場合にはステップ001404に進み、同様に、制約形式を満たすソルバ内変数の割り当て値のリストから、プログラム内変数の割り当て値のリストに逆変換する。これを用いて、検査条件004の違反に到るプログラム実行経路を生成し、検査条件判定結果005として報告して終了する。
 001 ソフトウェア検査装置001
 002 ソフトウェア002
 003 入力値制約条件003
 004 検査条件
 005 検査条件判定結果
 0011 制約条件付きSSA形式変換部
 0012 制約条件付き数値最適化ソルバ用制約形式変換部
 0013 制約条件付き数値最適化ソルバ
 0014 検査条件判定結果出力部

Claims (3)

  1.  検査対象のソフトウェアと、前記ソフトウェアへの入力値の検査範囲とする入力値制約条件と、ソフトウェアが満たすべき要件を指定する検査条件と、を入力値として受け取り、該入力値に基づいてソフトウェアを検査し、検査条件判定結果を出力するソフトウェア検査装置であって、
     制約条件付き最適化ソルバを用いた充足可能性判定により前記ソフトウェアの検査を実行するソフトウェア検査装置。
  2.  前記ソルバは、
     前記入力値制約条件の範囲でのプログラム実行過程で演算時オーバーフローが発生する場合には、オーバーフローを招く演算箇所を出力する機能と、
     前記検査条件に違反する不正な入力値がある場合には、前記検査条件違反を導くプログラム実行経路を出力する機能と、を有する請求項1に記載のソフトウェア検査装置。
  3.  前記ソフトウェアを制約条件付き半順序グラフ化SSA形式に変換し、さらに前記入力値制約条件と前記検査条件を併合して制約形式のリストを生成する機能と、
     前記制約形式のリストから、値域制約付き制約条件式のリストおよび前記制約条件式の一階及び二階導関数式を生成する機能と、
     前記制約条件付き数値最適化ソルバからの出力値を、演算時オーバーフローの発生有無の報告、および前記検査条件の判定結果の報告に変換する機能と、
     備える事を特徴とする請求項2に記載のソフトウェア検査装置。
PCT/JP2015/052608 2015-01-30 2015-01-30 ソフトウェア検査装置 WO2016121074A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2016571615A JP6469730B2 (ja) 2015-01-30 2015-01-30 ソフトウェア検査装置
US15/543,101 US10372584B2 (en) 2015-01-30 2015-01-30 Software inspection apparatus
PCT/JP2015/052608 WO2016121074A1 (ja) 2015-01-30 2015-01-30 ソフトウェア検査装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2015/052608 WO2016121074A1 (ja) 2015-01-30 2015-01-30 ソフトウェア検査装置

Publications (1)

Publication Number Publication Date
WO2016121074A1 true WO2016121074A1 (ja) 2016-08-04

Family

ID=56542725

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2015/052608 WO2016121074A1 (ja) 2015-01-30 2015-01-30 ソフトウェア検査装置

Country Status (3)

Country Link
US (1) US10372584B2 (ja)
JP (1) JP6469730B2 (ja)
WO (1) WO2016121074A1 (ja)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018205969A (ja) * 2017-06-01 2018-12-27 富士通株式会社 情報処理プログラム、情報処理装置及び情報処理方法
JP2020038482A (ja) * 2018-09-04 2020-03-12 富士通株式会社 プログラム検証プログラム、プログラム検証方法およびプログラム検証装置
US11907710B2 (en) 2019-11-01 2024-02-20 Mitsubishi Electric Corporation Source code analysis apparatus

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10884721B2 (en) * 2018-05-08 2021-01-05 Autodesk, Inc. Branch objects for dependent optimization problems
US10977111B2 (en) 2018-08-28 2021-04-13 Amazon Technologies, Inc. Constraint solver execution service and infrastructure therefor
WO2020046981A1 (en) * 2018-08-28 2020-03-05 Amazon Technologies, Inc. Automated code verification service and infrastructure therefor
US10664379B2 (en) 2018-09-05 2020-05-26 Amazon Technologies, Inc. Automated software verification service
EP3912104A1 (en) * 2019-01-14 2021-11-24 HRL Laboratories, LLC Solving based introspection to augment the training of reinforcement learning agents for control and planning on robots and autonomous vehicles
US11074167B2 (en) 2019-03-25 2021-07-27 Aurora Labs Ltd. Visualization of code execution through line-of-code behavior and relation models

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090265692A1 (en) * 2008-04-21 2009-10-22 Microsoft Corporation Active property checking
US20110184705A1 (en) * 2010-01-26 2011-07-28 Nec Laboratories America, Inc. Dpll-based sat solver using with application-aware branching

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6745160B1 (en) * 1999-10-08 2004-06-01 Nec Corporation Verification of scheduling in the presence of loops using uninterpreted symbolic simulation
US7089542B2 (en) * 2002-12-13 2006-08-08 International Business Machines Corporation Method and apparatus for finding errors in software programs using satisfiability of constraints
US8275729B2 (en) * 2006-05-19 2012-09-25 GM Global Technology Operations LLC Verification of linear hybrid automaton
US7596534B2 (en) * 2006-06-15 2009-09-29 Microsoft Corporation Computer implemented methods for solving difference and non-difference linear constraints
US8176496B2 (en) * 2007-10-02 2012-05-08 Nec Laboratories America, Inc. Partial order reduction using guarded independence relations
US8209646B2 (en) * 2007-11-02 2012-06-26 Hewlett-Packard Development Company, L.P. Apparatus and method for analyzing source code using path analysis and Boolean satisfiability
US20110113285A1 (en) * 2009-11-10 2011-05-12 Internationals Business Machines Corporation System and method for debugging memory consistency models
US8381199B2 (en) * 2010-10-19 2013-02-19 International Business Machines Corporation Modular and/or demand-driven string analysis of a computer program
US20120151271A1 (en) * 2010-12-10 2012-06-14 Nec Laboratories America, Inc. Mat-reduced symbolic analysis
JP5396406B2 (ja) 2011-01-26 2014-01-22 国立大学法人九州大学 モデル検査装置、モデル検査方法およびモデル検査プログラム
US20130283101A1 (en) * 2012-04-18 2013-10-24 The Regents Of The University Of Michigan Trace-Driven Verification of Multithreaded Programs Using SMT-Based Analysis
US9141354B2 (en) * 2012-04-23 2015-09-22 Ecole polytechnique fédérale de Lausanne (EPFL) Advantageous state merging during symbolic analysis
US8856751B2 (en) * 2012-09-20 2014-10-07 Fujitsu Limited Abstract symbolic execution for scaling symbolic execution generation and automatic test generation
US20140278559A1 (en) * 2013-03-13 2014-09-18 International Business Machines Corporation Adjudication platform compliance management
US9753484B1 (en) * 2014-06-10 2017-09-05 The United States Of America As Represented By The Director Of The National Security Agency Satisfiability filter and query tool and method of building a satisfiability filter and query tool
US9436582B1 (en) * 2015-11-18 2016-09-06 International Business Machines Corporation Calculating an immediate parent assertion statement for program verification

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090265692A1 (en) * 2008-04-21 2009-10-22 Microsoft Corporation Active property checking
US20110184705A1 (en) * 2010-01-26 2011-07-28 Nec Laboratories America, Inc. Dpll-based sat solver using with application-aware branching

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KAZUHIRO YAMATO: "GDB de Application Trouble no Gen'in o Chosa", NIKKEI LINUX, vol. 12, no. 6, 8 May 2010 (2010-05-08), pages 139 - 148, ISSN: 1345-0182 *
TATSUHIRO TSUCHIYA: "Model Checking that Uses Satisfiability Solving", COMPUTER SOFTWARE, vol. 29, no. 1, 26 January 2012 (2012-01-26), pages 19 - 29, ISSN: 0289-6540 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018205969A (ja) * 2017-06-01 2018-12-27 富士通株式会社 情報処理プログラム、情報処理装置及び情報処理方法
JP2020038482A (ja) * 2018-09-04 2020-03-12 富士通株式会社 プログラム検証プログラム、プログラム検証方法およびプログラム検証装置
JP7111967B2 (ja) 2018-09-04 2022-08-03 富士通株式会社 プログラム検証プログラム、プログラム検証方法およびプログラム検証装置
US11907710B2 (en) 2019-11-01 2024-02-20 Mitsubishi Electric Corporation Source code analysis apparatus

Also Published As

Publication number Publication date
US20170364432A1 (en) 2017-12-21
JP6469730B2 (ja) 2019-02-13
JPWO2016121074A1 (ja) 2017-10-05
US10372584B2 (en) 2019-08-06

Similar Documents

Publication Publication Date Title
JP6469730B2 (ja) ソフトウェア検査装置
CN110633206B (zh) 用于基于等价类分析的基于自动化要求的测试用例生成的系统和方法
US10235277B2 (en) Method of detecting false test alarms using test step failure analysis
US9639450B2 (en) Scalable methods for analyzing formalized requirements and localizing errors
US9043746B2 (en) Conducting verification in event processing applications using formal methods
Mhenni et al. Safety analysis integration in a SysML-based complex system design process
CN111176991A (zh) 一种嵌入式软件接口用例自动化生成方法
KR102114547B1 (ko) 대상 프로그램에 포함된 대상 함수를 테스트하는 방법 및 장치
Asplund et al. Tool integration beyond Wasserman
US9646252B2 (en) Template clauses based SAT techniques
Altinger et al. On error-class distribution in automotive model-based software
Wu et al. Verified decision procedures for modal logics
Gu et al. A qualitative safety analysis method for AADL model
US10394688B2 (en) Method for detecting computer module testability problems
Boussif et al. Fault diagnosis of discrete-event systems based on the symbolic observation graph
WO2019142266A1 (ja) テストケース生成装置、テストケース生成方法およびテストケース生成プログラム
WO2022196219A1 (ja) プログラム分析装置、プログラム分析方法およびトレース処理追加装置
Ranville et al. How to Meet Compliance to Software Architecture Design Principles
Wu et al. Defining a test coverage criterion for model-level testing of FBD programs
Song et al. On reachability analysis of pushdown systems with transductions: Application to Boolean programs with call-by-reference
Havelund et al. Monitorability for Runtime Verification
Ozekbay Designing artificial intelligence for deep software testing using the method of Model Checking
Reger et al. Testing a Saturation-Based Theorem Prover: Experiences and Challenges (Extended Version)
Leitner-Fischer et al. Towards Causality Checking for Complex System Models
JP2020004036A (ja) ソースコード生成装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15879971

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2016571615

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 15543101

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15879971

Country of ref document: EP

Kind code of ref document: A1