WO2005020069A1 - コンピュータシステムのcpu(中央処理装置) - Google Patents

コンピュータシステムのcpu(中央処理装置) Download PDF

Info

Publication number
WO2005020069A1
WO2005020069A1 PCT/JP2004/012165 JP2004012165W WO2005020069A1 WO 2005020069 A1 WO2005020069 A1 WO 2005020069A1 JP 2004012165 W JP2004012165 W JP 2004012165W WO 2005020069 A1 WO2005020069 A1 WO 2005020069A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
cpu
stack
stack register
program
Prior art date
Application number
PCT/JP2004/012165
Other languages
English (en)
French (fr)
Inventor
Kiyoto Yui
Original Assignee
Denki Hompo Ltd.
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 Denki Hompo Ltd. filed Critical Denki Hompo Ltd.
Priority to JP2005513345A priority Critical patent/JPWO2005020069A1/ja
Publication of WO2005020069A1 publication Critical patent/WO2005020069A1/ja

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3804Instruction prefetching for branches, e.g. hedging, branch folding
    • G06F9/3806Instruction prefetching for branches, e.g. hedging, branch folding using address prediction, e.g. return stack, branch history buffer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1416Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights
    • G06F12/1425Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights the protection being physical, e.g. cell, word, block
    • G06F12/1441Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights the protection being physical, e.g. cell, word, block for a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/71Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information

