JP5550578B2 - Entry rewriting device and entry rewriting program - Google Patents

Entry rewriting device and entry rewriting program Download PDF

Info

Publication number
JP5550578B2
JP5550578B2 JP2011023430A JP2011023430A JP5550578B2 JP 5550578 B2 JP5550578 B2 JP 5550578B2 JP 2011023430 A JP2011023430 A JP 2011023430A JP 2011023430 A JP2011023430 A JP 2011023430A JP 5550578 B2 JP5550578 B2 JP 5550578B2
Authority
JP
Japan
Prior art keywords
shared library
jump
entry
api
unit
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.)
Expired - Fee Related
Application number
JP2011023430A
Other languages
Japanese (ja)
Other versions
JP2012164098A (en
Inventor
薫 鶴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2011023430A priority Critical patent/JP5550578B2/en
Publication of JP2012164098A publication Critical patent/JP2012164098A/en
Application granted granted Critical
Publication of JP5550578B2 publication Critical patent/JP5550578B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

この発明は、共有ライブラリAPIのエントリと、カーネル飛び込み用システムコールのエントリとを書き換えるエントリ書換装置及びエントリ書換プログラムに関する。   The present invention relates to an entry rewriting device and an entry rewriting program for rewriting a shared library API entry and a kernel jump system call entry.

情報システムの検証・試験においては、情報システムを構成するプログラム群が、「各種ライブラリ群、及びOS、ハードウェア」のエラーを含む各種動作に対して、設計通りに正しく動作するかを実際に動作させて検証し、正しく処理が行われているかを各種トレース情報を取得して検証する必要がある。しかし、検証を行う為に、「各種ライブラリ群、OS、ハードウェア」のエラーを模擬したり、トレース情報を取得したりするのは、一般に困難である。従来では、特許文献1、特許文献2に示すように、OSやハードウェアのエラーを模擬する為に、特定のドライバインターフェース、もしくは、OSのシステムコールをフックして、OSやハードウェアのエラー情報を注入して模擬する手法がある(トレース情報の取得も同様の手法で可能)。   In information system verification / testing, the program group that configures the information system actually operates as designed for various operations including errors of "various library groups, OS, and hardware". Therefore, it is necessary to verify by acquiring various kinds of trace information and confirming whether the processing is correctly performed. However, in order to perform verification, it is generally difficult to simulate an error of “various library groups, OS, hardware” or acquire trace information. Conventionally, as shown in Patent Document 1 and Patent Document 2, in order to simulate an OS or hardware error, a specific driver interface or OS system call is hooked to obtain OS or hardware error information. There is a method of simulating by injecting (trace information can also be acquired by the same method).

しかし、各種ライブラリ群のエラーを模擬したり、トレース情報を取得する為には、この手法は利用できない。これは、従来技術では、カーネル内(システムコール、ドライバインターフェース)に入ってからフックするので可能だったが、各種ライブラリはカーネル内ではなく、ユーザ空間にあるので、ユーザプログラムの改変なしには同様の手法が利用できないからでる。   However, this method cannot be used to simulate errors in various library groups or to acquire trace information. In the prior art, this was possible because hooking was performed after entering the kernel (system call, driver interface), but since various libraries are not in the kernel but in user space, the same is possible without modification of the user program. This is because the method cannot be used.

また、特許文献3に示すように、各種ライブラリインターフェース群のエラーを模擬する為に、ライブラリのラッパ関数を用いて、エラー情報を注入して模擬する手法がある(トレース情報の取得も同様の手法で可能)。しかし、ラッパ関数を用いる為には、対象プログラムにラッパ関数のリンクを作成する必要、即ち、対象プログラムの改変が必要であり、情報システム内の全てのプログラムを改変する必要がある。この点で、第三者提供のプログラムにはこのような改変は適用できない。   In addition, as shown in Patent Document 3, there is a method of injecting and simulating error information using a library wrapper function in order to simulate errors of various library interface groups (the same method is used for acquiring trace information). Possible). However, in order to use the wrapper function, it is necessary to create a link of the wrapper function to the target program, that is, it is necessary to modify the target program, and it is necessary to modify all the programs in the information system. In this regard, such modifications cannot be applied to programs provided by third parties.

特開2009−104490号公報、図2等Japanese Unexamined Patent Publication No. 2009-104490, FIG. 2, etc. 特開2000−259446号公報、図2等Japanese Patent Laid-Open No. 2000-259446, FIG. 2, etc. 特開2007−133590号公報、図6等Japanese Patent Application Laid-Open No. 2007-133590, FIG.

従来のシステムコールをフックしてOSやハードウェアのエラーを模擬する手法や、ライブラリのラッパ関数を用意して各種ライブラリ群のエラーを模擬する手法には、以下のような課題があった。
(1)各種ライブラリAPI(Application Programming Interface)群のエラーを模擬するには、対象プログラムを改変する必要があり、組合せ試験、システム試験での利用が困難であるし、改変が行えない第三者プログラムには適用できない。
(2)システムコールをフックする手法は、エラー注入などの任意のコードを実行する論理空間がカーネル空間30に限られ、一方、各種ライブラリ群が動作する論理空間はプロセス空間(ユーザ空間)である。よって、各種ライブラリAPIを同様にフックする手法が利用できない。敢えてフックしようとすると、予め任意コード実行用のコードを対象プログラムに埋め込む必要があり、これは、ラッパ関数を用いる場合と同様に対象プログラムを改変する必要がある。又は、カーネル空間30で実行しようとすると、カーネル空間30に飛び込む為に、フックしたい共有ライブラリAPIの1つ1つに個別に対応する疑似システムコールをOSカーネル内に用意する必要があり、OSカーネルの改変が必要になる。
Conventional methods for hooking system calls to simulate OS and hardware errors, and methods for preparing library wrapper functions to simulate various library group errors have the following problems.
(1) In order to simulate errors in various library API (Application Programming Interface) groups, it is necessary to modify the target program, which is difficult to use in combination tests and system tests, and cannot be modified. Not applicable to the program.
(2) In the method of hooking a system call, the logical space for executing arbitrary code such as error injection is limited to the kernel space 30, while the logical space in which various library groups operate is a process space (user space). . Therefore, the method of hooking various library APIs similarly cannot be used. When trying to hook, it is necessary to embed a code for executing arbitrary code in the target program in advance, and this requires modification of the target program as in the case of using a wrapper function. Alternatively, when executing in the kernel space 30, in order to jump into the kernel space 30, it is necessary to prepare a pseudo system call corresponding to each shared library API to be hooked in the OS kernel. Need to be modified.

本発明は、各種ライブラリAPIをフックして任意のコードをカーネル空間内で実行できるような仕掛けをすることにより、対象となる情報システム内のOSカーネル及びプログラム群を改変せずに、エラー模擬やトレース情報の取得を可能とすることを目的とする。   The present invention hooks various library APIs so that arbitrary code can be executed in the kernel space, thereby making it possible to simulate errors without modifying the OS kernel and program group in the target information system. The purpose is to enable acquisition of trace information.

