JPH02304635A - Program runaway detecting system - Google Patents
Program runaway detecting systemInfo
- Publication number
- JPH02304635A JPH02304635A JP1125784A JP12578489A JPH02304635A JP H02304635 A JPH02304635 A JP H02304635A JP 1125784 A JP1125784 A JP 1125784A JP 12578489 A JP12578489 A JP 12578489A JP H02304635 A JPH02304635 A JP H02304635A
- Authority
- JP
- Japan
- Prior art keywords
- program
- return address
- stack
- processing
- return
- 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.)
- Granted
Links
- 238000001514 detection method Methods 0.000 claims description 3
- 238000000034 method Methods 0.000 description 13
- 238000010586 diagram Methods 0.000 description 6
- 238000004458 analytical method Methods 0.000 description 1
- 239000000470 constituent Substances 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 230000007257 malfunction Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
Abstract
Description
【発明の詳細な説明】
〔概要〕
計算機システムにおいて、メインルーチンとサブルーチ
ンあるいはサブルーチンとサブルーチンなどの間の連係
処理を行う際のプログラム暴走の検知方式に関し。DETAILED DESCRIPTION OF THE INVENTION [Summary] The present invention relates to a method for detecting program runaway when performing linked processing between a main routine and a subroutine, or between subroutines, etc. in a computer system.
呼び出し先のプログラムから呼び出し元のプログラムへ
のリターンアドレスの正当性をチェジクする手段を設け
ることによって、プログラム暴走の早期検知を可能にし
、またプログラム暴走による被害を最小限に抑制するこ
とを目的とし。The purpose of this invention is to enable early detection of program runaway and to minimize damage caused by program runaway by providing a means for checking the validity of the return address from the called program to the calling program.
実行中のプログラムから他のプログラムを呼び出す際リ
ターンアドレス等をスタックに退避して管理し、複数の
プログラムの間の連係処理を行う計算機システムにおい
て、呼び出されたプログラムは、上記スタックからリタ
ーンアドレスを読み出してメモリの所定の領域に複写し
てから本来の処理を実行し、その本来の処理終了後に上
記スタックから再びリターンアドレスを読み出して、こ
れを上記メモリの所定の領域に複写してあるリタ−ンア
ドレスと比較し、不一致の場合にはプログラムの暴走と
判定する構成をもつ。In a computer system that saves and manages return addresses, etc. on a stack when calling another program from a running program, and performs coordination processing between multiple programs, the called program reads the return address from the stack. The return address is copied to a predetermined area of the memory, then the original processing is executed, and after the original processing is finished, the return address is read from the stack again, and this is copied to the predetermined area of the memory. It is configured to compare it with the address and determine that the program has runaway if there is a mismatch.
本発明は、計算機システムにおいて、メインルーチンと
サブルーチンあるいはサブルーチンとサブルーチンなど
の間の連係処理を行う際のプログラム暴走の検知方式に
関する。The present invention relates to a method for detecting program runaway when performing linked processing between a main routine and a subroutine, or between subroutines, etc. in a computer system.
第4図(alに、プログラムの連係処理の1例を示す6
図示された例は、メインルーチンAが処理中にサブルー
チンBを呼び出し、またサブルーチンBはその処理にお
いてさらにサブルーチンCを呼び出すものである。Figure 4 (al) shows an example of program linkage processing.
In the illustrated example, main routine A calls subroutine B during processing, and subroutine B further calls subroutine C during its processing.
これらのサブルーチンの呼び出しを行う場合には、呼び
出し時に復帰情報の退避が行われる。復帰情報にはリタ
ーンアドレスやレジスタ情報などが含まれ、呼び出し先
のサブルーチンにおいて処理を終了したとき、先に退避
した復帰情報を取り出して、それに基づき呼び出し元の
メインルーチンあるいはサブルーチンの処理を再開する
。When calling these subroutines, return information is saved at the time of the call. The return information includes a return address, register information, etc. When the called subroutine finishes processing, the previously saved return information is retrieved, and based on that, the caller's main routine or subroutine resumes processing.
第4図+alに示されている連係処理のように、サブル
ーチンの呼び出しが多重に行われる場合、退避される復
帰情報も多重になるので、その退避。When subroutines are called multiple times, as in the linked process shown in FIG.
復元の制御を迅速に行う必要がある。従来はこれらの復
帰情報の管理を、第4図(blに示すようなスタックお
よびスタックポインタを用いてO8の制御のもとで行っ
ている。このスタックは後入れ先出し法で構成されてい
る。Restoration needs to be controlled quickly. Conventionally, the management of this return information has been carried out under the control of the O8 using a stack and stack pointer as shown in FIG.
第4図Cb)において、■はメインルーチンAの実行中
のスタックの状態であり、空となっている。In FIG. 4Cb), ■ is the state of the stack while main routine A is being executed, and is empty.
■はメインルーチンAがサブルーチンBを呼び出したと
きのスタックの状態であり、 “A″は退避されたメイ
ンルーチンAの復帰情報を示す、■はサブルーチンBが
サブルーチンCを呼び出したときのスタックの状態であ
り、 “B”は退避されたサブルーチンBへの復帰情報
を示す。■はサブルーチンCからサブルーチンBへ復帰
するときのスタックの状態であり、スタックから“B”
が取り出されて用いられる。そして■はサブルーチンB
からメインルーチンAへ復帰するときのスタックの状態
であり、スタックから“A″が取り出されて用いられる
。■ is the state of the stack when main routine A calls subroutine B, "A" indicates the saved return information of main routine A, and ■ is the state of the stack when subroutine B calls subroutine C. where "B" indicates return information to the saved subroutine B. ■ is the state of the stack when returning from subroutine C to subroutine B, and “B” is returned from the stack.
is extracted and used. And ■ is subroutine B
This is the state of the stack when returning from main routine A to main routine A, and "A" is taken out from the stack and used.
従来の計算機システムでは、プログラムの連係処理にお
いて、プログラムミスによりプログラムが暴走してスタ
ックのポインタがずれたり、スタックの値が破壊される
ことがあり、この状態で呼び出し先のプログラムからリ
ターン命令を実行すると、呼び出し先のプログラムから
呼び出し元のプログラムへ誤った復帰が行われ、プログ
ラムの暴走によるメモリの内容破壊等の被害を拡大する
とともに、バグの発見を困難にした。In conventional computer systems, during program linkage processing, a program error may cause the program to run out of control, causing the stack pointer to shift or the stack value to be destroyed. In this state, a return instruction is executed from the called program. As a result, the called program incorrectly returns to the calling program, causing damage such as memory contents being destroyed due to runaway programs, and making it difficult to discover bugs.
本発明は、プログラム連係処理において、呼び出し先の
プログラムから呼び出し元のプログラムへのリターンア
ドレスの正当性をチェックする手段を設けること、によ
って、プログラム暴走の早期検知を可能にし、またプロ
グラム暴走による被害を最小限に抑制することを目吟と
している。The present invention enables early detection of program runaway and prevents damage caused by program runaway by providing means for checking the validity of the return address from the called program to the calling program in program linkage processing. The aim is to keep it to a minimum.
本発明は、プログラムの呼び出しが行われたとき、呼び
出し先のプログラムがスタックに退避されているリター
ンアドレスをメモリに複写しておき、処理終了時に、ス
タックから取り出したリターンアドレスを、メモリに複
写してあるアドレスと比較し2両者が一致した場合にス
タックのリターンアドレスを正当なものと判定し、また
両者が不一致の場合には暴走と認識するようにしたもの
である。In the present invention, when a program is called, the called program copies the return address saved on the stack into memory, and when processing ends, copies the return address retrieved from the stack into memory. The return address of the stack is compared with a certain address if the two match, and the return address of the stack is determined to be valid, and if the two do not match, it is recognized as a runaway.
第1図は本発明の原理図である。FIG. 1 is a diagram showing the principle of the present invention.
図において。In fig.
1は、メインルーチンあるいはサブルーチンなどの呼び
出し元プログラムである。1 is a calling program such as a main routine or subroutine.
2は、サブルーチンなどの呼び出し先プログラムである
。2 is a called program such as a subroutine.
2a、2b、2c・は、呼び出し先プログラム2の構成
部分であり、2aはプログラムの先頭部分に置かれるリ
ターンアドレス複写処理、2bは本来の処理、2Cはリ
ターン命令の直前に置かれるリターンアドレス正当性チ
ェック処理である。2a, 2b, and 2c are the constituent parts of the called program 2, where 2a is the return address copying process placed at the beginning of the program, 2b is the original process, and 2C is the return address validating process placed just before the return instruction. This is a gender check process.
3は、リターンアドレスを退避するスタックである。3 is a stack for saving the return address.
4は、メモリのリターンアドレス複写領域である。4 is a return address copy area of the memory.
呼び出し先のプログラム2のリターンアドレス複写処理
では、スタック3に退避されたリターンアドレスを一旦
取り出して、メモリのリターンアドレス複写領域4に複
写し、スタック3には再びリターンアドレスを積み戻す
。In the return address copying process of the called program 2, the return address saved in the stack 3 is once taken out, copied to the return address copy area 4 of the memory, and the return address is loaded back onto the stack 3.
リターンアドレス正当性チェック処理では、スタック3
から取り出したリターンアドレスを、リターンアドレス
複写領域4に複写されているリターンアドレスと比較し
、スタックのリターンアドレスの正当性を判断する。一
致の場合は正当として、呼び出し元プログラム1への復
帰を実行し。In the return address validity check process, stack 3
The return address taken out from the stack is compared with the return address copied in the return address copy area 4 to determine the validity of the return address in the stack. If they match, it is assumed to be valid and a return to the calling program 1 is executed.
不一致の場合はリターンアドレスのエラーとしてプログ
ラムの暴走状態にあるものとP!識し、プロダラムの停
止とエラー処理ルーチンによるエラー処理等を行わせる
。If they do not match, it is considered a return address error and the program is running out of control. This causes the program to stop and the error handling routine to perform error handling.
プログラム呼び出しによる処理中、何らかのプログラム
のバグによりプログラムが暴走して、スタックポインタ
がずれたリスタックの内容が破壊されると、リターンア
ドレスが変化する0本発明はこれを呼び出し先プログラ
ムの処理開始時に複写したリターンアドレスを用いて正
当性をチェックすることにより簡単に検出することがで
きる。During processing by a program call, if the program goes out of control due to some program bug and the stack pointer shifts and the restack contents are destroyed, the return address will change.0 The present invention copies this when the called program starts processing. This can be easily detected by checking the validity using the returned address.
プログラム呼び出しが多重に行われる場合には。When multiple program calls are made.
それぞれの呼び出し先のプログラムにおいて、このリタ
ーンアドレスの正当性をチェックする処理を行う。Each called program performs processing to check the validity of this return address.
第2図は本発明の1実施例による計算機システムの構成
図であり1本発明に関連する要素のみを簡単化して示し
たものである。FIG. 2 is a configuration diagram of a computer system according to an embodiment of the present invention, and only elements related to the present invention are shown in a simplified manner.
図において、5はCPU、6はレジスタ〔R1〕、7は
スタックポインタ、8はスタック領域のあるメモリ(1
)、9はデータ格納領域のあるメモリ (2)、10は
リターンアドレス複写領域〔M1〕である。In the figure, 5 is the CPU, 6 is the register [R1], 7 is the stack pointer, and 8 is the memory with the stack area (1
), 9 is a memory (2) with a data storage area, and 10 is a return address copy area [M1].
第3図は本発明の1実施例によるメインルーチン11と
サブルーチン12の連係プログラムのフ・ローを示した
ものである。これらは第2図の計算機システムのもとで
実行される。以下にその動作を説明する。FIG. 3 shows the flow of a linked program of the main routine 11 and subroutine 12 according to one embodiment of the present invention. These are executed under the computer system shown in FIG. The operation will be explained below.
メインルーチン11は処理Aとサブルーチンコールによ
る処理と、処理Bとにより構成されている。The main routine 11 is composed of processing A, processing by subroutine calls, and processing B.
サブルーチンコールが発行されると1図示されていなし
NO3は、スタックポインタ7によりポイントされるメ
モリ 〔1〕のスタック領域にリターンアドレスを退避
し、サブルーチン12を起動する。サブルーチンには2
次の■ないし■のステップを実行する。When a subroutine call is issued, No. 3 (not shown) saves the return address to the stack area of memory [1] pointed to by the stack pointer 7, and starts the subroutine 12. The subroutine has 2
Execute the following steps ■ or ■.
■、サブルーチン12は、まず命令POP R1を実
行する。この命令は、スタックから最上部のリターンア
ドレスをポンプアップしてレジスタ(R1)に格納する
。(2) The subroutine 12 first executes the instruction POP R1. This instruction pumps up the top return address from the stack and stores it in register (R1).
00次にサブルーチン12は、命令PUSHR1を実行
する。この命令は、レジスタ〔R1〕のリターンアドレ
スをスタックにブツシュし、積み戻す、このときレジス
タ〔R1〕には先のリターンアドレスが残されている。00 Next, the subroutine 12 executes the instruction PUSHR1. This instruction pushes the return address of register [R1] onto the stack and backs it up. At this time, the previous return address remains in register [R1].
00次にレジスタ〔R1〕のリターンアドレスをリター
ンアドレス複写領域(Ml)に格納する。00 Next, the return address of register [R1] is stored in the return address copy area (Ml).
■、サブルーチン12は1本来の処理Cを実行する。(2) Subroutine 12 executes the original process C of 1.
■、処理Cの終了後、命令POP R1を実行し。(2) After completing processing C, execute command POP R1.
スタックからリターンアドレスをポンプアップしレジス
タ〔R1〕に格納する。Pump up the return address from the stack and store it in register [R1].
■、続いて命令PUSHR1を実行し、リターンアドレ
スをスタックに積み戻す。(2) Next, execute the instruction PUSHR1 and load the return address back onto the stack.
■、レジスタ(R1)の内容とリターンアドレス複写領
域〔M1〕の内容とを比較する。(2) Compare the contents of the register (R1) and the contents of the return address copy area [M1].
■、■の比較でR1=M1であれば1図示省略されてい
るリターン命令を実行し、スタックのリターンアドレス
を用いてO8により復帰制御が行われる。Comparing (2) and (2), if R1=M1, a return instruction (not shown) is executed, and return control is performed by O8 using the return address of the stack.
■、■の比較でR1≠M1であればプログラムを停止す
る。Comparing (2) and (2), if R1≠M1, the program is stopped.
メインルーチン11への復帰が行われた場合には、リタ
ーンアドレスから処理Bが実行される。When returning to the main routine 11, processing B is executed from the return address.
本発明によれば、複数のプログラムの連係処理において
、プログラム中のバグの発見を早期に行うことができ、
またバグを含むプログラムの特定が容易となりバグ解析
調査を効率化することができる。さらにバグによる誤動
作の拡大が防止できる利点がある。According to the present invention, bugs in a program can be discovered early in cooperative processing of a plurality of programs.
Additionally, programs containing bugs can be easily identified, making bug analysis and investigation more efficient. Another advantage is that malfunctions caused by bugs can be prevented from expanding.
第1図は本発明の原理図、第2図は本発明の1実施例に
よる計算機システムの構成図、第3図は本発明の1実施
例によるプログラムのフロー図。
第4図は従来のプログラム連係処理の説明図である。
第1図中
1:呼び出し元プログラム
2:呼び出し先プログラム
2a:リターンアドレス複写処理
2b:本来の処理
2C:リターンアドレス正当性チェック処理3ニスタツ
ク
4:リターンアドレス複写領域
特許出願人株式会社 ビーエフニー
化 理 人 弁理士 長谷用 文廣(外2名)本号計日
月の原工甲−
第1図
*!ffa月の1突先牙11:Iる名+1じ9(システ
ムの不茸万Y兼2図FIG. 1 is a principle diagram of the present invention, FIG. 2 is a configuration diagram of a computer system according to an embodiment of the present invention, and FIG. 3 is a flow diagram of a program according to an embodiment of the present invention. FIG. 4 is an explanatory diagram of conventional program linkage processing. 1 in Figure 1: Caller program 2: Callee program 2a: Return address copy process 2b: Original process 2C: Return address validity check process 3 stack 4: Return address copy area Patent applicant: Bfn Corporation Manager Patent attorney Fumihiro Hase (2 others) This issue includes Sun and Moon Hara Koko - Figure 1 *! ffa month 1 prong fang 11: I run name + 1ji 9 (system futakeman Y cum 2 figures
Claims (1)
リターンアドレス等の復帰情報をスタックに退避して管
理し,複数のプログラムの間の連係処理を行う計算機シ
ステムにおいて,呼び出されたプログラムは,上記スタ
ックからリターンアドレスを読み出してメモリの所定の
領域に複写してから本来の処理を実行し,その本来の処
理終了後に上記スタックから再びリターンアドレスを読
み出して,これを上記メモリの所定の領域に複写してあ
るリターンアドレスと比較し,不一致の場合にはプログ
ラムの暴走と判定することを特徴とするプログラム暴走
検知方式。In a computer system that saves and manages return information such as return addresses on a stack when calling another program from a running program, and performs linked processing between multiple programs, the called program returns from the stack. After reading the address and copying it to a predetermined area of the memory, the original processing is executed, and after the original processing is finished, the return address is read again from the stack and is copied to the predetermined area of the memory. A program runaway detection method that compares with the return address and determines that the program has runaway if they do not match.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1125784A JPH0731617B2 (en) | 1989-05-19 | 1989-05-19 | Program runaway detection method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1125784A JPH0731617B2 (en) | 1989-05-19 | 1989-05-19 | Program runaway detection method |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH02304635A true JPH02304635A (en) | 1990-12-18 |
JPH0731617B2 JPH0731617B2 (en) | 1995-04-10 |
Family
ID=14918772
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP1125784A Expired - Lifetime JPH0731617B2 (en) | 1989-05-19 | 1989-05-19 | Program runaway detection method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH0731617B2 (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04263340A (en) * | 1991-02-18 | 1992-09-18 | Fujitsu Ltd | Execution monitoring point decreasing system |
JPH0738159B2 (en) * | 1991-03-07 | 1995-04-26 | ディジタル イクイップメント コーポレイション | Method and apparatus for processing computer code in a code translator |
JPH08161202A (en) * | 1994-12-09 | 1996-06-21 | Matsushita Electric Ind Co Ltd | Program runaway detection method and program runaway detector |
WO2005024630A1 (en) * | 2003-09-04 | 2005-03-17 | Science Park Corporation | False code prevention method and prevention program |
JP2010224908A (en) * | 2009-03-24 | 2010-10-07 | Fujitsu Semiconductor Ltd | Information processor and data restoration method |
JP2015011436A (en) * | 2013-06-27 | 2015-01-19 | 株式会社デンソー | Processor |
JP2018114181A (en) * | 2017-01-19 | 2018-07-26 | 株式会社オリンピア | Game machine |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS59220849A (en) * | 1983-05-31 | 1984-12-12 | Toshiba Corp | Image comparison control system |
JPS61202234A (en) * | 1985-03-06 | 1986-09-08 | Fujitsu Ltd | Address control circuit |
JPS63136144A (en) * | 1986-11-27 | 1988-06-08 | Oki Electric Ind Co Ltd | Runaway detecting method for computer |
-
1989
- 1989-05-19 JP JP1125784A patent/JPH0731617B2/en not_active Expired - Lifetime
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS59220849A (en) * | 1983-05-31 | 1984-12-12 | Toshiba Corp | Image comparison control system |
JPS61202234A (en) * | 1985-03-06 | 1986-09-08 | Fujitsu Ltd | Address control circuit |
JPS63136144A (en) * | 1986-11-27 | 1988-06-08 | Oki Electric Ind Co Ltd | Runaway detecting method for computer |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04263340A (en) * | 1991-02-18 | 1992-09-18 | Fujitsu Ltd | Execution monitoring point decreasing system |
JPH0738159B2 (en) * | 1991-03-07 | 1995-04-26 | ディジタル イクイップメント コーポレイション | Method and apparatus for processing computer code in a code translator |
JPH08161202A (en) * | 1994-12-09 | 1996-06-21 | Matsushita Electric Ind Co Ltd | Program runaway detection method and program runaway detector |
WO2005024630A1 (en) * | 2003-09-04 | 2005-03-17 | Science Park Corporation | False code prevention method and prevention program |
JPWO2005024630A1 (en) * | 2003-09-04 | 2007-11-08 | サイエンスパーク株式会社 | Method and program for preventing illegal code |
KR100777938B1 (en) * | 2003-09-04 | 2007-11-21 | 싸이언스 파크 가부시키가이샤 | False code execution prevention method and recording medium of false code execution prevention programs |
JP4518564B2 (en) * | 2003-09-04 | 2010-08-04 | サイエンスパーク株式会社 | Method for preventing unauthorized code execution, program for preventing unauthorized code execution, and recording medium for program for preventing unauthorized code execution |
US8042179B2 (en) | 2003-09-04 | 2011-10-18 | Science Park Corporation | False code execution prevention method, program for the method, and recording medium for recording the program |
JP2010224908A (en) * | 2009-03-24 | 2010-10-07 | Fujitsu Semiconductor Ltd | Information processor and data restoration method |
JP2015011436A (en) * | 2013-06-27 | 2015-01-19 | 株式会社デンソー | Processor |
JP2018114181A (en) * | 2017-01-19 | 2018-07-26 | 株式会社オリンピア | Game machine |
Also Published As
Publication number | Publication date |
---|---|
JPH0731617B2 (en) | 1995-04-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5097533A (en) | System and method for interfacing computer application programs written in different languages to a software system | |
JP2010522932A (en) | Bookmarks and configuration files for the installation sequence | |
US5828890A (en) | System for interrupting program operation when an out-of-range value is encountered to correct a data value | |
JPH02304635A (en) | Program runaway detecting system | |
JPH03184123A (en) | Procedure state description element system for digital data processor | |
JPH04332055A (en) | Method for detecting program runaway | |
JPH0895772A (en) | Computer system and program substituting method | |
US11334627B2 (en) | Data processing | |
JPH08249206A (en) | Computer with stack area destruction detection function | |
JPH04242832A (en) | Information processor | |
JPH05143427A (en) | Information processing system | |
JPH06131212A (en) | Computer controlling method for tracking execution of target program with regard to calling of target program with other program | |
JPH01201728A (en) | Program correcting system | |
JPH04225442A (en) | Matching property check method for computer file system | |
JPH04181321A (en) | Microprogram loading system | |
JPH01214934A (en) | System for detecting indirect recursive calling of program | |
JPH01116851A (en) | Program load control system | |
JPS5920055A (en) | Retrial system of branch instruction | |
JPH03132823A (en) | Stacking system for data peculiar to procedure | |
JPS63213029A (en) | Microprogram controller | |
JPH01114947A (en) | Tracing system for data processor | |
JPH04354019A (en) | Sort processor | |
JPH0452825A (en) | Updating processing method for system definition information | |
JPH0475144A (en) | Error recovery system for computer system | |
JPS63228341A (en) | Program syntax checking system |