Definitions

  • CPU central processing unit
  • the present invention relates to a CPU (central processing unit) of a highly secure computer system that is not easily infected by computer viruses.
  • Non-Patent Documents 1-14 Computer systems and acts by malicious network connection persons are described in Non-Patent Documents 1-14, respectively.
  • Non Patent Literature 1 "Hacker 'Programming Great", by UNYUN
  • Non-Patent Document 2 "OPERATING SYSTEM Internals and Design J, by William S talings, Ph. D.
  • Non-Patent Document 3 "Intel's Optimization Technology Manual”
  • Non-Patent Document 4 "IA-32 Intel Architecture Software Developer's Manua
  • One of the causes of security holes is said to be the buffer overrun phenomenon.
  • the maximum number of characters that can be entered in the addressee's mail address is 50 characters.
  • FIG. 1 is a diagram schematically showing the configuration of a storage device (also called a memory) used when executing a program in a general computer.
  • a storage device also called a memory
  • the program is stored in area Al. Then, areas A12, A13 and A14 are secured as areas used for data processing of the program. Of these, area A12 is used to read and write data used by the entire program. Area A13 is used when it is desired to secure a data area at the time of program execution, and the area in memory is expanded or contracted during program execution. Area A14 is a special memory area called a stack memory, which manages execution of small and structured programs called subroutines that constitute programs and manages data used temporarily by subroutines. Area for
  • the subroutine is defined as follows in this document.
  • a subroutine is defined as a program which stores the start address of the next program to be executed when the subroutine has been executed in advance in the stack memory and executes the program.
  • a subroutine call indicates that this subroutine is called, that is, executed.
  • FIG. 2 schematically shows the function of the stack memory of area A14 together with the sample program.
  • the sample program is written in c language.
  • the sample program is configured to call a subroutine (child program) named test on line 12 of the program and execute it. Also, when the subroutine is executed, four data called arguments are passed. That is, the arguments are four: ' ⁇ ', ⁇ ',' S ', and' T '. These data are written to the areas ⁇ 21, ⁇ 22, ⁇ 23, ⁇ 24 on the stack memory.
  • control is transferred to the subroutine 'test'.
  • address data indicating the third line of the program 13 is stored in the area A25 of the stack memory so that control returns to the 13th line of the program after completion of the subroutine execution.
  • the memory area where the variable s exists is intentionally addressed, and it is instructed to write 100 characters of zero (0) to the memory from there. That is, when this is executed, the entire contents of 100 characters including the areas A21 to A26 will be overwritten to zero, and the program flow will be destroyed as a result.
  • the phenomenon that is illegally written beyond the originally set memory area is called a buffer overrun.
  • a vulnerability exists in the present CPU (central processing unit), and computer viruses and unauthorized access illegally act on computer systems using the phenomenon described above.
  • computer viruses and unauthorized access when overwriting memory, write the memory address to your own convenience, direct the control of the program to be transferred to it, and make the unauthorized work work. ing.
  • the present invention has been made under the circumstances as described above, and prevents buffer overrun phenomenon which is said to be a cause of security holes, and suppresses computer viruses and unauthorized access.
  • the purpose is to provide a CPU (central processing unit) of a computer system that can
  • the CPU (central processing unit) of the computer system indicates which address of the storage device is currently used, and every time the storage device is used,
  • a CPU (central processing unit) of a computer system comprising a plurality of stack register devices having a function of calculating values so as to indicate addresses of unused storage devices, the first stack used for processing data used by a program.
  • the present invention is characterized by at least comprising: a register device; and a second stack register device used to store a return address to be written when making a subroutine call.
  • the second stack register device dedicated to the address processing is provided, and the address data for determining the flow of the program is stored on the stack, so the data other than the address is stored. Even if one stack register device is illegally overwritten and there is a risk that a buffer overflow phenomenon may occur, it is possible to prevent an unauthorized change in the flow of the whole program.
  • the present invention it is possible to limit the damage within the stack device for data processing when the data on the stack is continuously overwritten and the contents are destroyed due to the failure of the program. As a result, it is possible to protect the contents of the address storage dedicated stack and to prevent an unauthorized change in the flow of the whole program even if there is a risk that a buffer overflow phenomenon may occur.
  • FIG. 3 is an example of a schematic configuration diagram of a CPU according to the present invention. This configuration is based on the configuration of a CPU called IA32 from Intel Corporation.
  • the register 'set 100a indicates a set of general-purpose registers possessed by the CPU.
  • An instruction register (Instruction Register) 100b stores an instruction read by the CPU 100 from memory and to be executed next, and according to the contents, control signals required by the CPU control unit 100d are internally and externally to the CPU. Distribute.
  • ALU (Arithmetic Logical Unit) 100 c is an arithmetic logic operation mechanism. That is, the logical operation and arithmetic operation required in CPU 100 are performed. Also, it exists inside the CPU 100 as a black box.
  • An address buffer 100e relays when the CPU 100 is connected to an external bus. That is, this mechanism relays address information to control the external bus.
  • the data buffer 100 f relays when the CPU 100 is connected to an external bus. That is, this mechanism relays data information to control the external bus.
  • the CPU 100 according to the present invention is characterized in the register set 100a, and is based on the configuration of the register 'set possessed by the IA 32, for example.
  • FIG. 4 is a schematic block diagram of the register set of the IA 32.
  • FIG. 5 is a schematic block diagram of the register set 100a based on the configuration of FIG.
  • the present invention can be applied to all CPUs provided with a stack register.
  • the present invention will be described by taking IA 32 as an example.
  • the register set 200a of the IA 32 shown in FIG. 4 includes a stack register Rl 1 (32-bit representation ESP register) and a program counter R12 (32-bit representation EIP register).
  • the program counter R12 indicates the memory address of the program that the CPU wants to execute from now.
  • EAX, EBX, ECX, EDX, ESI, EDI, and EBP registers in 32-bit expression names shown in the figure are general-purpose registers.
  • EAX, EBX, EDX are mainly for general operations use.
  • ECX is a general-purpose register that extends its functions for counter processing in addition to general operations.
  • ESI and EDI are general-purpose registers that enhance the function called index reference.
  • EBP is an abuse register with an enhanced function to be used in conjunction with stack register R11.
  • the register set 100a of the CPU 100 shown in FIG. 5 has a configuration in which an address processing dedicated stack register R3 (second stack register device) is added to the configuration of FIG. Also, as in the configuration of FIG. 4, a stack register R1 (first stack register device) and a program counter R2 are provided. However, stack register R1 shown in FIG. 5 is the stack register shown in FIG.
  • the reduced functions are processing (function) for storing the return address at the time of subroutine call on the stack, and processing (function) for acquiring the returned address stored at the end of subroutine call.
  • Other functions in stack register R1 are similar to those of stack register R11.
  • a dummy return address may be stored in the stack register R1 in order to maintain higher compatibility with a conventional computer program. However, in this case, only write to stack register R1 as a dummy, and do not use it as a program return value. What is used as the return value of the actual program is the value stored in the address processing stack register R3.
  • FIG. 6 schematically shows a configuration of a storage device used when executing a program in the CPU 100.
  • the memory area allocated to the executed program is shown. That is, as shown in the figure, program area A31, data area A32, heap area A33, stack area dedicated to address processing A37, stack area (stack area dedicated to data processing) A34, argument area A35, environment variables in order from address 0. Area A36, etc. are allocated.
  • an address processing dedicated stack area A37 is added.
  • the address processing dedicated stack area A37 is linked to the address processing dedicated stack register R3, and the address processing dedicated stack register R3 always indicates and stores the memory of the stack area A37.
  • the memory area where the variable s exists is intentionally instructed to write 100 characters of zero (0) to the memory, and when this is executed, A41 A46 The contents of all 100 characters are overwritten to zero, including:
  • the area A45 of the stack area A37 dedicated to address processing that determines the flow of the program is not affected because it is in an area different from the area where the zero is overwritten.
  • step S1 the content of the current program counter R2 is written to the address indicated by the address processing dedicated stack register R3 (step S1).
  • stack register R1 In a conventional CPU, stack register R1
  • step S2 Since data is written to the memory indicated by the address processing dedicated stack register R3, the content held by the address processing dedicated stack register R3 is subtracted to indicate an unused memory (step S2).
  • step S3 the address of the program to be subroutine called is set in the program counter R2 (step S3). Thereafter, the execution of the CPU shifts to a subroutine.
  • step S11 the address processing dedicated stack register R3 is activated. Subsequently, the process will be described based on the flowchart of FIG. The value held by the address processing dedicated stack register R3 is added so that the return address is indicated in step 31 of FIG. 8 (step S11).
  • step SI in Figure 8 The address written in step SI in Figure 8 is stored in the address indicated by the address processing stack register R3. This address (ie, the address indicated by the stack dedicated to address processing) is read (step S12).
  • step S11 the program counter R2 is set to the value read in step S11 (step S11).
  • the address processing dedicated stack register R3 is provided, and address data for determining the flow of the program is stored in the memory area indicated by the address processing dedicated stack register R3.
  • the configuration of the storage device used when executing the program shown in FIG. 6 is an example, and not limited to this. .
  • the same effect as that of the first embodiment can be obtained even if other configurations shown in FIGS. 10 to 13 are used.
  • the CPU 100 shown in the second embodiment is configured to include means for causing conventionally existing software to operate without any problem.
  • the conventional software only controls the stack register device which exists only in one CPU. Therefore, as in the first embodiment, if two stack register devices exist and always function, a malfunction will occur. Therefore, in the second embodiment, the configuration and operation of the CPU 100 which operates without any problem with conventional software will be described.
  • FIG. 14 is a schematic block diagram of a register set showing a second embodiment of a CPU of a computer system according to the present invention.
  • the configuration of FIG. 14 is described in the first embodiment.
  • a switch device R4 (including first and second switch devices) which is a register for setting the operating state of the CPU 100 is provided.
  • each register of the addition value storage device R5, the protection start address storage device R6, and the protection end address storage device R7 for storing and storing the predetermined value is newly provided.
  • each register (hereinafter referred to as an additional register group for convenience) of each of the switch device R4, the addition value storage device R5, the protection start address storage device R6, and the protection end address storage device R7 is a conventional one. It does not exist in the CPU, and is a characteristic configuration requirement of the CPU 100 according to the present invention, together with the address processing dedicated stack register R3.
  • segment register R8 and control registers R9 and R10 shown in FIG. 14 are provided in an existing CPU.
  • a simple method of controlling the additional register group is to newly define in the CPU 100 an instruction to write data directly to each of the registers.
  • using a new instruction means that it operates only on the program power CPU 100 that includes this new instruction and does not operate on other CPUs. Therefore, in the CPU 100 according to the present invention, a mechanism capable of controlling the register group only with an instruction of a conventional CPU is implemented.
  • the switch device R4 is means for switching the operation setting of the CPU 100. That is, according to the setting, the additional register group and the address processing dedicated stack register R3 can be validated and functioned or invalidated, and a conventional CPU environment S can be obtained. For example, in a conventional environment, a conventional operating environment can be provided for existing software.
  • the switch may be switched to activate or deactivate the additional register group or the like. In that case, the contents of the program counter R2 are in the state of being held.
  • each setting of the switch device R4 can be freely set during program execution. Therefore, it is possible to switch the switch and execute the program in an optimal state at any time according to the application of software.
  • FIG. 15A G shows a detailed configuration of the switch device R4.
  • the switch device R4 has a 32-bit register configuration. Of these, switch on / off of each bit from zero to 6th bit It is used as.
  • FIG. 15A-G illustrate operation in each switch mode. That is, FIG.
  • A indicates whether or not the additional register group and the address processing dedicated stack register R3 are to be used or not.
  • FIG. 15B shows the settings for determining the roles of the stack register R1 and the address processing dedicated stack register R3.
  • FIG. 15C shows a setting as to whether or not to automatically set the address processing dedicated stack register R3 when a program writes a new value to the stack register R1.
  • FIG. 15D shows the setting of the method of automatic setting to the address processing dedicated stack register R3.
  • Fig. 15E shows the settings for using the protection start address storage device R6 and the protection end address storage device R7.
  • FIG. 15F shows the setting of the extension direction of the stack register R1.
  • FIG. 15G shows the setting of the extension direction of the stack register R3 for address processing. That is, FIG. 15F and FIG. 15G show the function as the second switch device.
  • FIG. 16 is an assembler implementation example for realizing the on / off operation of the switch device R4.
  • the stack register R1 is written as esp.
  • Program P41 is a program for setting each function according to the present invention and enabling each function. As a specific process, this program 41 sets the value 0 to the stack register R1. By this execution, the switch device R4 as the first switch device is turned ON, and each of the addition value storage device R5, the protection start address storage device R6, the protection end address storage device R7, and the address processing dedicated stack register R3. Data can be written to the register (this state is called the extended setting mode).
  • the program P42 is a program for disabling each function according to the present invention. That is, it is a program for canceling the extension setting mode. Specifically, for example, The data is transferred by setting a value to the stack register Rl (esp register) and copying itself to itself with the mov instruction (copying the contents of esp to esp). As a result, the CPU 100 is in the same state as the conventional CPU.
  • the switch device R4 is brought into the switch-on state when at least the stack register R1 is set to the value zero.
  • the program P51 in FIG. 17 is a sample program for setting the stack area in the stack register R1.
  • Conventional software always sets the stack area in stack register R1 in this way when starting a program.
  • the program P52 is a program for utilizing each function according to the present invention. That is, in order to utilize the respective functions, the part which has been described as in the conventional program P51 may be described as in the program P52.
  • esp is a stack register Rl
  • eax is a switch device R4
  • ecx is a protection start address storage device R6
  • edx is a protection end address storage device R7
  • esi is an address processing dedicated stack register R3.
  • the CPU 100 is set to the expansion setting mode. Then, set the CPU mode to switch device R4. Next, the stack memory zero-side address (STACK_L ⁇ ⁇ ⁇ ⁇ W) is set in the protection start address storage device R6, and the high-order address (STACK_L W W + 8 Oth) of the stack memory is set in the protection end address storage device R7. . And the start address of the stack dedicated to address processing (STACK L ⁇ W) is set, and finally, the CPU 100 is returned to its original state.
  • STACK_L ⁇ ⁇ ⁇ W the stack memory zero-side address
  • STACK_L W W + 8 Oth the high-order address of the stack memory
  • Figure 18 shows the memory layout when program P52 is used. As shown in the figure, a memory area indicated by the address processing dedicated stack register R3 is secured in an area different from the memory area indicated by the stack register R1. Further, the address processing dedicated stack is protected in the memory area designated by the protection start address storage device R6 and the protection end address storage device R7. That is, in this area, writing of data other than the storage address of the subroutine call is prohibited.
  • the program P51 when the program P51 is included in the application start program of the OS, the program P51 may be changed to the program P52 to the OS.
  • the CPU does not implement the new function in the present invention, it merely executes an apparently meaningless instruction, and can execute the conventional program without any problem.
  • This method is to automatically address when data is written to stack register R1 during program execution.
  • This is a method to initialize the processing-specific stack register R3 and make it available (referred to as automatic setting processing).
  • FIG. 19 shows control that is automatically performed when program P71 shown in the figure is executed.
  • Program P71 is an arbitrary constant STA in stack register R1
  • program P71 is executed to set stack register R1 to an arbitrary constant (STACK_H
  • IGH is set (step S71 in FIG. 19).
  • step S72 if the content of stack register R1 is at the first end of the high-order side of the memory area secured for the stack (step S72), it is judged that the stack area has been set, and the stack area R3 The initial value of is set (step S73).
  • Information on the leading edge address of the stack memory area can be obtained by referring to the program counter R2 in IA32 (Intel's 32-bit microphone processor).
  • IA32 In the protect mode operating with 32 bits, the memory area management information defining the stack area can be obtained by referring to the program counter R2, the segment register R8 and the control register R9. Furthermore, it is preferable to omit the determination processing in step S72, but to prevent erroneous operation.
  • the setting of the value in the address processing dedicated stack register R3 in step S73 depends on the third bit of the switch device R4 (see FIG. 15D). That is, when the third bit is off (logic 0), the value of the stack register R1 is set as the stack area. When the third bit is on (logic 1), the value of the leading edge on the zero side set in the stack area is set. In IA32, this value can be obtained by referring to program counter R2, segment register R8 and control register R9.
  • step S74 the value stored in the addition value storage device R5 is added to the address processing dedicated stack register R3 (step S74).
  • This addition process is a safety process to avoid the risk of directly inserting the leading edge of the stack area.
  • the addition value is determined with reference to the start address on the zero address side of the stack memory area so that the addition result is set in the free area of the stack memory area.
  • a negative number may be set and added to the addition value storage device R5, or if the value set in the stack register R1 is a high-order value, the addition value storage device R5 may be added. You may subtract the value of as a positive number.
  • the address processing dedicated stack register R3 is automatically validated. That is, in the CPU 100, as in the conventional CPU, first, it operates with only one register device, and when data is set in the stack register R1, the address processing dedicated stack register R3 is initialized and can be used. State. Therefore, by making this setting in the CPU 100 during program execution, conventional software can be operated without any problem.
  • FIG. 20 shows a memory arrangement in the case where the above-mentioned automatic setting processing is performed on the address processing dedicated stack register R3.
  • FIG. 20 it is assumed that binary number 10100 00 (hexadecimal 50) is set for the switch device R4. Data is given to stack register R1
  • the memory arrangement becomes as shown in FIG. This can automatically provide high compatibility with existing software.
  • FIG. 21 is a view for explaining a method of securing a memory area in the 32-bit mode in which the IA 32 calls the protect mode.
  • a segment selector 13 corresponds to the segment register R8 in FIG.
  • the LDTR local descriptor table register
  • GDT global descriptor table
  • LDT local descriptor table
  • the LDTR 16 has information indicating the start address and the end address of the memory area. Therefore, when the functions of the CPU 100 according to the present invention are implemented in the IA 32, when the start address and the end address of the memory area are required, they may be acquired by referring to the LDTR 16.
  • the provision of the switch device R4 makes it possible to validate the function of the register group added as a configuration according to the present invention and the stack processing R3 for address processing. It is possible to switch whether to disable or to disable, and when it is disabled, it is possible to provide the conventional software with the same operating environment as a conventional CPU.
  • the software being executed writes the start address of the stack area to stack register R1, thereby automatically initializing address processing dedicated stack register R3. Settings are made. This enables the address processing dedicated stack register R3 to be available. Therefore, the conventional software can be operated as usual without any special operation, and the damage caused by the buffer overrun can be suppressed.
  • a protection start address storage device R6 and a protection end address storage device R7 are provided, and in the address area stored in them, the writing of data other than the storage address of the subroutine call is inhibited to prevent the address. It is possible to protect the memory area used by the process-specific stack register R3.
  • the memory securing direction indicated by the stack register R1 and the address processing dedicated stack register R3 is set to either the low direction (zero address direction) or the high direction. You can switch to Therefore, by setting the direction for securing the memory indicated by stack register R1 to the high direction, data corruption is performed on an unused area when a round-trip barran phenomenon occurs, causing damage. It can be kept to a minimum.
  • the switch device R4 is shown as one register provided on the CPU 100.
  • the switch device R4 may be configured as a plurality of registers for performing each setting separately.
  • a bit string at a specific address may be defined as a switch on the memory, and this may be used as the switch device R4.
  • FIG. 1 is a view schematically showing a configuration of a storage device (also referred to as a memory) used when executing a program in a general computer.
  • a storage device also referred to as a memory
  • FIG. 2 is a view schematically showing the operation of the sampling program and the stack memory.
  • FIG. 3 is an example of a schematic block diagram of a CPU according to the present invention.
  • Figure 4 is a schematic diagram of the register set of IA32 CPU of Intel Corporation.
  • FIG. 5 is a schematic configuration diagram of a register set of the CPU according to the present invention in the first embodiment.
  • FIG. 6 is a diagram schematically showing a configuration of a storage device used when executing a program in a CPU.
  • FIG. 7 schematically shows a stack area dedicated to data processing and a stack area dedicated to address processing.
  • FIG. 8 is a flowchart showing the operation of the CPU when address processing performed by a subroutine call occurs.
  • FIG. 9 is a flow chart showing the operation when ending the subroutine call and returning to the caller (return processing).
  • FIG. 10 shows another configuration example of a storage device used when executing a program.
  • FIG. 11 shows another configuration example of a storage device used when executing a program.
  • FIG. 12 shows another configuration example of a storage device used when executing a program.
  • FIG. 13 shows another configuration example of a storage device used when executing a program.
  • FIG. 14 is a schematic configuration diagram of a register set of the CPU according to the present invention in the second embodiment.
  • FIGS. 15A-G are diagrams for explaining the detailed configuration of the switch device.
  • Fig. 16 shows an example of assembler implementation for realizing the on / off operation of the switch device.
  • Figure 17 is an example of a program that explicitly configures settings at OS or program startup.
  • FIG. 18 is an example of a memory layout when the program of FIG. 17 is used.
  • FIG. 19 is a flowchart for explaining the operation of the CPU when performing the automatic setting process.
  • FIG. 20 shows an example of a memory arrangement in the case where automatic setting processing is performed on the address processing dedicated stack register.
  • FIG. 21 is a view for explaining a method of securing a memory area in 32-bit mode in which IA 32 calls protect mode.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Storage Device Security (AREA)
  • Executing Machine-Instructions (AREA)
  • Debugging And Monitoring (AREA)

Abstract

【課題】 セキュリティホールの発生原因と言われるバッファオーバーラン現象を防止し、コンピュータウイルスや不正アクセスを抑制することのできるコンピュータシステムのCPU(中央処理装置)を提供する。 【解決手段】 記憶装置のどのアドレスまで現時点で使用しているかを示し、記憶装置を使用するごとに、未使用の記憶装置のアドレスを示すように値を演算する機能を有するスタックレジスタ装置を複数備えるコンピュータシステムのCPU(中央処理装置)100であって、プログラムが使用するデータ処理に用いる第一のスタックレジスタ装置R1と、サブルーチンコールを行う際に書き込む戻りアドレスの格納に用いる第二のスタックレジスタ装置R3とを少なくとも備える。

Description

明 細 書
コンピュータシステムの CPU (中央処理装置)
技術分野
[0001] 本発明は、コンピュータウィルスに感染しにくい、安全性の高いコンピュータシステ ムの CPU (中央処理装置)に関する。
背景技術
[0002] インターネットの普及に従い、企業、個人用途のコンピュータシステムの多くが、ネッ トワークに接続し、相互にデータのやり取りをするに至っている。
し力しながら、コンピュータシステムに対し、外部より悪意あるネットワーク利用者が 接続し、システム管理者が気付かないうちに、コンピュータシステムが書き換えられる 問題が頻繁に発生している。また、所謂コンピュータウィルスと呼ばれる悪意ある実 行形式のデータ(プログラム)がシステムに書き込まれるという問題も多ぐこれらは深 亥 IJな社会問題となっている。
尚、コンピュータシステムや、悪意あるネットワーク接続者による行為については、 非特許文献 1一 4にそれぞれ記載されている。
非特許文献 1 :「ハッカー 'プログラミング大全」, UNYUN著
非特許文献 2 :「 OPERATING SYSTEM Internals andDesignJ , William S talings, Ph. D.著
非特許文献 3 :「インテル'ァーキテクイチヤ最適化マニュアル」,米インテル社 非特許文献 4 :「IA— 32 Intel Architecture Software Developer' s Manua
U,米インテル社
発明の開示
発明が解決しょうとする課題
[0003] 前記したような悪意あるネットワーク接続者による行為は、コンピュータシステムに存 在するセキュリティホールを利用して行われる。このセキュリティホールとは、インター ネットを通じた不正アクセス及び、コンピュータウィルスによりコンピュータシステムを 破壊改造するための警備の穴である。 現在では、世界中のコンピュータシステムにおいて、多数のセキュリティホールが存 在し、前記したように、これを利用した不正アクセス、コンピュータウィルスが社会問題 となっている。
[0004] セキュリティホールの発生原因の一つは、バッファオーバーラン現象にあると言われ ている。このバッファオーバーラン現象について説明すると、例えば、ある電子メール の送付ソフトにおいて、送付先の入力可能なメールアドレスの最大文字数が 50文字 とする。
ここで、送付先のメールアドレスに、 1000文字の長さのメールアドレスを指定すると 、(想定していなレ、) 50文字を超えた 950文字のデータがメモリ領域を超えて書き込 まれ、これによりコンピュータの制御が破綻を来たす。このような現象がバッファォー バーラン現象と呼ばれてレ、る。
[0005] 更に、バッファオーバーラン現象について、詳細に説明する。図 1は、一般的なコン ピュータにおいて、プログラムを実行する際に使用する記憶装置 (メモリとも呼ぶ)の 構成を模式的に示した図である。
[0006] 図 1のメモリ構成のうち、プログラムは領域 Al lに格納される。そして、プログラムの データ処理に使用する領域として、領域 A12、 A13、 A14を確保する。このうち、領 域 A12は、プログラム全体で使用するデータの読み書きに使用する。領域 A13は、 プログラムを実行する上で、適時データ領域を確保したいときに使用し、プログラムの 実行中にメモリ中の領域が伸縮する。また、領域 A14は、スタックメモリと呼称する特 殊なメモリ領域であって、プログラムを構成するサブルーチンと呼ばれる小さレ、構成 のプログラムの実行管理と、サブルーチンが一時的に使用するデータの管理を行う ための領域である。
尚、サブルーチンとは当文書において次のように定義する。
サブルーチンとはスタックメモリに事前にサブルーチンを実行し終わったら実行すベ き次のプログラムの開始アドレスを格納して実行するプログラムと規定するものとする 。サブルーチンコールとはこのサブルーチンを呼び出すこと、つまり実行する事を示 すものとする。
[0007] 図 2に、サンプルプログラムと共に、領域 A14のスタックメモリの働きを模式的に示 す。尚、サンプルプログラムは c言語により記述されている。
前記サンプルプログラムは、プログラム 12行目で testという名称のサブルーチン( 子プログラム)を呼び出し、それを実行する構成となっている。また、そのサブルーチ ン実行時に、引数と呼ばれるデータを 4つ渡している。即ち、その引数は、 'Τ'、 Έ' 、 ' S '、 'T'の 4つである。これらのデータは、スタックメモリ上の領域 Α21、 Α22、 Α2 3、 Α24に書き込まれる。
[0008] このサンプノレプログラム実行時において、前記引数がスタックメモリに書き込まれた 後、サブルーチン' test'に制御が移行する。また、このとき、サブルーチン実行終了 後にプログラム 13行目に制御が戻るように、スタックメモリの領域 A25に、プログラム 1 3行目を示すアドレスデータを記憶する。
[0009] そして、プログラム 14行目力も始まるサブルーチン' test'の実行においては、先ず 、プログラム 14行目、 16行目において初期設定が行われる。次いで、 17行目におい て、変数 sに 'A'という値が代入される。この値は、スタックメモリの領域 A26に書き込 まれる。
[0010] そして、プログラム 18行目においては、故意に、変数 sの存在するメモリ領域をアド レス指定し、そこからゼロ(0)を 100文字、メモリに書き込むよう指示している。すなわ ち、これが実行されると、領域 A21— A26を含め、 100文字分の全ての内容が、ゼロ に上書きされ、その結果プログラムの流れが破壊される。
[0011] すなわち、プログラム 19行目において、本来ならば、領域 A25に格納されている、 呼び出し元の 13行目のアドレスに戻り、 13行目力 の処理に続くのである力 実際 には、領域 A25にはゼロが書き込まれており、プログラムはゼロ番地から実行しようと する。その結果、コンピュータに障害が生じる。
[0012] 以上、説明したように、本来設定されたメモリの領域を超えて不正に書き込まれる現 象をバッファオーバーランと呼んでいる。尚、このような脆弱性が現在の CPU (中央 処理装置)には存在しており、コンピュータウィルスや不正アクセスは、前記した現象 を利用してコンピュータシステムに不正を働く。また、実際のコンピュータウィルスや 不正アクセスにあっては、メモリへの上書きにおいて、 自身に都合のょレ、メモリアドレ スを書き込み、ここにプログラムの制御が移行するように仕向け、不正を働くようにし ている。
[0013] 本発明は、前記したような事情のもとになされたものであり、セキュリティホールの発 生原因と言われるバッファオーバーラン現象を防止し、コンピュータウィルスや不正ァ クセスを抑制することのできるコンピュータシステムの CPU (中央処理装置)を提供す ることを目的とする。
課題を解決するための手段
[0014] 前記した課題を解決するため、本発明に係るコンピュータシステムの CPU (中央処 理装置)は、記憶装置のどのアドレスまで現時点で使用しているかを示し、記憶装置 を使用するごとに、未使用の記憶装置のアドレスを示すように値を演算する機能を有 するスタックレジスタ装置を複数備えるコンピュータシステムの CPU (中央処理装置) であって、プログラムが使用するデータ処理に用いる第一のスタックレジスタ装置と、 サブルーチンコールを行う際に書き込む戻りアドレスの格納に用いる第二のスタック レジスタ装置とを少なくとも備えることに特徴を有する。
[0015] このように、アドレス処理を専用に行う第二のスタックレジスタ装置を設け、プロダラ ムの流れを決定するアドレスデータをそのスタックに格納するよう構成したため、アド レス以外のデータを格納する第一のスタックレジスタ装置が不正に上書きされ、バッ ファオ一バーフロー現象が生じる危険があってもプログラム全体の流れの不正な変 化を防止することができる。
発明の効果
[0016] 本発明によれば、プログラムの不具合により、スタック上のデータを連続上書きし、 その内容を破壊したときに、被害をデータ処理用のスタック装置内に限定することが できる。その結果、アドレス格納専用スタックの内容を保護し、バッファオーバーフロ 一現象が生じる危険があってもプログラム全体の流れの不正な変化を防止することが できる。
発明を実施するための最良の形態
[0017] 以下、本発明のコンピュータシステムの CPUに係る実施の形態について説明する 。先ず、図 3乃至図 13に基づいて本発明に係る第一の実施の形態について説明す る。 図 3は、本発明に係る CPUの概略構成図の一例である。この構成は、米国インテ ル社の IA32と呼ぶ CPUの構成を基本とする。
[0018] 図 3に示す CPU100において、レジスタ 'セット 100aは、 CPUが持つ汎用レジスタ のひと揃いを示す。
また、インストラクション ·レジスタ(Instruction Register) 100bは、 CPU100がメ モリより読み取った、次に実行する命令を格納し、その内容に従い、 CPUコントロー ル部 100dが必要とする制御信号を CPU内部および外部に配る。
[0019] ALU (Arithmetic Logical Unit) 100cは、算術論理演算機構である。即ち、 C PU100内部で必要とする論理演算、算術演算を行なう。また、 CPU100内部にお レ、てブラックボックスとして存在してレ、る。
アドレス.バッファ(Address Buffer) 100eは、 CPU100が外部バスと接続する時 の中継を行なう。即ち、この機構は外部バスを制御するためのアドレス情報の中継を 行なう。
また、データ'バッファ(Data Buffer) 100fは、 CPU100が外部バスと接続する時 の中継を行なう。即ち、この機構は外部バスを制御するためのデータ情報の中継を 行なう。
[0020] 本発明に係る CPU100においては、前記レジスタ ·セット 100aに特徴を有し、例え ば IA32が有するレジスタ 'セットの構成を基本とする。図 4は IA32が有するレジスタ' セットの概略構成図、図 5は図 4の構成を基本とするレジスタ 'セット 100aの概略構成 図である。
尚、本発明は、スタックレジスタを備えた全ての CPUに適用できる力 ここでは、 IA 32を例にとり本発明を説明する。
[0021] 図 4に示す IA32が有するレジスタ.セット 200aは、スタックレジスタ Rl 1 (32ビット表 現で ESPのレジスタ)と、プログラムカウンタ R12 (32ビット表現で EIPのレジスタ)を 備える。プログラムカウンタ R12は、 CPUがこれから実行したいプログラムのメモリの アドレスを示すものである。
また、図中に示す 32ビット表現名での EAX、 EBX、 ECX、 EDX、 ESI、 EDI、 EBP の各レジスタは、汎用レジスタである。 EAX、 EBX、 EDXは、主に一般的な演算に 使用する。 ECXは、一般的な演算に加えてカウンタ処理用に機能の拡張を行ってい る汎用レジスタである。 ESI、 EDIは、インデックス参照と呼ぶ機能を強化した汎用レ ジスタである。また、 EBPは、スタックレジスタ R11と連動して使用する機能を強化し た沉用レジスタである。
[0022] 図 5に示す CPU100が有するレジスタ.セット 100aは、図 4の構成に、アドレス処理 専用スタックレジスタ R3 (第二のスタックレジスタ装置)を追加した構成とする。また、 図 4の構成と同様に、スタックレジスタ R1 (第一のスタックレジスタ装置)と、プログラム カウンタ R2を備える。但し、図 5に示すスタックレジスタ R1は、図 4のスタックレジスタ
R11よりも機能を削減された構成となされる。その削減された機能とは、サブルーチ ンコールの際の戻りアドレスをスタックに格納する処理 (機能)、及びサブルーチンコ ールを終了するときに格納した戻りアドレスを取得する処理 (機能)である。スタックレ ジスタ R1におけるその他の機能にっレ、てはスタックレジスタ Rl 1と同様である。
[0023] 尚、従来のコンピュータプログラムとのより高い互換性を保っため、ダミーの戻りアド レスをスタックレジスタ R1に格納するようにしてもよい。但し、この場合、ダミーとしてス タックレジスタ R1に書き込むのみであり、プログラムの戻り値としては使用しなレ、。実 際のプログラムの戻り値として使用するのは、アドレス処理専用スタックレジスタ R3に 格納された値である。
[0024] また、図 6に、 CPU100において、プログラムを実行する際に使用する記憶装置の 構成を模式的に示す。この図 6においては、実行したプログラムに割り振られるメモリ 領域を示している。即ち、図示するように、 0番地から順に、プログラム領域 A31、デ ータ領域 A32、ヒープ領域 A33、アドレス処理専用スタック領域 A37、スタック領域( データ処理専用スタック領域) A34、引数領域 A35、環境変数領域 A36等が割り振 られる。
[0025] 図 6の構造を図 1の従来構造と比較すると、アドレス処理専用スタック領域 A37が増 設されている。このアドレス処理専用スタック領域 A37は、アドレス処理専用スタックレ ジスタ R3と連動しており、アドレス処理専用スタックレジスタ R3は、常にスタック領域 A37のメモリを示してレヽる。
[0026] このような構造の CPU100において、図 2に示したサンプルプログラムを実行すると 、プログラム 12行目において、 4つの引数 'Τ,、 'Ε,、 ' S '、 'T'が、図 7に示すスタツ ク領域(データ処理専用スタック領域) Α34内の領域 Α41、 Α42、 Α43、 Α44に書き 込まれる。そして、サブルーチン' test'が終了した時点でプログラム 13行目に戻るよ う、図 7に示すアドレス処理専用スタック領域 A37の領域 A45に、プログラム 13行目 を示すメモリのアドレスを保存するようになされる。
[0027] そして、プログラム 14行目力も始まるサブルーチン' test'の実行においては、先ず 、プログラム 14行目、 16行目において初期設定が行われる。次いで、 17行目におい て、変数 sに 'A'という値が代入される。この値は、スタックメモリの領域 A12に書き込 まれる。
[0028] そして、プログラム 18行目においては、故意に、変数 sの存在するメモリ領域から、 ゼロ(0)を 100文字、メモリに書き込むよう指示しており、これが実行されると、 A41 A46を含め、 100文字全ての内容が、ゼロに上書きされる。
し力 ながら、プログラムの流れを決定するアドレス処理専用スタック領域 A37の領 域 A45は、前記ゼロが上書きされた領域とは異なる領域に存在するため影響を受け ない。
[0029] 続いて、サブルーチンコールで行うアドレス処理が発生する際の CPU100の動作 について、さらに図 8のフロー図に基づき説明する。
[0030] 先ず、現在のプログラムカウンタ R2の内容を、アドレス処理専用スタックレジスタ R3 が示すアドレスに書き込む(ステップ Sl)。尚、従来の CPUでは、スタックレジスタ R1
1の示すアドレスに書き込むよう構成されている。
[0031] アドレス処理専用スタックレジスタ R3の示すメモリにデータが書き込まれたため、ァ ドレス処理専用スタックレジスタ R3の保持する内容を減算し、未使用のメモリを示す ようにする (ステップ S2)。
次いで、プログラムカウンタ R2にサブルーチンコールしたいプログラムのアドレスを セットする (ステップ S3)。以後、 CPUの実行は、サブルーチンに移行する。
[0032] また、サブルーチンコールを終了し、呼び出し元に戻るとき(リターン処理)にも、ァ ドレス処理専用スタックレジスタ R3が作動する。続いて、その処理について図 9のフロ 一図に基づき説明する。 [0033] アドレス処理専用スタックレジスタ R3の保持する値を加算して、図 8のステップ 31に て戻りアドレスを書き込んだアドレスを示すようにする(ステップ Sl l)。
図 8のステップ SIで書き込んだアドレスがアドレス処理専用スタックレジスタ R3の示 すアドレスに格納されている。このアドレス(即ち、アドレス処理専用スタックが示した アドレス)を読み取る(ステップ S 12)。
[0034] 次いで、プログラムカウンタ R2にステップ S11で読み込んだ値を設定する(ステップ
S13)。以後、 CPU100の実行は、呼び出し元のプログラムに移行し、サブルーチン コールは終了する。
[0035] 以上、説明した第一の実施の形態によれば、アドレス処理専用スタックレジスタ R3 を設け、プログラムの流れを決定するアドレスデータをアドレス処理専用スタックレジ スタ R3の示すメモリ領域に格納するよう構成したため、アドレス以外のデータを格納 するスタックが不正に上書きされ、ノ ッファオ一バーフロー現象が生じる危険があって もプログラム全体の流れの不正な変化を防止することができる。
[0036] 尚、前記第一の実施の形態において、図 6に示した、プログラムを実行する際に使 用する記憶装置の構成は、一例であって、これに限定されるものではなレ、。例えば、 図 10乃至図 13にそれぞれ示す他の構成を用いても、第一の実施の形態と同様の作 用効果を得ることができる。
[0037] 続いて、図 14乃至図 21に基づき、本発明に係る第二の実施の形態について説明 する。この第二の実施の形態において示す CPU100は、前記第一の実施の形態で 示した構成に加え、従来から存在するソフトウェアを問題なく動作させるための手段 を備える構成となされる。
[0038] 即ち、従来のソフトウェアは、 CPU内に 1つのみ存在するスタックレジスタ装置の制 御しか行わない。したがって、前記第一の実施形態のように、 2つのスタックレジスタ 装置が存在し常に機能する場合には、誤動作が発生する。そこで、この第二の実施 の形態においては、従来のソフトウェアに対しても問題なく動作する CPU100の構 成及び動作にっレ、て説明する。
[0039] 図 14は、本発明に係るコンピュータシステムの CPUの第二の実施の形態を示すレ ジスタ 'セットの概略構成図である。図 14の構成においては、第一の実施形態で説 明した図 5の構成に加え、 CPU100の動作状態を設定するレジスタであるスィッチ装 置 R4 (第一、第二のスィッチ装置を含む)を備える。また、所定値を記憶し格納する 加算値記憶装置 R5、保護開始アドレス格納装置 R6、及び保護終了アドレス格納装 置 R7の各レジスタを新たに備える。
[0040] 即ち、前記スィッチ装置 R4、加算値記憶装置 R5、保護開始アドレス格納装置 R6、 及び保護終了アドレス格納装置 R7の各レジスタ(以下、便宜的に、追加レジスタ群と 称す)は、従来の CPUにおいては存在しないものであり、アドレス処理専用スタックレ ジスタ R3と共に、本発明に係る CPU100の特徴的な構成要件である。
尚、図 5には図示しなかったが、図 14に示すセグメントレジスタ R8、コントロールレ ジスタ R9、 R10は、既存の CPUに備えられているものである。
[0041] また尚、前記追加レジスタ群を制御する簡単な方法は、それら各レジスタにデータ を直接書き込む命令を、 CPU100に新たに定義することである。し力 ながら、新し い命令を用いるということは、この新しい命令を含むプログラム力 CPU100上での み動作し、他の CPUでは動作しないということである。そこで、本発明に係る CPU10 0では、従来の CPUが有する命令のみで前記レジスタ群を制御することのできる機 構を実装する。
[0042] 前記追加レジスタ群のうち、スィッチ装置 R4は、 CPU100の動作設定を切り替える 手段である。即ち、その設定により、前記追加レジスタ群やアドレス処理専用スタック レジスタ R3を有効とし、機能させるカ または、無効とし、従来通りの CPU環境にす ること力 Sできる。例えば、従来通りの環境にしたときには、既存のソフトウェアに対し、 従来通りの動作環境を提供することができる。
[0043] また、 CPUの動作途中において、スィッチを切り替え、前記追加レジスタ群等を機 能させたり、あるいは無効にすることもできる。その場合、プログラムカウンタ R2の内 容は保持された状態である。また、プログラム実行中に、スィッチ装置 R4の有する各 設定を自由に行うことができる。したがって、ソフトウェアの用途に合わせ、スィッチを 切り替え、常に最適な状態でプログラムを実行することができる。
[0044] 図 15A Gに、スィッチ装置 R4の詳細構成を示す。スィッチ装置 R4は、 32ビットの レジスタ構成である。このうち、ゼロから第 6ビットまでの各ビットのオンオフをスィッチ として利用している。
[0045] 図 15A— Gにおいて、各スィッチモードにおける動作を説明している。即ち、図 15
Aは、前記追加レジスタ群、並びにアドレス処理専用スタックレジスタ R3を使用する か否かの設定にっレ、て示してレ、る。
[0046] 図 15Bは、スタックレジスタ R1とアドレス処理専用スタックレジスタ R3の役割を決定 する設定にっレ、て示してレ、る。
図 15Cは、プログラムから、スタックレジスタ R1へ新しい値の書き込みがあつたとき に、アドレス処理専用スタックレジスタ R3への自動設定を行うか否かの設定について 示している。
[0047] 図 15Dは、アドレス処理専用スタックレジスタ R3への自動設定の方法の設定につ いて示している。
図 15Eは、保護開始アドレス格納装置 R6、保護終了アドレス格納装置 R7の使用 の設定にっレ、て示してレ、る。
[0048] 図 15Fは、スタックレジスタ R1の拡張する方向の設定について示している。
そして、図 15Gは、アドレス処理専用スタックレジスタ R3の拡張する方向の設定に ついて示している。即ち、図 15F、図 15Gは第二のスィッチ装置としての機能を示し ている。
[0049] 図 16は、前記スィッチ装置 R4のオンオフ動作を実現するためのアセンブラ実装例 である。尚、図示するプログラム P41、 P42において、スタックレジスタ R1は espと記 載される。
プログラム P41は、本発明に係る各機能に設定を行い、各機能を有効にするため のプログラムである。具体的な処理として、このプログラム 41は、スタックレジスタ R1に 値ゼロを設定する。この実行により、第一のスィッチ装置としてのスィッチ装置 R4がォ ン状態となり、加算値記憶装置 R5、保護開始アドレス格納装置 R6、及び保護終了ァ ドレス格納装置 R7、アドレス処理専用スタックレジスタ R3の各レジスタにデータが書 き込める状態となる(この状態を拡張設定モードと称す)。
[0050] 一方、プログラム P42は、本発明に係る各機能を無効にするためのプログラムであ る。即ち、拡張設定モードを解除するためのプログラムである。具体的には、例えば、 スタックレジスタ Rl (espレジスタ)に有値を設定し、 自身に自身を mov命令でコピー する(espの内容を espにコピーする)ことによりデータ転送される。これにより、 CPU1 00は従来の CPUと同様の状態となる。
[0051] このように、スィッチ装置 R4は、少なくともスタックレジスタ R1に値ゼロが設定された ときに、スィッチオン状態となされる。
また、この条件だけでは、誤動作によりスィッチオンの状態となるおそれがあるため 、ダブルトリガ方式となされる。即ち、プログラム P41、 P42のそれぞれの 2行目で行な つている、 espレジスタの内容を espレジスタにコピーするという無意味な命令力 もう 1つのトリガとされる。これら 2つのトリガにより、誤動作のない設定を行なう。
[0052] 本発明の係る各機能を使用するには、 2通りの方法がある。 1つは、 OS (オペレー ティングシステム)またはプログラム起動時に明示的に設定を行う方法である。この方 法によれば、従来の〇Sまたはプログラムに対しごく僅かの仕様変更のみで実行する ことができる。既存のソフトウェアを変更する必要があるが、高い互換性を得ることが できる。その設定方法にっレ、て図 17に基づレ、て説明する。
[0053] 図 17のプログラム P51は、スタックレジスタ R1にスタック領域を設定するサンプルプ ログラムである。従来のソフトウェアは、プログラム起動時に必ずこのようにしてスタツ クレジスタ R1にスタック領域を設定してレ、る。
一方、プログラム P52は、本発明に係る各機能を活用するためのプログラムである。 即ち、前記各機能を活用するには、従来プログラム P51のように記述していた部分を 、プログラム P52のように記述すればよい。尚、プログラム P52中、 espはスタックレジ スタ Rl、 eaxはスィッチ装置 R4、 ecxは保護開始アドレス格納装置 R6、 edxは保護 終了アドレス格納装置 R7、 esiはアドレス処理専用スタックレジスタ R3をそれぞれ示 している。
[0054] このプログラム P52の流れを簡単に説明すると、先ず、 CPU100を拡張設定モード にする。そして、スィッチ装置 R4に CPUモードを設定する。次いで、保護開始アドレ ス格納装置 R6にスタックメモリのゼロ側のアドレス(STACK_L〇W)を設定し、保護 終了アドレス格納装置 R7にスタックメモリの高位側のアドレス(STACK_L〇W+ 8 OOOh)を設定する。そして、アドレス処理専用スタックの開始アドレス(STACK L〇 W)を設定し、最後に CPU100を元の状態に戻す処理が行なわれる。
[0055] これにより、本発明に係る各機能を活用することができる。図 18にプログラム P52を 使用したときのメモリ配置図を示す。図示するように、スタックレジスタ R1が示すメモリ 領域とは別領域にアドレス処理専用スタックレジスタ R3が示すメモリ領域が確保され る。また、アドレス処理専用スタックは、保護開始アドレス格納装置 R6と保護終了アド レス格納装置 R7とにより指定されたメモリ領域において保護される。即ち、この領域 におレ、ては、サブルーチンコールの格納アドレス以外のデータの書き込みが禁止さ れる。
[0056] 尚、従来、プログラム P51が OSのアプリケーション起動プログラムの中に入っている 場合には、 OSに対してプログラム P51を P52に変更すればよレ、。勿論、 CPUが本発 明における新機能を実装していない場合であっても、見かけ上、無意味な命令を実 行しているだけであり、支障なく従来のプログラムを実行することができる。
[0057] 続いて、本発明の係る各機能を使用するための、もう 1つの方法について説明する この方法は、プログラム実行中に、スタックレジスタ R1に対しデータが書き込まれたと き、 自動的にアドレス処理専用スタックレジスタ R3を初期化し使用可能とする方法( 自動設定処理と呼ぶ)である。
この方法における CPU100の動作について、図 19のフロー図に基づき説明する。 尚、図 19においては、図中に示すプログラム P71が実行された際に自動的に行な われる制御を示している。プログラム P71は、スタックレジスタ R1に任意の定数 STA
CK_HIGHを設定するプログラムである。
[0058] 先ず、プログラム P71が実行され、スタックレジスタ R1に任意の定数(STACK_H
IGH)が設定される(図 19のステップ S71)。
ここでスタックレジスタ R1の内容がスタック用に確保したメモリ領域の高位側の最先 端にある場合 (ステップ S72)、スタック領域の設定がなされたと判断し、アドレス処理 専用スタックレジスタ R3に、スタック領域の初期値が設定される(ステップ S73)。
[0059] 尚、スタックメモリ領域の最先端アドレスの情報は、 IA32 (Intel社の 32ビットマイク 口プロセッサ)ではプログラムカウンタ R2を参照することにより得ることができる。 IA32 は、 32ビットで動作するプロテクトモードの時には、プログラムカウンタ R2、セグメント レジスタ R8、コントロールレジスタ R9を参照し、スタック領域を定義するメモリ領域管 理情報を得ることができる。尚また、ステップ S72の判定処理は省略してもよレ、が、誤 動作防止のために行うのが望ましい。
[0060] また、ステップ S73における、アドレス処理専用スタックレジスタ R3への値の設定に ついては、スィッチ装置 R4の第 3ビットに依存する(図 15D参照)。即ち、第 3ビットが オフ(論理 0)のときには、スタック領域として、スタックレジスタ R1の値を設定する。ま た、第 3ビットがオン (論理 1)のときには、スタック領域に設定されたゼロ側の最先端 の値を設定するようになされる。尚、この値は、 IA32においては、プログラムカウンタ R2、セグメントレジスタ R8、コントロールレジスタ R9を参照することにより取得すること ができる。
[0061] 次いで、アドレス処理専用スタックレジスタ R3に、加算値記憶装置 R5に記憶された 値を加算する (ステップ S74)。この加算処理は、スタック領域の最先端を直接入れる リスクを回避するための安全処理である。
尚、この加算値は、加算結果が、スタック用メモリ領域のうち、空き領域に設定され るよう、スタック用メモリ領域のゼロ番地側の開始アドレスを参照して決定される。また 、加算値記憶装置 R5には、負数を設定して加算してもよいし、あるいは、スタックレジ スタ R1に設定された値が高位側の値であった場合には、加算値記憶装置 R5の値を 正数として減算してもよい。
[0062] 以上の制御により、 自動的にアドレス処理専用スタックレジスタ R3が有効となる。即 ち、 CPU100においては、従来の CPUと同様に、先ず 1つのレジスタ装置だけで動 作し、スタックレジスタ R1にデータ設定がなされた時点で、アドレス処理専用スタック レジスタ R3が初期化され、使用可能な状態となる。したがって、プログラム実行中に CPU100にこの設定がなされることで、従来のソフトウェアを問題なく動作させること ができる。
[0063] 尚、アドレス処理専用スタックレジスタ R3に前記の自動設定処理を行う場合のメモリ 配置を図 20に示す。図 20においては、スィッチ装置 R4に対して 2進法数値 10100 00 (16進法 50)を設定しているものとする。スタックレジスタ R1にデータが与えられた とき、図 19のフロー図に示した制御が行なわれ、メモリ配置は図 20のようになる。これ により、既存のソフトウェアに対して高い互換性を自動的に提供することができる。
[0064] また、図 21は、 IA32がプロテクトモードと呼称する 32ビットモード時のメモリ領域の 確保方法を説明した図である。図中、セグメントセレクタ(Segment Selector) 13は 、図 14におけるセグメントレジスタ R8に相当する。セグメントセレクタ 13の内容により 、 GDT (グローバルディスクリプタテーブル) 14あるいは LDT (ローカルディスクリプタ テーブル) 15を経由して LDTR (ローカルディスクリプタテーブルレジスタ) 16を取得 すること力 Sできる。
[0065] この LDTR16は、メモリ領域の開始番地、終了番地を示す情報を備えている。した がって、 IA32において、本発明に係る CPU100の機能を実装する際には、メモリ領 域の開始番地及び終了番地を必要とするときには LDTR16を参照し取得すればよ レ、。
[0066] 以上、説明した第二の実施の形態によれば、スィッチ装置 R4を設けたことにより、 本発明に係る構成として追加されたレジスタ群やアドレス処理専用スタックレジスタ R 3の機能を有効とするか無効とするかを切り替えることができ、無効とした場合には、 従来のソフトウェアに対し、従来の CPUと同様の動作環境を提供することができる。
[0067] また、スタックレジスタ R1のみが使用可能な状態において、実行中のソフトウェアが スタックレジスタ R1に対しスタック領域の開始アドレスを書き込むことにより、 自動的に アドレス処理専用スタックレジスタ R3に対して初期化設定がなされる。これにより、ァ ドレス処理専用スタックレジスタ R3を使用可能な状態にすることができる。したがって 、従来のソフトウェアを、特別な操作なしに、従来同様に動作させることができ、且つ 、バッファオーバーランによる被害を抑制することができる。
[0068] また、保護開始アドレス格納装置 R6、及び保護終了アドレス格納装置 R7を設け、 それらに格納されたアドレス領域においては、サブルーチンコールの格納アドレス以 外のデータの書き込みを禁止することで、アドレス処理専用スタックレジスタ R3が使 用するメモリ領域を保護することができる。
[0069] また、スィッチ装置 R4におレ、て、スタックレジスタ R1及びアドレス処理専用スタック レジスタ R3が示すメモリの確保方向を低位方向(ゼロ番地方向)と高位方向のいず れかに切り替えることができる。したがって、スタックレジスタ R1が示すメモリの確保方 向を高位方向に設定することにより、ノくッファオ一バーラン現象が発生したときに、デ ータ破壊は未使用の領域に対して行なわれ、被害を最小限に食い止めることができ る。
[0070] 尚、前記第二の実施の形態において、スィッチ装置 R4は、 CPU100上に備えられ た 1つのレジスタとして示したが、各設定をそれぞれ別個に行う複数のレジスタとして 構成されてもよい。あるいは、メモリ上で、特定番地のビット列をスィッチとして定義し 、これをスィッチ装置 R4としてもよい。
図面の簡単な説明
[0071] [図 1]図 1は、一般的なコンピュータにおいて、プログラムを実行する際に使用する記 憶装置 (メモリとも呼ぶ)の構成を模式的に示した図である。
[図 2]図 2は、サンプノレプログラム及びスタックメモリの働きを模式的に示す図である。
[図 3]図 3は、本発明に係る CPUの概略構成図の一例である。
[図 4]図 4は、米国インテル社の IA32系 CPUのレジスタ.セットの概略構成図である。
[図 5]図 5は、第一の実施形態における本発明に係る CPUのレジスタ 'セットの概略 構成図である。
[図 6]図 6は、 CPUにおいてプログラムを実行する際に使用する記憶装置の構成を模 式的に示す図である。
[図 7]図 7は、データ処理専用スタック領域とアドレス処理専用スタック領域とを模式的 に示す図である。
[図 8]図 8は、サブルーチンコールで行うアドレス処理が発生する際の CPUの動作を 示すフロー図である。
[図 9]図 9は、サブルーチンコールを終了し、呼び出し元に戻るとき(リターン処理)の 動作を示すフロー図である。
[図 10]図 10は、プログラムを実行する際に使用する記憶装置の他の構成例である。
[図 11]図 11は、プログラムを実行する際に使用する記憶装置の他の構成例でる。
[図 12]図 12は、プログラムを実行する際に使用する記憶装置の他の構成例である。
[図 13]図 13は、プログラムを実行する際に使用する記憶装置の他の構成例である。 [図 14]図 14は、第二の実施の形態における本発明に係る CPUのレジスタ 'セットの 概略構成図である。
[図 15A-G]図 15A— Gは、スィッチ装置の詳細構成を説明するための図である。
[図 16]図 16は、スィッチ装置のオンオフ動作を実現するためのアセンブラ実装例で ある。
園 17]図 17は、 OSまたはプログラム起動時に明示的に設定を行うプログラム例であ る。
[図 18]図 18は、図 17のプログラムを使用したときのメモリ配置図の一例である。
[図 19]図 19は、 自動設定処理を行う場合の CPUの動作を説明するためのフロー図 である。
[図 20]図 20は、アドレス処理専用スタックレジスタに自動設定処理を行う場合のメモリ 配置の一例である。
[図 21]図 21は、 IA32がプロテクトモードと呼称する 32ビットモード時のメモリ領域の 確保方法を説明した図である。

Claims

請求の範囲
[1] 記憶装置のどのアドレスまで現時点で使用しているかを示し、記憶装置を使用する ごとに、未使用の記憶装置のアドレスを示すように値を演算する機能を有するスタック レジスタ装置を複数備えるコンピュータシステムの CPU (中央処理装置)であって、 プログラムが使用するデータ処理に用いる第一のスタックレジスタ装置と、 サブルーチンコールを行う際に書き込む戻りアドレスの格納に用いる第二のスタック レジスタ装置とを少なくとも備えることを特徴とするコンピュータシステムの CPU。
[2] 前記第一及び/または第二のスタックレジスタ装置は、
記憶装置を使用するごとに、アドレスを減算ではなく加算し、未使用の記憶装置の アドレスを示すことを特徴とする請求項 1に記載されたコンピュータシステムの CPU。
[3] 前記第一のスタックレジスタ装置と第二のスタックレジスタ装置の両方、または、レヽ ずれか一方を使用可能な状態に切り替える第一のスィッチ装置を備え、
前記第一のスィッチ装置により、第一のスタックレジスタ装置と第二のスタックレジス タ装置のいずれか一方が使用可能な状態になされた際は、該使用可能なスタックレ ジスタ装置は、サブルーチンコールを行う際の戻りアドレスの管理とプログラムが使用 するデータ処理とを行うレジスタとして使用されることを特徴とする請求項 1または請 求項 2に記載されたコンピュータシステムの CPU。
[4] 所定値を記憶する加算値記憶装置を備え、
プログラムから前記第一のスタックレジスタ装置と第二のスタックレジスタ装置のい ずれか一方にデータが書き込まれた際、該データに対し前記所定値を加算または減 算した結果を、他のスタックレジスタ装置に格納する処理が行なわれることを特徴とす る請求項 1乃至請求項 3のいずれかに記載されたコンピュータシステムの CPU。
[5] プログラムから第一のスタックレジスタ装置と第二のスタックレジスタ装置のレ、ずれか 一方にデータが書き込まれた際、スタック用に割り振られたメモリ領域のゼロ番地側 の開始アドレスを取得し、前記加算値記憶装置が記憶する所定値を決定する処理が 行なわれることを特徴とする請求項 4に記載されたコンピュータシステムの CPU。
[6] スタック用に割り振られたメモリ領域の開始アドレスと終了アドレスの情報を格納す るアドレス格納装置を備え、 前記アドレス格納装置が格納するアドレス情報により決定されたメモリ領域に対し、 サブルーチンコールの格納アドレスの書き込みを許可し、それ以外のデータの書き 込みを禁止することを特徴とする請求項 1乃至請求項 5のいずれかに記載されたコン ピュータシステムの CPU。
[7] 前記第一及び/または第二のスタックレジスタ装置が示すメモリの確保方向をメモリ の高位方向と低位方向のいずれかに動作させる設定を行う第二のスィッチ装置を備 えることを特徴とする請求項 1乃至請求項 6のいずれかに記載されたコンピュータシス テムの CPU。
[8] 前記第一のスタックレジスタ装置と第二のスタックレジスタ装置のレ、ずれか一方が、 サブルーチンコールを行う際の戻りアドレスの管理とプログラムが使用するデータ処 理とを行うレジスタとして使用されている状態から、前記請求項 4および請求項 5に記 載された処理が行なわれることにより、前記第一のスィッチ装置の設定が変更され、 他方のスタックレジスタ装置が使用可能な状態となることを特徴とする請求項 5乃至 請求項 7のいずれかに記載されたコンピュータシステムの CPU。
PCT/JP2004/012165 2003-08-25 2004-08-25 コンピュータシステムのcpu(中央処理装置) WO2005020069A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005513345A JPWO2005020069A1 (ja) 2003-08-25 2004-08-25 コンピュータシステムのcpu(中央処理装置)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
JP2003-300641 2003-08-25
JP2003300641 2003-08-25
JP2004127688 2004-04-23
JP2004-127688 2004-04-23

Publications (1)

Publication Number Publication Date
WO2005020069A1 true WO2005020069A1 (ja) 2005-03-03

Family

ID=34220725

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2004/012165 WO2005020069A1 (ja) 2003-08-25 2004-08-25 コンピュータシステムのcpu(中央処理装置)

Country Status (2)

Country Link
JP (1) JPWO2005020069A1 (ja)
WO (1) WO2005020069A1 (ja)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59165145A (ja) * 1983-03-10 1984-09-18 Fujitsu Ltd スタックポインタ回路
JPH05181703A (ja) * 1992-01-07 1993-07-23 Mitsubishi Electric Corp データ処理装置
JPH05305491A (ja) * 1992-04-27 1993-11-19 Showa Alum Corp フラックス埋込みAlろう材粉末の製造方法
JPH1196007A (ja) * 1997-09-24 1999-04-09 Sanyo Electric Co Ltd プロセッサの戻り番地読み出し制御方法及びプロセッサ
JP2001511271A (ja) * 1997-01-15 2001-08-07 シーメンス アクチエンゲゼルシヤフト ソフトウェアプログラムの規定通りの実行を監視するための方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59165145A (ja) * 1983-03-10 1984-09-18 Fujitsu Ltd スタックポインタ回路
JPH05181703A (ja) * 1992-01-07 1993-07-23 Mitsubishi Electric Corp データ処理装置
JPH05305491A (ja) * 1992-04-27 1993-11-19 Showa Alum Corp フラックス埋込みAlろう材粉末の製造方法
JP2001511271A (ja) * 1997-01-15 2001-08-07 シーメンス アクチエンゲゼルシヤフト ソフトウェアプログラムの規定通りの実行を監視するための方法
JPH1196007A (ja) * 1997-09-24 1999-04-09 Sanyo Electric Co Ltd プロセッサの戻り番地読み出し制御方法及びプロセッサ

Also Published As

Publication number Publication date
JPWO2005020069A1 (ja) 2006-10-19

Similar Documents

Publication Publication Date Title
JP4759059B2 (ja) メモリページをプログラムに対応付けるページカラーリング
JP4156611B2 (ja) 64ビットx86プロセッサ上でレガシ32ビットx86仮想マシンを実行するためのシステムおよび方法
US8327415B2 (en) Enabling byte-code based image isolation
US20050086517A1 (en) Page granular curtained memory via mapping control
JP6370098B2 (ja) 情報処理装置、情報処理監視方法、プログラム、及び記録媒体
TW200813833A (en) Launching hypervisor under running operating system
Tang et al. Exploring control flow guard in windows 10
RU2580016C1 (ru) Способ передачи управления между областями памяти
US11727110B2 (en) Verifying stack pointer
JP2004258840A (ja) 仮想化されたi/oデバイスをもつ計算機システム
CN107463513B (zh) 在存储位置之间转移控制的系统和方法
JP2005316599A (ja) 割込制御装置
JP5716824B2 (ja) マルチコアプロセッサシステム
JP6920286B2 (ja) 例外処理
WO2005020069A1 (ja) コンピュータシステムのcpu(中央処理装置)
Duflot et al. System management mode design and security issues
Geater ARM® TrustZone®
Carikli et al. The Intel Management Engine: An Attack on Computer Users’ Freedom
JP5920509B2 (ja) コントローラの制御プログラム、およびコントローラの制御方法
JP2018036695A (ja) 情報処理監視装置、情報処理監視方法、監視プログラム、記録媒体及び情報処理装置
RU2623883C1 (ru) Способ выполнения инструкций в системной памяти
Chen et al. DScope: To Reliably and Securely Acquire Live Data from Kernel-Compromised ARM Devices
JPWO2005029328A1 (ja) オペレーティングシステム、及びそれを記録した記録媒体
Early ESPRIT LTR 21917 (Pegasus II) Deliverable 2.1. 2 Pentium Port Report
Hu et al. Research on Hardware Built-in Computer Safety

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BW BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE EG ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NA NI NO NZ OM PG PH PL PT RO RU SC SD SE SG SK SL SY TJ TM TN TR TT TZ UA UG US UZ VC VN YU ZA ZM ZW

AL Designated countries for regional patents

Kind code of ref document: A1

Designated state(s): GM KE LS MW MZ NA SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HU IE IT LU MC NL PL PT RO SE SI SK TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
WWE Wipo information: entry into national phase

Ref document number: 2005513345

Country of ref document: JP

122 Ep: pct application non-entry in european phase