この発明のエントリ書換装置は、
指定された共有ライブラリAPI(Application Programming Interface)の属する共有ライブラリを示す所属共有ライブラリをメモリのプロセス空間にマップし、マップされた前記所属共有ライブラリの先頭アドレスを保持し、マップされた前記所属共有ライブラリに属する前記指定に係る前記共有ライブラリAPIに対応するジャンプ命令のジャンプ先アドレスを記録すると共に、記録した前記ジャンプ先アドレスを持つ前記ジャンプ命令をカーネル飛び込み用システムコールへジャンプする割込命令に書き換えるライブラリAPIエントリ書換部と、
前記ライブラリAPIエントリ書換部が書き換えた割込命令に対応する前記カーネル飛び込み用システムコールのエントリのジャンプ命令のジャンプ先アドレスを記録すると共に、前記ライブラリAPIエントリ書換部が書き換えた割込命令に対応する前記カーネル飛び込み用システムコールの前記エントリに設定されている前記ジャンプ命令を、所定のジャンプ命令によって呼ばれることで所定の処理を実行する任意コード実行部への前記所定のジャンプ命令に書き換えるシステムコールエントリ書換部と
を備えたことを特徴とする。
The entry rewriting device of the present invention comprises:
A shared library indicating a shared library to which a specified shared library API (Application Programming Interface) belongs is mapped to a process space of a memory, and the mapped shared library is stored with a start address of the mapped shared library. A library that records a jump destination address of a jump instruction corresponding to the shared library API according to the designation belonging to the specification and rewrites the jump instruction having the recorded jump destination address into an interrupt instruction that jumps to a kernel jump system call An API entry rewriting unit;
The jump destination address of the jump instruction of the kernel jump system call entry corresponding to the interrupt instruction rewritten by the library API entry rewriting unit is recorded, and the jump destination address of the library API entry rewriting unit corresponds to the rewritten interrupt instruction. System call entry rewriting for rewriting the jump instruction set in the entry of the system call for kernel jump into the predetermined jump instruction to an arbitrary code execution unit that executes predetermined processing by being called by a predetermined jump instruction And a section.

本発明により、対象となる情報システム内のOSカーネル及びプログラム群を改変せずに、エラー模擬やトレース情報の取得が可能となる。   According to the present invention, error simulation and acquisition of trace information can be performed without modifying the OS kernel and the program group in the target information system.

実施の形態1の対象計算機101のブロック図。FIG. 2 is a block diagram of the target computer 101 according to the first embodiment. 実施の形態1の対象計算機101の事前準備段階の動作フロー。The operation | movement flow of the prior preparation stage of the object computer 101 of Embodiment 1. FIG. 実施の形態1の対象計算機101の各要素のアクセス先を示す図。FIG. 3 is a diagram showing access destinations of each element of the target computer 101 according to the first embodiment. 実施の形態1の共有ライブラリシンボルテーブル32−4を示す図。FIG. 6 is a diagram showing a shared library symbol table 32-4 according to the first embodiment. 実施の形態1の実行条件テーブル32−3を示す図。FIG. 4 is a diagram illustrating an execution condition table 32-3 according to the first embodiment. 実施の形態1の共有ライブラリAPIエントリ、rebootシステムコールエントリを示す図。The figure which shows the shared library API entry of Embodiment 1, and a reboot system call entry. 実施の形態1のエントリ保存テーブルを示す図。FIG. 3 shows an entry storage table according to the first embodiment. 実施の形態1の任意コード実行部32−1の動作を示すフロー。9 is a flowchart showing the operation of the arbitrary code execution unit 32-1 according to the first embodiment. 実施の形態1の対象計算機101の各要素のアクセス先を示す図。FIG. 3 is a diagram showing access destinations of each element of the target computer 101 according to the first embodiment. 実施の形態1のCPUレジスタを示す図。FIG. 3 illustrates a CPU register of Embodiment 1; 実施の形態1のプロセス空間の内訳を示す図。FIG. 3 is a diagram showing a breakdown of a process space according to the first embodiment. 実施の形態2の対象計算機102のブロック図。FIG. 4 is a block diagram of a target computer 102 according to the second embodiment. 実施の形態2のバックトレース実行部32−5の動作概念を示す図。The figure which shows the operation | movement concept of the backtrace execution part 32-5 of Embodiment 2. FIG. 実施の形態2の共有ライブラリの呼ばれた経路を示す概念図。The conceptual diagram which shows the path | route called the shared library of Embodiment 2. FIG. 実施の形態2の共有ライブラリの呼ばれた経路を示す概念図。The conceptual diagram which shows the path | route called the shared library of Embodiment 2. FIG. 実施の形態2のバックトレース実行部32−5の動作フロー。The operation | movement flow of the backtrace execution part 32-5 of Embodiment 2. FIG. 実施の形態2の個別プロセスシンボルテーブル32−6を示す図。FIG. 10 shows an individual process symbol table 32-6 according to the second embodiment. 実施の形態2の実行条件テーブルを示す図。FIG. 6 shows an execution condition table according to the second embodiment. 実施の形態3の対象計算機の外観の一例を示す図。The figure which shows an example of the external appearance of the object computer of Embodiment 3. FIG. 実施の形態3の対象計算機のハードウェア構成の一例を示す図。The figure which shows an example of the hardware constitutions of the object computer of Embodiment 3. FIG.

実施の形態1.
図1は、対象計算機101(エントリ書換装置、任意コード実行方式)の動作原理を示す構成図である。図1において、対象計算機101は、試験・検証の対象となる情報システムを構成するプログラム群が動作する計算機である。
(1)条件設定コマンド部10は、対象計算機101を利用する為のマン・マシン・インターフェース手段を提供する。
(2)システムコールエントリ書換部11は、カーネル飛び込み用システムコールエントリ31−1にあるカーネル飛び込み用システムコール実体31−2へのジャンプ命令を任意コード実行部32−1へジャンプ命令へ書き換える。
(3)ライブラリAPIエントリ書換部12は、エラー注入やトレース情報取得などの任意のコードを実行したい任意の共有ライブラリAPIエントリ22−1にある共有ライブラリAPI実体22−2へのジャンプ命令を、カーネル飛び込み用システムコールエントリ31−1へとジャンプする為の割込命令に書き換える。
(4)条件設定部13は、任意コードを実行する為の条件、例えば、呼出プロセスが指定のプログラムであった時のみ実行するなど、を実行条件テーブル32−3に設定する。
(5)シンボルテーブル生成部14は、フックしたい共有ライブラリAPIが属する共有ライブラリの共有ライブラリシンボルテーブル32−4を生成し、共有ライブラリシンボルテーブル32−4に保存する。
(6)任意コード実行部32−1は、実行条件テーブル32−3の条件に合致する場合に任意のコードを実行する。
Embodiment 1 FIG.
FIG. 1 is a configuration diagram showing the operation principle of the target computer 101 (entry rewriting device, arbitrary code execution method). In FIG. 1, a target computer 101 is a computer on which a program group constituting an information system to be tested / verified operates.
(1) The condition setting command unit 10 provides man-machine interface means for using the target computer 101.
(2) The system call entry rewriting unit 11 rewrites the jump instruction to the kernel jump system call entity 31-2 in the kernel jump system call entry 31-1 into a jump instruction to the arbitrary code execution unit 32-1.
(3) The library API entry rewriting unit 12 sends a jump instruction to the shared library API entity 22-2 in any shared library API entry 22-1 for executing arbitrary code such as error injection or trace information acquisition to the kernel. It is rewritten as an interrupt instruction for jumping to the jump-in system call entry 31-1.
(4) The condition setting unit 13 sets a condition for executing an arbitrary code in the execution condition table 32-3, for example, executing only when the calling process is a designated program.
(5) The symbol table generation unit 14 generates a shared library symbol table 32-4 of the shared library to which the shared library API to be hooked belongs, and stores it in the shared library symbol table 32-4.
(6) The arbitrary code execution unit 32-1 executes an arbitrary code when the conditions in the execution condition table 32-3 are met.

(動作の説明)
次に動作について説明する。
なお、実施の形態1では、任意のコードとしてエラー模擬を行うコードを実行する場合を例に説明するが、トレース情報を取得する場合や、他の任意のコードを実行する場合も同様である。
(Description of operation)
Next, the operation will be described.
In the first embodiment, a case where a code that simulates an error is executed as an arbitrary code will be described as an example. However, the same applies to a case where trace information is acquired or another arbitrary code is executed.

図2は、対象計算機101の基本動作の内、事前準備段階の動作フローである。
図3は、各構成要素がどこにアクセスしているかを示す図である。
FIG. 2 is an operation flow in a preliminary preparation stage among the basic operations of the target computer 101.
FIG. 3 is a diagram showing where each component is accessing.

(シンボルテーブル生成部14)
まず、シンボルテーブル生成部14は、図4に示すような共有ライブラリシンボルテーブル32−4に、操作者(ユーザ)によって指定された共有ライブラリAPIに関する情報を登録し、既に登録済みの場合はなにも行わない(S11)。図4では、共有ライブラリ名、APIシンボル名及びAPIエントリアドレスが登録されている。
(Symbol table generation unit 14)
First, the symbol table generation unit 14 registers information related to the shared library API designated by the operator (user) in the shared library symbol table 32-4 as shown in FIG. Is not performed (S11). In FIG. 4, a shared library name, an API symbol name, and an API entry address are registered.

(条件設定部13)
次に,条件設定部13は、図5に示すような実行条件テーブル32−3に、操作者(ユーザ)による指定に従って、対象となる共有ライブラリAPIシンボル名、返値設定条件、呼出プログラム名などの情報を実行条件として登録する(S12)。なお、実行条件としては、操作者は、他にプロセスID、呼出元プログラム内の関数名などを指定可能である。
(Condition setting unit 13)
Next, the condition setting unit 13 adds a target shared library API symbol name, a return value setting condition, a calling program name, etc. in accordance with the designation by the operator (user) in the execution condition table 32-3 as shown in FIG. Is registered as an execution condition (S12). As an execution condition, the operator can specify a process ID, a function name in the caller program, and the like.

(ライブラリAPIエントリ書換部12)
次に、ライブラリAPIエントリ書換部12は、操作者によって指定された共有ライブラリAPIが属する共有ライブラリを、条件設定コマンド部10が動作しているAppプロセス空間20にマップし、マップした先頭アドレスを保持する(S13)。この先頭アドレスを「0xVWXY」とする。この先頭アドレスは、後述する図8のS28の処理で使用される。
次に、ライブラリAPIエントリ書換部12は、図6の(a)に示すような、マップされた共有ライブラリの一部である共有ライブラリAPIエントリ22−1のうち、対象となる共有ライブラリAPIに対応するエントリのジャンプ命令(例えば図6の(a)のBL0x2A00)を読み取る。そして、ライブラリAPIエントリ書換部12は、この読み取った共有ライブラリAPI実体への本来のジャンプ先であるアドレス(BL0x2A00)を、図7(図7のAPIエントリの部分)に示すようなエントリ保存テーブル32−2(fwriteのBL0x2A00)に記録し(S14)、さらに、図6の(a)の対象ライブラリAPIエントリにあるジャンプ命令(BL0x2A00)を、カーネル飛び込み用システムコールに使用するrebootシステムコールへジャンプする割込命令(INT 0x〜)に書き換える(S15)。
なお、この例では、カーネル飛び込み用システムコールとしてrebootシステムコールを使用する場合を説明したが一例であり、rebootシステムコールを必ず使用する必要があるということではない。「実際にシステムコールが呼ばれたのか、書き換えられたエントリから飛び込んできたのか、が簡易に判別できるシステムコール」であれば良く、この条件に合致するシステムコールの一例として、rebootシステムコール
を使用する場合を説明した。
(Library API entry rewriting unit 12)
Next, the library API entry rewriting unit 12 maps the shared library to which the shared library API designated by the operator belongs to the App process space 20 in which the condition setting command unit 10 is operating, and holds the mapped start address. (S13). This head address is assumed to be “0xVWXY”. This head address is used in the processing of S28 in FIG.
Next, the library API entry rewriting unit 12 corresponds to the target shared library API among the shared library API entries 22-1 which are part of the mapped shared library as shown in FIG. The jump instruction (for example, BL0x2A00 in FIG. 6A) is read. Then, the library API entry rewriting unit 12 stores the read address (BL0x2A00) that is the original jump destination to the shared library API entity as shown in FIG. 7 (API entry part of FIG. 7). -2 (fwrite BL0x2A00) is recorded (S14), and the jump instruction (BL0x2A00) in the target library API entry in FIG. 6A is jumped to the reboot system call used for the kernel jump system call. It is rewritten to an interrupt instruction (INT 0x ~) (S15).
In this example, the case where the reboot system call is used as the kernel jumping system call has been described as an example, and the reboot system call is not necessarily used. Any system call that can easily determine whether the system call was actually called or jumped from the rewritten entry can be used, and the reboot system call is used as an example of a system call that meets this condition. Explained when to do.

(システムコールエントリ書換部11)
次に、システムコールエントリ書換部11は、カーネル飛び込み用システムコールに設定したrebootシステムコールのエントリ(図6の(b))にあるカーネル飛び込み用システムコール実体31−2へのジャンプ命令のジャンプ先アドレス(図6の(b)の「0xABCD」)を、エントリ保存テーブル32−2に記録(図7の上側に示すrebootの範囲)し(S16)、カーネル飛び込み用システムコールのエントリにあるジャンプ命令(図6の(b)のBL 0xABCD)を任意コード実行部32−1へのジャンプ命令に書き換える。以上が事前準備段階の動作フローである。
(System call entry rewriting unit 11)
Next, the system call entry rewriting unit 11 jumps the jump instruction of the jump instruction to the kernel jump system call entity 31-2 in the entry of the reboot system call set in the kernel jump system call (FIG. 6B). The address (“0xABCD” in FIG. 6B) is recorded in the entry storage table 32-2 (reboot range shown in the upper side of FIG. 7) (S16), and the jump instruction in the entry of the system call for kernel jumping (BL 0xABCD in FIG. 6B) is rewritten as a jump instruction to the arbitrary code execution unit 32-1. The above is the operation flow in the preliminary preparation stage.

図8は、対象計算機101の基本動作のうち、実際に対象となる情報システムを動作させて、検証・試験する際の動作フローである。
図9は、対象となったプログラムの実行フローの概略図である。
FIG. 8 is an operation flow when a target information system is actually operated and verified / tested out of the basic operations of the target computer 101.
FIG. 9 is a schematic diagram of the execution flow of the target program.

(ロードモジュール共有ライブラリAPI呼出21)
まず、ロードモジュール21内において共有ライブラリAPI(例えばfwriteとする)が呼び出される時には、ロードモジュール共有ライブラリAPI呼出21内から、図6(a)の共有ライブラリAPIエントリ22−1にジャンプし(S21)、事前に書き換えている割込命令(INT 0x〜:カーネル飛び込み用システムコールへジャンプする割込命令)により、OSカーネル31内にジャンプする(S22)。事前に書き換えられたrebootシステムコールエントリ(任意コード実行部32−1へのジャンプ命令に書き換え済み)のジャンプ命令により、ドライバ32内の任意コード実行部32−1にジャンプする(S23)。
(Load module shared library API call 21)
First, when a shared library API (for example, “fwrite”) is called in the load module 21, a jump is made from the load module shared library API call 21 to the shared library API entry 22-1 of FIG. 6A (S21). Then, it jumps into the OS kernel 31 by the interrupt instruction (INT 0x˜: interrupt instruction jumping to the kernel jumping system call) rewritten in advance (S22). The jump to the arbitrary code execution unit 32-1 in the driver 32 is jumped by the jump instruction of the reboot system call entry (rewritten to the jump instruction to the arbitrary code execution unit 32-1) rewritten in advance (S23).

(任意コード実行部32−1)
次に、任意コード実行部32−1は、まず、図10に示すような、CPUが持つ割込履歴レジスタを読み出して、どの共有ライブラリAPIエントリ22−1で割込をかけてジャンプしてきのか確認し、共有ライブラリAPIエントリアドレスを取得する(S24)。
(Arbitrary code execution unit 32-1)
Next, the arbitrary code execution unit 32-1 first reads the interrupt history register of the CPU as shown in FIG. 10, and confirms which shared library API entry 22-1 has jumped by interrupting. Then, the shared library API entry address is acquired (S24).

次に、任意コード実行部32−1は、呼出の第1、第2引数がrebootシステムコールのマジックコードであるか、第3引数が正しいrebootシステムコールのコマンドコードであるかを確認する(S25)。任意コード実行部32−1は、正しい引数であれば、エントリ保存テーブル32−2に記録してあるrebootシステムコールの実体アドレスにジャンプしてシステムコールの処理を行う(S26)。   Next, the arbitrary code execution unit 32-1 confirms whether the first and second arguments of the call are magic codes of the reboot system call, or whether the third argument is a command code of the correct reboot system call (S25). ). If it is a correct argument, the arbitrary code execution unit 32-1 jumps to the actual address of the reboot system call recorded in the entry storage table 32-2, and performs the system call processing (S26).

正しい引数でなければ(検証対象プロセスの可能性がある)、以下の処理になる。共有ライブラリAPIエントリのアドレスは、図11に示すように、プロセスごとに共有ライブラリのマップされるアドレスが異なる。よって、任意コード実行部32−1は、自プロセス内のメモリマップテーブルを参照して、S24で取得した共有ライブラリAPIエントリアドレスが、どの共有ライブラリに属するのかを確認する(S27)。なお、この段階では、シンボル名までは特定できない。アドレスのみ判っているので、任意コード実行部32−1は、共有ライブラリのマップされたアドレスから、どの共有ライブラリがマップされたアドレス領域かを判断出来る。属する共有ライブラリ(S27で特定した共有ライブラリ)が、特定した共有ライブラリのマップされた先頭アドレスと、共有ライブラリAPIのエントリアドレス(S24で取得)から、割り込みに係る共有ライブラリの、先頭から共有ライブラリAPIのエントリアドレスまでのアドレス差を算出(Δアドレスとおく)(S28)する。   If it is not a correct argument (possibly a process to be verified), the following processing is performed. As shown in FIG. 11, the address of the shared library API entry differs in the mapped address of the shared library for each process. Therefore, the arbitrary code execution unit 32-1 refers to the memory map table in its own process and confirms to which shared library the shared library API entry address acquired in S24 belongs (S27). Note that at this stage, even the symbol name cannot be specified. Since only the address is known, the arbitrary code execution unit 32-1 can determine which shared library is the mapped address area from the mapped address of the shared library. The shared library to which the shared library belongs (the shared library identified in S27) from the head of the identified shared library and the shared library API entry address (obtained in S24) from the top of the shared library related to the interrupt The address difference up to the entry address is calculated (denoted as Δ address) (S28).

そして、任意コード実行部32−1は、共有ライブラリシンボルテーブル33−4内を検索して、対象の共有ライブラリAPIであるかをチェックする。この際、任意コード実行部32−1は、事前準備段階のS13で保持した先頭アドレス(「0xVWXY」)に、S28で算出した「Δアドレス」を加えて加算アドレス値を得る。そして、任意コード実行部32−1は、この加算アドレス値に相当するアドレスを共有ライブラリシンボルテーブル32−4から見つけ、かつ、その行に割り込み係る共有ライブラリの名があるかどうかでチェックを行う。対象の共有ライブラリAPIでなければ、正規に呼ばれたrebootシステムコールであると判断し、エントリ保存テーブル32−2にあるrebootシステムコールの実体にジャンプする(S29)。なおS29でNOの場合とは、前記チェックによって特定された行のシンボル名が、図5の実行条件テーブル32−3に登録されたAPIシンボル名ではない場合である。rebootシステムコールのマジックコードに該当せずにこちらに分岐(S25でNO)したのに、実行条件テーブル32−3にシンボルがないということは、任意コード実行部32−1は、ロードモジュール共有ライブラリAPI呼出21がrebootシステムコールを誤った引数で呼んでいると判断する。   Then, the arbitrary code execution unit 32-1 searches the shared library symbol table 33-4 and checks whether it is the target shared library API. At this time, the arbitrary code execution unit 32-1 adds the “Δ address” calculated in S28 to the head address (“0xVWXY”) held in S13 in the preparatory stage to obtain an added address value. Then, the arbitrary code execution unit 32-1 finds an address corresponding to the addition address value from the shared library symbol table 32-4, and checks whether or not the shared library name associated with the interrupt exists in the line. If it is not the target shared library API, it is determined that the call is a properly called reboot system call, and the process jumps to the entity of the reboot system call in the entry storage table 32-2 (S29). The case of NO in S29 is a case where the symbol name of the line specified by the check is not an API symbol name registered in the execution condition table 32-3 of FIG. The fact that there is no symbol in the execution condition table 32-3 even though it branches here (NO in S25) without corresponding to the magic code of the reboot system call means that the arbitrary code execution unit 32-1 It is determined that the API call 21 is calling the reboot system call with an incorrect argument.

対象の共有ライブラリAPIの場合、実行条件テーブル32−3を参照し、呼出元プログラム、返値条件などが合致するかを判定する(S30)。合致しない場合は、任意コード実行部32−1は、エントリ保存テーブル32−2にある共有ライブラリAPIの正規の飛び先アドレスにジャンプする(S33)。
条件に合致した場合は、任意コード実行部32−1は、返値設定を行い(S31)、カーネルスタック内に保存されたRP(リターンポインタ)が示すAppプロセス空間20のロードモジュール共有ライブラリAPI呼出21内の共有ライブラリAPI呼出の直後にジャンプする(S32)。
In the case of the target shared library API, the execution condition table 32-3 is referred to and it is determined whether the calling source program, the return value condition, and the like are met (S30). If not, the arbitrary code execution unit 32-1 jumps to the regular jump destination address of the shared library API in the entry storage table 32-2 (S33).
If the condition is met, the arbitrary code execution unit 32-1 sets a return value (S31), and calls the load module shared library API in the App process space 20 indicated by the RP (return pointer) stored in the kernel stack. A jump is made immediately after the shared library API call in 21 (S32).

これにより、各種ライブラリAPIをフックして任意のコードをカーネル空間30内で実行できるようにすることにより、対象となる情報システム内のOSカーネル31、及び、プログラム群を改変せずに、エラー模擬やトレース情報の取得が可能となる。   As a result, by hooking various library APIs so that arbitrary code can be executed in the kernel space 30, error simulation can be performed without modifying the OS kernel 31 and the program group in the target information system. And trace information can be acquired.

実施の形態2.
次に、図12〜図18を参照して実施の形態2の対象計算機102を説明する。対象計算機102は、実施の形態1の対象計算機101に対して、さらに、バックトレース実行部32−5と、個別プロセスシンボルテーブル32−6(図17)とを備えた構成である。
Embodiment 2. FIG.
Next, the target computer 102 according to the second embodiment will be described with reference to FIGS. The target computer 102 is configured to further include a backtrace execution unit 32-5 and an individual process symbol table 32-6 (FIG. 17) in addition to the target computer 101 of the first embodiment.

図12は、対象計算機102のブロック図である。
図13は、バックトレース実行部32−5の動作概念を示している。
図14は、共有ライブラリの呼ばれた経路を示す概念図である。
図15は、共有ライブラリの呼ばれた経路を示す概念図である。
図16は、バックトレース実行部32−5の動作フローである。
図17は、個別プロセスシンボルテーブル32−6を示す図である。
図18は、実施の形態2における実行条件テーブルを示す図である。
FIG. 12 is a block diagram of the target computer 102.
FIG. 13 shows an operation concept of the backtrace execution unit 32-5.
FIG. 14 is a conceptual diagram showing a path through which a shared library is called.
FIG. 15 is a conceptual diagram showing a path in which a shared library is called.
FIG. 16 is an operation flow of the backtrace execution unit 32-5.
FIG. 17 is a diagram showing the individual process symbol table 32-6.
FIG. 18 shows an execution condition table in the second embodiment.

実施の形態2の対象計算機102は、実施の形態1で説明した内容に加えて、共有ライブラリAPIの呼出元経路を条件指定可能とする。対象計算機102は、図12において、実施の形態1での構成(図1)に加えて、バックトレース実行部32−5と個別プロセスシンボルテーブル32−6(図12では、個別Procシンボルテーブルと表記した)を持つ。   In addition to the contents described in the first embodiment, the target computer 102 according to the second embodiment makes it possible to specify conditions for the call source path of the shared library API. In FIG. 12, in addition to the configuration in the first embodiment (FIG. 1), the target computer 102 includes a backtrace execution unit 32-5 and an individual process symbol table 32-6 (in FIG. 12, expressed as an individual Proc symbol table). Have).

(動作の説明)
次に動作について説明する。
図13は、バックトレース実行部32−5の動作概念を示している。バックトレース実行部32−5は、図8の返値設定条件に合致するかの判断時(図8のS30)に呼ばれる。バックトレース実行部32−5は、指定された経路、例えば、図14において、共有ライブラリAPIslib_2が、sub_02、sub_13を経由して呼ばれた時に合致するかを判断する為にバックトレースを行う。
(Description of operation)
Next, the operation will be described.
FIG. 13 shows an operation concept of the backtrace execution unit 32-5. The backtrace execution unit 32-5 is called when determining whether the return value setting condition in FIG. 8 is met (S30 in FIG. 8). The backtrace execution unit 32-5 performs backtrace to determine whether or not the specified path, for example, in FIG. 14, the shared library APIslib_2 matches when called via sub_02 and sub_13.

図16は動作フローを示す。まず、図18の実行条件テーブルに示すように、呼び出されたAPI(slib_2)に対して、返値設定条件として、呼出元条件が設定されていた場合、図16のフローで条件確認が行われる。図16のフローにおいては、まず、共有ライブラリAPI slib_2が呼び出された時、即ち、システムコールに書き換えられているので割込が発生した時に行われるレジスタ退避領域(図13の(1))より、割込発生時のプログラムカウンタ(PC)の値、及び、スタックポインタ(SP)の値を取得する(S41)。   FIG. 16 shows an operation flow. First, as shown in the execution condition table of FIG. 18, when a caller condition is set as a return value setting condition for the called API (slib_2), the condition is confirmed in the flow of FIG. . In the flow of FIG. 16, first, from the register save area ((1) of FIG. 13) that is performed when the shared library API slib_2 is called, that is, when an interrupt occurs because it is rewritten to a system call, The value of the program counter (PC) and the value of the stack pointer (SP) at the time of occurrence of the interrupt are acquired (S41).

次にプログラムカウンタ値が指すアドレスが、個別プロセスシンボルテーブル(図17)上のどのシンボルに該当するアドレスか確認して、そのシンボル名を保持する(S44)。例えば、PCが0x00400550を指していたとすれば、シンボル名sub_12のアドレス領域に該当する。   Next, it is confirmed to which symbol on the individual process symbol table (FIG. 17) the address indicated by the program counter value corresponds, and the symbol name is held (S44). For example, if the PC points to 0x00400550, it corresponds to the address area of the symbol name sub_12.

次に保持されたシンボル名がmainかどうかを確認し(S45)、Yesであれば、最後までバックトレースが完了したとして条件に合致しないとしてフローを終了する(S46)。Noであれば、保持したシンボル名が条件にあっているか確認し(S47)、Yesの場合、更に条件を全て満たしたかを確認する(S48)。Yesであれば、条件に合致したとしてフローを終了する(S49)。Noであれば、スタックポインタが指すアドレス(スタック領域の先頭を指す)よりリターンポインタ(RP)値と次のスタックポインタ(SP)値を取得する(S50)。   Next, it is confirmed whether or not the retained symbol name is “main” (S45), and if “Yes”, the flow is terminated because the backtrace is completed to the end and the condition is not met (S46). If No, it is confirmed whether the held symbol name meets the conditions (S47). If Yes, it is further confirmed whether all the conditions are satisfied (S48). If Yes, the flow is terminated because the condition is met (S49). If No, the return pointer (RP) value and the next stack pointer (SP) value are acquired from the address pointed to by the stack pointer (pointing to the top of the stack area) (S50).

次にリターンポインタ値が指すアドレスが、個別プロセスシンボルテーブル(図17)上のどのシンボルに該当するアドレスか確認して、そのシンボル名を保持する(S51)。   Next, it is confirmed to which symbol on the individual process symbol table (FIG. 17) the address indicated by the return pointer value corresponds, and the symbol name is held (S51).

以降、(S45)〜(S51)をフローに従って終了条件を満たすまで繰り返す。なお、図16のS42の個別プロセスシンボルテーブル(図17)の生成の手段としては、ロードモジュールのシンボルテーブル、及び、そのプロセスにマップされた共有ライブラリのシンボルテーブルのアドレスを演算したアドレス(共有ライブラリのマップされた先頭アドレスにシンボルテーブルに記録されたアドレスを足す)をアドレスでソートすることによりなされる。これにより、例えば、図15のように複数の関数から呼ばれ得る共有ライブラリAPIをフックしてエラーを注入したりする場合に、特定のエラー処理を試験しようとしても特定できないという課題を解決でき、網羅的な試験を可能とする効果がある。   Thereafter, (S45) to (S51) are repeated according to the flow until the end condition is satisfied. As a means for generating the individual process symbol table (FIG. 17) in S42 of FIG. 16, an address (shared library) obtained by calculating the address of the symbol table of the load module and the symbol table of the shared library mapped to the process. This is done by sorting the addresses mapped in the symbol table by the addresses recorded in the symbol table. As a result, for example, when an error is injected by hooking a shared library API that can be called from a plurality of functions as shown in FIG. This has the effect of enabling comprehensive testing.

実施の形態3.
図19、図20を参照して実施の形態3を説明する。実施の形態3は、コンピュータである対象計算機101、102のハードウェア構成を説明する。
図19は、コンピュータである対象計算機101あるいは対象計算機102の外観の一例を示す図である。
図20は、対象計算機101あるいは対象計算機102のハードウェア資源の一例を示す図である。以下の説明は対象計算機101とする。対象計算機102についても対象計算機101の説明がそのまま当てはまる。
Embodiment 3 FIG.
The third embodiment will be described with reference to FIGS. The third embodiment describes the hardware configuration of the target computers 101 and 102 that are computers.
FIG. 19 is a diagram illustrating an example of an appearance of the target computer 101 or the target computer 102 that is a computer.
FIG. 20 is a diagram illustrating an example of hardware resources of the target computer 101 or the target computer 102. In the following description, the target computer 101 is assumed. The description of the target computer 101 also applies to the target computer 102 as it is.

外観を示す図19において、対象計算機101は、システムユニット830、CRT(Cathode・Ray・Tube)やLCD(液晶)の表示画面を有する表示装置813、キーボード814(Key・Board:K/B)、マウス815、コンパクトディスク装置818(CDD:Compact Disk Drive)などのハードウェア資源を備え、これらはケーブルや信号線で接続されている。システムユニット830はネットワークに接続している。   19, the target computer 101 includes a system unit 830, a display device 813 having a CRT (Cathode / Ray / Tube) or LCD (liquid crystal) display screen, a keyboard 814 (Key / Board: K / B), Hardware resources such as a mouse 815 and a compact disk device 818 (CDD: Compact Disk Drive) are provided, and these are connected by cables and signal lines. The system unit 830 is connected to the network.

またハードウェア資源を示す図20において、対象計算機101は、プログラムを実行するCPU810(Central Processing Unit)を備えている。CPU810は、バス825を介してROM(Read Only Memory)811、RAM(Random Access Memory)812、表示装置813、キーボード814、マウス815、通信ボード816、CDD818、磁気ディスク装置820と接続され、これらのハードウェアデバイスを制御する。磁気ディスク装置820の代わりに、光ディスク装置、フラッシュメモリなどの記憶装置でもよい。   In FIG. 20 showing hardware resources, the target computer 101 includes a CPU 810 (Central Processing Unit) that executes a program. The CPU 810 is connected to a ROM (Read Only Memory) 811, a RAM (Random Access Memory) 812, a display device 813, a keyboard 814, a mouse 815, a communication board 816, a CDD 818, and a magnetic disk device 820 via a bus 825. Control hardware devices. Instead of the magnetic disk device 820, a storage device such as an optical disk device or a flash memory may be used.

RAM812は、揮発性メモリの一例である。ROM811、CDD818、磁気ディスク装置820等の記憶媒体は、不揮発性メモリの一例である。これらは、「記憶装置」あるいは記憶部、格納部、バッファの一例である。通信ボード816、キーボード814などは、入力部、入力装置の一例である。また、通信ボード816、表示装置813などは、出力部、出力装置の一例である。通信ボード816は、ネットワークに接続されている。   The RAM 812 is an example of a volatile memory. Storage media such as the ROM 811, the CDD 818, and the magnetic disk device 820 are examples of nonvolatile memories. These are examples of a “storage device” or a storage unit, a storage unit, and a buffer. The communication board 816, the keyboard 814, and the like are examples of an input unit and an input device. The communication board 816, the display device 813, and the like are examples of an output unit and an output device. The communication board 816 is connected to the network.

磁気ディスク装置820には、オペレーティングシステム821(OS)、ウィンドウシステム822、プログラム群823、ファイル群824が記憶されている。プログラム群823のプログラムは、CPU810、オペレーティングシステム821、ウィンドウシステム822により実行される。   The magnetic disk device 820 stores an operating system 821 (OS), a window system 822, a program group 823, and a file group 824. The programs in the program group 823 are executed by the CPU 810, the operating system 821, and the window system 822.

上記プログラム群823には、以上の実施の形態の説明において「〜部」として説明した機能を実行するプログラムが記憶されている。プログラムは、CPU810により読み出され実行される。   The program group 823 stores programs that execute the functions described as “˜units” in the description of the above embodiments. The program is read and executed by the CPU 810.

ファイル群824には、以上の実施の形態の説明において、「〜の判定結果」、「〜の算出結果」、「〜の抽出結果」、「〜の生成結果」、「〜の処理結果」として説明した情報や、データや信号値や変数値やパラメータなどが、「〜ファイル」や「〜データベース」の各項目として記憶されている。「〜ファイル」や「〜データベース」は、ディスクやメモリなどの記録媒体に記憶される。ディスクやメモリなどの記憶媒体に記憶された情報やデータや信号値や変数値やパラメータは、読み書き回路を介してCPU810によりメインメモリやキャッシュメモリに読み出され、抽出・検索・参照・比較・演算・計算・処理・出力・印刷・表示などのCPUの動作に用いられる。抽出・検索・参照・比較・演算・計算・処理・出力・印刷・表示のCPUの動作の間、情報やデータや信号値や変数値やパラメータは、メインメモリやキャッシュメモリやバッファメモリに一時的に記憶される。   In the description of the above embodiment, the file group 824 includes “to determination result”, “to calculation result”, “to extraction result”, “to generation result”, and “to processing result”. The described information, data, signal values, variable values, parameters, and the like are stored as items of “˜file” and “˜database”. The “˜file” and “˜database” are stored in a recording medium such as a disk or a memory. Information, data, signal values, variable values, and parameters stored in a storage medium such as a disk or memory are read out to the main memory or cache memory by the CPU 810 via a read / write circuit, and extracted, searched, referenced, compared, and calculated. Used for CPU operations such as calculation, processing, output, printing, and display. Information, data, signal values, variable values, and parameters are temporarily stored in the main memory, cache memory, and buffer memory during the CPU operations of extraction, search, reference, comparison, operation, calculation, processing, output, printing, and display. Is remembered.

また、以上に述べた実施の形態の説明において、データや信号値は、RAM812のメモリ、CDD818のコンパクトディスク、磁気ディスク装置820の磁気ディスク、その他光ディスク、ミニディスク、DVD(Digital・Versatile・Disk)等の記録媒体に記録される。また、データや信号は、バス825や信号線やケーブルその他の伝送媒体によりオンライン伝送される。   In the description of the embodiment described above, the data and signal values are the memory of the RAM 812, the compact disk of the CDD 818, the magnetic disk of the magnetic disk device 820, other optical disks, mini disks, and DVDs (Digital Versatile Disk). Or the like. Data and signals are transmitted on-line via the bus 825, signal lines, cables, and other transmission media.

また、以上の実施の形態の説明において、「〜部」として説明したものは、「〜手段」、であってもよく、また、「〜ステップ」、「〜手順」、「〜処理」であってもよい。すなわち、「〜部」として説明したものは、ソフトウェアのみ、或いは、ソフトウェアとハードウェアとの組み合わせ、さらには、ファームウェアとの組み合わせで実施されても構わない。ファームウェアとソフトウェアは、プログラムとして、磁気ディスク、フレキシブルディスク、光ディスク、コンパクトディスク、ミニディスク、DVD等の記録媒体に記憶される。プログラムはCPU810により読み出され、CPU810により実行される。すなわち、プログラムは、以上に述べた「〜部」としてコンピュータを機能させるものである。あるいは、以上に述べた「〜部」の手順や方法をコンピュータに実行させるものである。   In the above description of the embodiment, what has been described as “to part” may be “to means”, and “to step”, “to procedure”, and “to processing”. May be. That is, what has been described as “˜unit” may be implemented by software alone, a combination of software and hardware, or a combination of firmware. Firmware and software are stored as programs in a recording medium such as a magnetic disk, a flexible disk, an optical disk, a compact disk, a mini disk, and a DVD. The program is read by the CPU 810 and executed by the CPU 810. That is, the program causes the computer to function as the “˜unit” described above. Alternatively, the computer executes the procedure and method of “to part” described above.

以上の実施の形態では、装置としての対象計算機101(エントリ書換装置)を説明したが、対象計算機101の動作をエントリ書換プログラムとしても把握できることは以上の説明から明らかである。   In the above embodiment, the target computer 101 (entry rewriting device) as an apparatus has been described. However, it is apparent from the above description that the operation of the target computer 101 can also be grasped as an entry rewriting program.

以上の実施の形態では、以下の手段、要素を備え、アプリケーションプログラムを改変せずに任意のコードをカーネル空間で実行可能とする任意コード実行方式を説明した。
(a)試験実施者と対話的に任意コード実行条件の入力を受け付けて、条件設定部に対して実行条件テーブルへの書き込みを指示すると共に、ライブラリAPIエントリ書換部に対して任意コード実行のトリガーとなるライブラリAPIエントリの書換を指示すると共に、システムコールエントリ書換部に対してカーネル飛び込み用システムコールに指定したシステムコールのエントリの書換を指示すると共に、シンボルテーブル生成部に対して対象となる共有ライブラリのシンボルテーブルの生成を指示する手段(条件設定コマンド);
(b)対象プログラムが動的にリンクする共有ライブラリ内の対象となる共有ライブラリAPIエントリの飛び先をカーネル飛び込み用システムコールエントリのアドレスに書き換え、元のアドレスをエントリ保存テーブルに保持する手段(ライブラリAPIエントリ書換部);
(c)カーネル内のシステムコールエントリの飛び先を任意コード実行部へと書き換える手段(システムコールエントリ書換部);
(d)任意コードを実行する条件として、対象共有ライブラリAPI、指定プログラム、プロセスIDなどの組合わされた条件を実行条件テーブルに書き込む手段(条件設定部);
(e)対象となる共有ライブラリAPIが属する共有ライブラリを検索し、その共有ライブラリのシンボルテーブルを相対アドレス値でソートした状態で共有ライブラリシンボルテーブルに保存する手段(シンボルテーブル生成部);
(f)呼び出されると、どの共有ライブラリAPIから呼び出されたのかを判別した上で実行条件テーブルをチェックし、条件に合致した場合、指定されたコードを実行する手段(任意コード実行部);
In the above embodiment, the arbitrary code execution method that includes the following means and elements and enables arbitrary code to be executed in the kernel space without modifying the application program has been described.
(A) Accepting an arbitrary code execution condition interactively with the tester, instructing the condition setting unit to write to the execution condition table, and triggering arbitrary code execution to the library API entry rewriting unit Instructs the system call entry rewriting unit to rewrite the system call entry designated as the system call for kernel jumping, and instructs the symbol table generation unit to share the target Means for instructing generation of library symbol table (condition setting command);
(B) Means for rewriting the jump destination of the target shared library API entry in the shared library to which the target program is dynamically linked to the address of the system jump entry for kernel jumping and holding the original address in the entry storage table (library API entry rewriting part);
(C) means for rewriting the jump destination of the system call entry in the kernel to an arbitrary code execution unit (system call entry rewriting unit);
(D) Means (condition setting unit) for writing a combined condition such as a target shared library API, a designated program, and a process ID in an execution condition table as a condition for executing an arbitrary code;
(E) means for searching for a shared library to which the target shared library API belongs, and storing the symbol table of the shared library in the shared library symbol table in a state sorted by relative address values (symbol table generating unit)
(F) When called, the execution condition table is checked after determining which shared library API is called, and if the condition is met, means for executing the specified code (arbitrary code execution unit);

以上の実施の形態では、さらに以下の手段、要素を備え、呼出元の関数が呼ばれた経路の条件指定を可能とする任意コード実行方式を説明した。
(a)共有ライブラリAPIがロードモジュール内のどの関数を経由して呼び出されたかを検索する手段(バックトレース実行部);
(b)バックトレースを実行する為に必要な各アプリケーションプロセスの個別のシンボルテーブルを保持する要素(個別プロセスシンボルテーブル);
In the above embodiment, the arbitrary code execution method that further includes the following means and elements and enables the condition specification of the route in which the caller function is called has been described.
(A) Means for searching through which function in the load module the shared library API is called (backtrace execution unit);
(B) An element (individual process symbol table) holding an individual symbol table of each application process necessary for executing the backtrace;

101,102 対象計算機、10 条件設定コマンド部、11 システムコールエントリ書換部、12 ライブラリAPIエントリ書換部、13 条件設定部、14 シンボルテーブル生成部、20 Appプロセス空間、21 ロードモジュール共有ライブラリAPI呼出、22 共有ライブラリ群、22−1 共有ライブラリAPIエントリ、22−2 共有ライブラリAPI実体、30 カーネル空間、31 OSカーネル、31−1 カーネル飛び込み用システムコールエントリ、31−2 カーネル飛び込み用システムコール実体、32 ドライバ、32−1 任意コード実行部、32−2 エントリ保存テーブル、32−3 実行条件テーブル、32−4 共有ライブラリシンボルテーブル、32−5 バックトレース実行部、32−6 個別プロセスシンボルテーブル。   101, 102 Target computer, 10 Condition setting command part, 11 System call entry rewriting part, 12 Library API entry rewriting part, 13 Condition setting part, 14 Symbol table generating part, 20 App process space, 21 Load module shared library API call, 22 Shared library group, 22-1 Shared library API entry, 22-2 Shared library API entity, 30 kernel space, 31 OS kernel, 31-1 Kernel jump system call entry, 31-2 Kernel jump system call entity, 32 Driver, 32-1 Arbitrary code execution unit, 32-2 Entry storage table, 32-3 Execution condition table, 32-4 Shared library symbol table, 32-5 Backtrace execution unit, 32-6 Process symbol table.

Claims (6)

指定された共有ライブラリAPI(Application Programming Interface)の属する共有ライブラリを示す所属共有ライブラリをメモリのプロセス空間にマップし、マップされた前記所属共有ライブラリの先頭アドレスを保持し、マップされた前記所属共有ライブラリに属する前記指定に係る前記共有ライブラリAPIに対応するジャンプ命令のジャンプ先アドレスを記録すると共に、記録した前記ジャンプ先アドレスを持つ前記ジャンプ命令をカーネル飛び込み用システムコールへジャンプする割込命令に書き換えるライブラリAPIエントリ書換部と、
前記ライブラリAPIエントリ書換部が書き換えた割込命令に対応する前記カーネル飛び込み用システムコールのエントリのジャンプ命令のジャンプ先アドレスを記録すると共に、前記ライブラリAPIエントリ書換部が書き換えた割込命令に対応する前記カーネル飛び込み用システムコールの前記エントリに設定されている前記ジャンプ命令を、所定のジャンプ命令によって呼ばれることで所定の処理を実行する任意コード実行部への前記所定のジャンプ命令に書き換えるシステムコールエントリ書換部と
を備えたことを特徴とするエントリ書換装置。
A shared library indicating a shared library to which a specified shared library API (Application Programming Interface) belongs is mapped to a process space of a memory, and the mapped shared library is stored with a start address of the mapped shared library. A library that records a jump destination address of a jump instruction corresponding to the shared library API according to the designation belonging to the specification and rewrites the jump instruction having the recorded jump destination address into an interrupt instruction that jumps to a kernel jump system call An API entry rewriting unit;
The jump destination address of the jump instruction of the kernel jump system call entry corresponding to the interrupt instruction rewritten by the library API entry rewriting unit is recorded, and the jump destination address of the library API entry rewriting unit corresponds to the rewritten interrupt instruction. System call entry rewriting for rewriting the jump instruction set in the entry of the system call for kernel jump into the predetermined jump instruction to an arbitrary code execution unit that executes predetermined processing by being called by a predetermined jump instruction And an entry rewriting device.
前記エントリ書換装置は、さらに、
共有ライブラリAPIに対する所定の実行条件を記憶する実行条件記憶部と、
前記任意コード実行部であって、前記所定のジャンプ命令によって呼ばれることで、前記実行条件記憶部が記憶する前記実行条件に基づいて、前記所定の処理を実行する任意コード実行部と
を備えたことを特徴とする請求項1記載のエントリ書換装置。
The entry rewriting device further includes:
An execution condition storage unit that stores predetermined execution conditions for the shared library API;
The arbitrary code execution unit, comprising: an arbitrary code execution unit that executes the predetermined process based on the execution condition stored in the execution condition storage unit when called by the predetermined jump instruction The entry rewriting device according to claim 1.
前記エントリ書換装置は、さらに、
所定の共有ライブラリAPIに関する情報を記憶するシンボルテーブル記憶部を備え、
前記任意コード実行部は、
前記所定のジャンプ命令によって呼ばれた場合に、前記シンボルテーブル記憶部に記憶された情報を参照することによりどの前記共有ライブラリAPIから呼び出されたのかを判別し、判別した前記共有ライブラリAPIに対応する実行条件を前記実行条件記憶部から抽出し、抽出した前記共有ライブラリAPIに対応する前記実行条件に基づいて、前記所定の処理を実行することを特徴とする請求項2記載のエントリ書換装置。
The entry rewriting device further includes:
A symbol table storage unit for storing information on a predetermined shared library API;
The arbitrary code execution unit
When called by the predetermined jump instruction, it is determined which shared library API is called by referring to information stored in the symbol table storage unit, and corresponds to the determined shared library API. 3. The entry rewriting device according to claim 2, wherein an execution condition is extracted from the execution condition storage unit, and the predetermined process is executed based on the execution condition corresponding to the extracted shared library API.
前記任意コード実行部は、
判別した前記共有ライブラリAPIに対応する実行条件を前記実行条件記憶部から抽出した場合に、抽出した前記共有ライブラリAPIに対応する前記実行条件が呼び出された前記共有ライブラリAPIの状態に合致するかどうかを判別し、合致すると判別した場合に、抽出した前記共有ライブラリAPIに対応する前記実行条件に基づいて前記所定の処理を実行することを特徴とする請求項3記載のエントリ書換装置。
The arbitrary code execution unit
Whether or not the execution condition corresponding to the extracted shared library API matches the state of the called shared library API when the execution condition corresponding to the determined shared library API is extracted from the execution condition storage unit 4. The entry rewriting device according to claim 3, wherein when the two are determined to match, the predetermined processing is executed based on the execution condition corresponding to the extracted shared library API.
前記エントリ書換装置は、さらに、
アプリケーションプロセスごとにシンボル名と前記シンボルの開始アドレスとが記載され、バックトレースの実行に使用される個別シンボルテーブルを記憶する個別シンボルテーブル記憶部と、
前記個別シンボルテーブル記憶部が記憶する前記個別シンボルテーブルを用いることにより、前記共有ライブラリAPIがどの関数を経由して呼び出されたかを特定する処理を示すバックトレースを実行するバックトレース実行部と
を備えたことを特徴とする請求項4記載のエントリ書換装置。
The entry rewriting device further includes:
An individual symbol table storage unit that stores a symbol name and a start address of the symbol for each application process, and stores an individual symbol table used for backtrace execution
A backtrace execution unit that executes a backtrace indicating processing for specifying which function the shared library API is called by using the individual symbol table stored in the individual symbol table storage unit. The entry rewriting device according to claim 4, wherein:
コンピュータを、
指定された共有ライブラリAPI(Application Programming Interface)の属する共有ライブラリを示す所属共有ライブラリをメモリのプロセス空間にマップし、マップされた前記所属共有ライブラリの先頭アドレスを保持し、マップされた前記所属共有ライブラリに属する前記指定に係る前記共有ライブラリAPIに対応するジャンプ命令のジャンプ先アドレスを記録すると共に、記録した前記ジャンプ先アドレスを持つ前記ジャンプ命令をカーネル飛び込み用システムコールへジャンプする割込命令に書き換えるライブラリAPIエントリ書換部、
前記ライブラリAPIエントリ書換部が書き換えた割込命令に対応する前記カーネル飛び込み用システムコールのエントリのジャンプ命令のジャンプ先アドレスを記録すると共に、前記ライブラリAPIエントリ書換部が書き換えた割込命令に対応する前記カーネル飛び込み用システムコールの前記エントリに設定されている前記ジャンプ命令を、所定のジャンプ命令によって呼ばれることで所定の処理を実行する任意コード実行部への前記所定のジャンプ命令に書き換えるシステムコールエントリ書換部、
として機能させるためのエントリ書換プログラム。
Computer
A shared library indicating a shared library to which a specified shared library API (Application Programming Interface) belongs is mapped to a process space of a memory, and the mapped shared library is stored with a start address of the mapped shared library. A library that records a jump destination address of a jump instruction corresponding to the shared library API according to the designation belonging to the specification and rewrites the jump instruction having the recorded jump destination address into an interrupt instruction that jumps to a kernel jump system call API entry rewriting part,
The jump destination address of the jump instruction of the kernel jump system call entry corresponding to the interrupt instruction rewritten by the library API entry rewriting unit is recorded, and the jump destination address of the library API entry rewriting unit corresponds to the rewritten interrupt instruction. System call entry rewriting for rewriting the jump instruction set in the entry of the system call for kernel jump into the predetermined jump instruction to an arbitrary code execution unit that executes predetermined processing by being called by a predetermined jump instruction Part,
Entry rewriting program to function as
JP2011023430A 2011-02-06 2011-02-06 Entry rewriting device and entry rewriting program Expired - Fee Related JP5550578B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011023430A JP5550578B2 (en) 2011-02-06 2011-02-06 Entry rewriting device and entry rewriting program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011023430A JP5550578B2 (en) 2011-02-06 2011-02-06 Entry rewriting device and entry rewriting program

Publications (2)

Publication Number Publication Date
JP2012164098A JP2012164098A (en) 2012-08-30
JP5550578B2 true JP5550578B2 (en) 2014-07-16

Family

ID=46843435

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011023430A Expired - Fee Related JP5550578B2 (en) 2011-02-06 2011-02-06 Entry rewriting device and entry rewriting program

Country Status (1)

Country Link
JP (1) JP5550578B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6061763B2 (en) * 2013-04-09 2017-01-18 三菱電機株式会社 Unit test support device and unit test support program
US20210390183A1 (en) * 2018-10-11 2021-12-16 Nippon Telegraph And Telephone Corporation Analysis function imparting device, analysis function imparting method, and recording medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10269105A (en) * 1997-01-27 1998-10-09 N T T Data Tsushin Kk Trace system, resource release omission detection system, and recording medium
JP2000076095A (en) * 1998-08-28 2000-03-14 Fujitsu Ltd Device and method for tracing program and storage medium storing program therefor
JP4833792B2 (en) * 2006-10-23 2011-12-07 ルネサスエレクトロニクス株式会社 Data analysis system
JP2009237610A (en) * 2008-03-25 2009-10-15 Ntt Docomo Inc Code converter and code conversion method

Also Published As

Publication number Publication date
JP2012164098A (en) 2012-08-30

Similar Documents

Publication Publication Date Title
US20230094191A1 (en) Scalable execution tracing for large program codebases
US8627296B1 (en) Unified unit and integration test with automatic mock creation
US9740586B2 (en) Flexible configuration and control of a testing system
US20180024911A1 (en) Software code debugger for quick detection of error root causes
US7530056B1 (en) Method and system for detecting runtime defects in a program by comparing correct and incorrect runs
US20040243882A1 (en) System and method for fault injection and monitoring
US9274930B2 (en) Debugging system using static analysis
US10176077B2 (en) Generating breakpoints for cross-layer debugging
US11042466B2 (en) Exception prediction before an actual exception during debugging
JPWO2019077738A1 (en) Data verification device, data verification method, and data verification program
CN111428233A (en) Security analysis method for embedded equipment firmware
JP5550578B2 (en) Entry rewriting device and entry rewriting program
US20070150866A1 (en) Displaying parameters associated with call statements
KR20180129623A (en) Apparatus for statically analyzing assembly code including assoxiated multi files
CN111385661B (en) Method, device, terminal and storage medium for voice control of full screen playing
US10872027B2 (en) Run-time or compile-time error solutions for locating missing program elements in a programming environment
US9058184B2 (en) Run time generation and functionality validation of device drivers
Wu et al. CydiOS: A Model-Based Testing Framework for iOS Apps
US20150026523A1 (en) Debugging method and computer program product
US9632912B1 (en) Method and system for debugging a program
JP2022150518A (en) Test processing program, test processing method, and information processing apparatus
JP2016126700A (en) Program verification device, program verification method, and program verification program
US9697018B2 (en) Synthesizing inputs to preserve functionality
CN111740876B (en) Application device, test method, storage medium and electronic equipment
JP2020038482A (en) Program verification program, program verification method and program verification device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20131009

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140410

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140422

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140520

R150 Certificate of patent or registration of utility model

Ref document number: 5550578

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees