KR20190060109A - Instruction-level data isolation method and apparatus - Google Patents

Instruction-level data isolation method and apparatus Download PDF

Info

Publication number
KR20190060109A
KR20190060109A KR1020170157942A KR20170157942A KR20190060109A KR 20190060109 A KR20190060109 A KR 20190060109A KR 1020170157942 A KR1020170157942 A KR 1020170157942A KR 20170157942 A KR20170157942 A KR 20170157942A KR 20190060109 A KR20190060109 A KR 20190060109A
Authority
KR
South Korea
Prior art keywords
kernel
page table
protection area
access
space
Prior art date
Application number
KR1020170157942A
Other languages
Korean (ko)
Other versions
KR102075701B1 (en
Inventor
백윤흥
조영필
권동현
Original Assignee
서울대학교산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 서울대학교산학협력단 filed Critical 서울대학교산학협력단
Priority to KR1020170157942A priority Critical patent/KR102075701B1/en
Publication of KR20190060109A publication Critical patent/KR20190060109A/en
Application granted granted Critical
Publication of KR102075701B1 publication Critical patent/KR102075701B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/604Tools and structures for managing or administering access control systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • 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/78Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Automation & Control Theory (AREA)
  • Storage Device Security (AREA)

Abstract

Disclosed are a method and an apparatus for isolating instruction level data. A system control module sets a protection area at a non-privileged level in a kernel space of a memory, uses an access control function to restrict access to the protection area by an instruction executed at a privileged level, and allows a predetermined specific instruction executed at a non-privileged level to access to the protection area.

Description

명령어 레벨 데이터 격리 방법 및 장치{Instruction-level data isolation method and apparatus}≪ Desc / Clms Page number 1 > Instruction-level data isolation method and apparatus &

본 발명은 명령어 레벨 데이터 격리 방법 및 그 장치에 관한 것으로, 보다 상세하게는 모바일 디바이스의 OS(Operating System) 커널의 데이터를 보호할 수 있는 명령어 레벨 데이터 격리 방법 및 그 장치에 관한 것이다.BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method and apparatus for isolating a command level data, and more particularly, to a command level data isolation method and apparatus for protecting data of an OS (Operating System) kernel of a mobile device.

스마트폰 등을 포함한 다양한 종류의 모바일 디바이스가 존재하며, 사이버 공격의 대상이 되고 있다. 악성 코드 등의 다양한 사이버 공격에 대처하기 위하여 종래 모바일 디바이스는 MMU(Memory Management Unit)의 메모리 접근 제어(memory access control) 기능을 이용한다. MMU는 읽기/쓰기 메모리 보호(read/write memory protection)를 설정하여 민감한 데이터를 외부로부터 격리하여 보호한다. 그러나 정상적인 명령어가 MMU에 의해 보호되는 데이터에 접근할 때마다 MMU가 매번 메모리 보호 기능의 해제/설정을 반복하여야 하므로 리턴 어드레스(return address) 등과 같이 빈번하게 접근하는 데이터들의 보호에 비효율적이다.Mobile phones, smart phones, and the like, and are subject to cyber attacks. In order to cope with various cyber attacks such as malicious codes, a conventional mobile device uses a memory access control function of a memory management unit (MMU). The MMU sets read / write memory protection to isolate and protect sensitive data from the outside. However, it is inefficient to protect frequently accessed data such as a return address because the MMU must repeatedly release / set the memory protection function every time a normal command accesses data protected by the MMU.

공개특허공보 제10-2017-0067740호 "운영 체제 공격으로부터 애플리케이션 기밀사항을 보호하는 기법"Published Japanese Patent Application No. 10-2017-0067740 " Technique for protecting application confidentiality from operating system attack "

본 발명이 이루고자 하는 기술적 과제는, 명령어 레벨 데이터 격리 방법 및 그 장치를 제공하는 데 있다. SUMMARY OF THE INVENTION The present invention is directed to a method and apparatus for isolating instruction level data.

상기의 기술적 과제를 달성하기 위한, 본 발명에 따른 명령어 레벨 데이터 격리 방법의 일 예는, 메모리의 커널 공간에 비특권 레벨의 보호 영역을 설정하는 단계; 및 접근제어기능을 이용하여 특권 레벨에서 수행되는 명령어가 상기 보호 영역에 접근하는 것을 제한하고, 비특권 레벨에서 수행되는 기 설정된 특수 명령어가 상기 보호 영역에 접근하는 것을 허락하는 단계;를 포함한다.According to another aspect of the present invention, there is provided an instruction level data isolation method comprising: setting a protection area of a non-privilege level in a kernel space of a memory; And restricting access to the protection area by an instruction executed at a privilege level using an access control function, and allowing a predetermined special instruction executed at a non-privilege level to access the protection area.

상기의 기술적 과제를 달성하기 위한, 본 발명에 따른 명령어 레벨 데이터 격리 장치의 일 예는, 페이지 테이블 및 레지스터에 대한 전권을 가지고, 커널보다 더 높은 특권을 가지는 시스템제어모듈; 및 메모리의 커널 공간에 생성된 비특권 레벨의 보호 영역;을 포함하고, 상기 시스템제어모듈은 특권 레벨에서 수행되는 명령어가 상기 보호 영역에 접근하는 것을 제한하고, 비특권 레벨에서 수행되는 기 설정된 특수 명령어가 상기 보호 영역에 접근할 수 있도록 접근제어기능을 설정한다.According to an aspect of the present invention, there is provided an instruction level data isolation apparatus comprising: a system control module having a privilege level for a page table and a register, and having a higher privilege than a kernel; And a non-privilege level protection area generated in a kernel space of the memory, wherein the system control module restricts access to the protection area from an instruction executed at a privilege level, The access control function is set so that the command can access the protection area.

본 발명에 따르면, 종래와 같이 MMU의 메모리 보호(memory protection) 설정을 변경할 필요없이 명령어 레벨에서 데이터 격리(data isolation)를 구현할 수 있다. 커널 개발자는 두 종류의 메모리 접근 명령어(일반 명령어, 특수 명령어)를 이용하여 다양한 보안 솔루션 등을 개발할 수 있다.According to the present invention, it is possible to implement data isolation at the instruction level without changing the memory protection setting of the MMU as in the prior art. Kernel developers can develop various security solutions using two kinds of memory access commands (general commands, special commands).

도 1은 본 발명의 실시 예에 따른 명령어 레벨 데이터 격리 방법의 일 예를 도시한 도면,
도 2는 본 발명의 실시 예에 따른 특수 명령어의 일 예를 도시한 도면,
도 3은 본 발명의 실시 예에 따른 페이지 테이블 맵핑 방법의 일 예를 도시한 도면,
도 4는 본 발명의 실시 예에 따른 명령어 레벨 데이터 격리 방법의 일 예를 도시한 도면, 그리고,
도 5는 본 발명의 실시 예에 따른 명령어 레벨 데이터 격리 방법의 다른 예를 도시한 도면이다.
1 is a diagram illustrating an example of a method for isolating an instruction level data according to an embodiment of the present invention;
FIG. 2 illustrates an example of a special instruction word according to an embodiment of the present invention; FIG.
3 is a diagram illustrating an example of a page table mapping method according to an embodiment of the present invention.
4 is a diagram illustrating an example of a method of isolating an instruction level data according to an embodiment of the present invention,
5 is a diagram illustrating another example of a command level data isolation method according to an embodiment of the present invention.

이하에서, 첨부된 도면들을 참조하여 본 발명의 실시 예에 따른 명령어 레벨 데이터 격리 방법 및 그 장치에 대해 상세히 설명한다.DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, a method and apparatus for isolating an instruction level data according to an embodiment of the present invention will be described in detail with reference to the accompanying drawings.

도 1은 본 발명의 실시 예에 따른 명령어 레벨 데이터 격리 방법의 일 예를 도시한 도면이다.1 is a diagram illustrating an example of a command level data isolation method according to an embodiment of the present invention.

도 1을 참조하면, 커널 코드(100)는 일반 명령어(예를 들어, ldr, str 등)와 더불어 특수 명령어(예를 들어, ldtr, sttr 등)를 포함할 수 있다. 특수 명령어는 비특권 레벨(unprivileged level)(또는 사용자 레벨(user level))에서 메모리 동작(memory operation)을 수행하는 명령어이며, 본 발명이 구현되는 프로세서 아키텍처에서 제공할 수 있다. ARM 아키텍처에서 제공하는 특수 명령어의 일 예는 도 2에 도시되어 있다.Referring to FIG. 1, the kernel code 100 may include special instructions (e.g., ldtr, sttr, etc.) with general instructions (e.g., ldr, str, etc.). A special instruction is an instruction to perform a memory operation at an unprivileged level (or a user level) and may be provided in a processor architecture in which the present invention is implemented. An example of the special instructions provided by the ARM architecture is shown in FIG.

메모리의 커널 공간(kernel space)(110)은 보호할 커널 데이터를 저장하는 보호 영역(safe region)(112)과 일반 커널 데이터를 저장하는 일반 영역(regular region)(114)으로 구분된다. The kernel space 110 of the memory is divided into a safe region 112 for storing kernel data to be protected and a regular region 114 for storing general kernel data.

특수 명령어는 접근제어기능에 의해 커널 공간(110)의 보호 영역(112)에 대한 접근이 제어된다. 접근제어기능은 ARM 아키텍처의 PAN(Priviledged Access Never)(120) 또는 x86 아키텍처의 SMAP(Supervisor Mode access Prevention)에 의해 구현될 수 있다. 이 외에도 접근제어기능은 다양한 방법에 의해 구현될 수 있다. 본 실시 예는 설명의 편의를 위해 접근제어기능이 ARM 아키텍처의 PAN(120)으로 구현된 경우를 가정한다.In the special instruction, the access to the protection area 112 of the kernel space 110 is controlled by the access control function. The access control function can be implemented by the Priviledged Access Never (PAN) 120 of the ARM architecture or the Supervisor Mode access Prevention (SMAP) of the x86 architecture. In addition, access control functions can be implemented in various ways. For convenience of description, this embodiment assumes that the access control function is implemented in the PAN 120 of the ARM architecture.

PAN 비트가 "1"로 설정된 경우에, 특권 레벨(privileged level)(또는, 커널 레벨(kernel level))에서 동작하는 커널 코드는 사용자 데이터 등이 저장된 비특권 레벨의 보호 영역에 대한 접근이 제한된다. PAN 비트가 "1"인 상황에서, 특권 레벨에서 일반 명령어가 보호 영역에 접근을 시도하면 허가 오류(permission fault)가 발생한다. When the PAN bit is set to " 1 ", kernel code operating at a privileged level (or kernel level) is restricted access to non-privilege level protected areas where user data, etc. are stored . In the situation where the PAN bit is "1", a permission fault occurs when a general instruction attempts to access the protection area at privileged level.

CPSR(Current Program Status Register)에 속하는 PAN 비트를 직접 설정(setting) 또는 해제(clearing)하거나, SCTLR(System Control Register)의 SPAN 비트를 해제하여 PAN 비트를 설정할 수 있다. PAN 비트는 특권 레벨에 대한 예외상황(exception)이 발생하면 "1"로 설정된다.The PAN bit can be set by directly setting or clearing the PAN bit belonging to the CPSR (Current Program Status Register) or clearing the SPAN bit of SCTLR (System Control Register). The PAN bit is set to "1" when an exception occurs for a privilege level.

PAN 비트를 1로 설정하고 보호 영역을 비특권 레벨로 유지하기 위하여, 페이지 테이블과 시스템 레지스터의 무결성(integrity)을 보호하여야 한다. 이를 위해 본 실시 예는 페이지 테이블과 레지스터에 대한 배타적 제어 권한(exclusive control authority)를 가지는 시스템제어모듈(System Control module, 이하, 'SC 모듈'이라 함)을 포함한다. SC 모듈은 커널보다 더 높은 특권을 가지며, 커널과 분리되어 있다. 커널은 전용 게이트(dedicated gates)를 통해서만 SC 모듈을 호출할 수 있다. SC 모듈은 커널보다 더 높은 권한을 가지는 모드에서 수행되는 일종의 프로그램 코드로 구현될 수 있다.In order to set the PAN bit to 1 and keep the protection area at a non-privileged level, the integrity of the page table and system registers must be protected. To this end, the present embodiment includes a system control module (hereinafter referred to as 'SC module') having an exclusive control authority with respect to a page table and a register. The SC module has higher privileges than the kernel and is separate from the kernel. The kernel can call SC modules only through dedicated gates. An SC module can be implemented as a kind of program code that is executed in a mode with higher privileges than the kernel.

예를 들어, ARM 아키텍처는 커널 레벨보다 더 높은 프로세서 모드인 'Hyp 모드'를 제공한다. Hyp 모드는 그 자신의 페이지 테이블을 가지고 있어 커널에 의해 설정된 접근 권한과 관계없이 메모리에 접근할 수 있다. 또한, Hyp 모드는 가장 높은 프로세서 모드를 가지므로, 모든 시스템 레지스터를 설정할 수 있고, Hyp 모드를 위해 추가된 특별 레지스터를 통해 하드웨어 트랩(hardware traps)을 설정하여 커널이 시스템 레지스터에 접근하는 것을 모니터링하고 개입할 수 있다. 커널은 ARM 아키텍처에 정의된 호출 명령인 HVC(Hypervisor Call) 명령어를 수행하여 Hyp 모드로 들어갈 수 있다. For example, the ARM architecture provides a 'Hyp mode' which is a higher processor mode than the kernel level. Hyp mode has its own page table, which allows access to memory regardless of the access rights set by the kernel. In addition, Hyp mode has the highest processor mode, so you can set all system registers, set up hardware traps through special registers added for Hyp mode, monitor kernel access to system registers Can intervene. The kernel can enter Hyp mode by executing the HVC (Hypervisor Call) command, which is a call command defined in the ARM architecture.

SC 모듈은 하드웨어 트랩을 설정하여 커널이 시스템 레지스터에 접근하는 것을 막을 수 있다. 커널이 시스템 레지스터를 변경하는 모든 시도는 SC 모듈에 의해 모니터링되므로, SC 모듈은 커널의 시스템 레지스터의 변경을 철저히 검증한 후에 그 변경이 이루어지도록 할 수 있다. The SC module can set up hardware traps to prevent the kernel from accessing system registers. All attempts by the kernel to change the system registers are monitored by the SC module so that the SC module can thoroughly validate changes to the kernel's system registers before making those changes.

SC 모듈이 페이지 테이블에 대한 배타적 제어권한(exclusive control)을 가지고 보호 영역을 비특권 레벨로 유지하기 위하여, 본 실시 예는 확장 페이징 스킴(extended paging scheme)을 이용할 수 있다. 그러나 확장 페이징 스킴은 시스템 성능의 저하를 가져오므로, 다른 실시 예로, 쉐도우 페이지 테이블(shadow page table)과 유사한 스킴을 적용할 수 있다. 먼저, SC 모듈은 페이지 테이블을 메모리의 커널 공간에 읽기 전용(read-only)으로 설정하여, 커널이 그 자신의 페이지 테이블을 변경할 수 없도록 한다. 페이지 테이블의 내용을 갱신하려면, 커널은 HVC 명령어를 호출하여 SC 모듈에게 요청하여야 한다. 그러면 SC 모듈은 갱신 요청을 검증한 후 커널을 대신하여 페이지 테이블의 내용 갱신을 수행한다. 또한, SC 모듈은 그 자신의 메모리 영역이 페이지 테이블에 의해 맵핑되는 것을 방지한다. 따라서 커널은 HVC 명령어를 통하지 않고서 SC 모듈에 접근할 수 없다.In order for the SC module to have exclusive control of the page table and keep the protection area at a non-privileged level, the present embodiment may use an extended paging scheme. However, since the extended paging scheme results in degradation of the system performance, in another embodiment, a scheme similar to a shadow page table can be applied. First, the SC module sets the page table to read-only in the kernel's space in memory so that the kernel can not change its own page table. To update the contents of the page table, the kernel must call the SC module by calling the HVC command. The SC module then verifies the update request and then updates the contents of the page table on behalf of the kernel. In addition, the SC module prevents its own memory area from being mapped by the page table. Therefore, the kernel can not access the SC module without going through HVC commands.

PAN 비트는 커널이 동작 중인 동안에 항상 1을 유지하여야 한다. 이를 위해, PAN 비트를 해제(clear)하는 명령어들(예를 들어, ARM 아키텍처의 MSR PAN, <imm|reg> 등)은 커널 코드에서 제거될 수 있다. SC 모듈이 커널 코드로부터 PAN 비트의 해제 명령어들을 제거하거나 사용자가 커널 코드에서 해제 명령어들을 제거할 수 있다. SC 모듈은 제어권한(control)이 커널로 넘어갈 때 PAN 비트를 켜기 위하여 SCTLR(System Control Register)의 SPAN 비트를 해제할 수 있다. 만약 PAN 비트가 항상 설정되어 있다면, 커널은 보호 영역뿐만 아니라 사용자 공간(user space)에도 접근할 수 없다. 이 경우 사용자 공간에 접근하려는 몇몇 커널 함수의 평범한 동작들이 방해되어 커널 패닉(kernel panic)이 일어날 수 있다. 이를 해결하기 위하여, SC 모듈은 보호 영역 또는 사용자 영역에 대한 동작들을 수행하는 함수들을 포함하고, 커널이 HVC 명령어를 통해 SC 모듈의 함수들을 호출할 수 있도록 한다.The PAN bit should always be set to 1 while the kernel is running. To this end, instructions that clear the PAN bit (e.g., MSR PAN, <imm | reg> in the ARM architecture, etc.) may be removed from the kernel code. The SC module may remove the PAN bit release instructions from the kernel code or the user may remove the release instructions from the kernel code. The SC module can release the SPAN bit in the SCTLR (System Control Register) to turn on the PAN bit when control passes to the kernel. If the PAN bit is always set, the kernel can not access the user space as well as the protected area. In this case, some of the kernel functions that attempt to access user space may be interrupted, causing kernel panic. To solve this, the SC module includes functions for performing operations on the protection area or the user area, and allows the kernel to call the functions of the SC module via HVC instructions.

PAN 비트가 올바르게 유지된다면, 보호 영역은 비특권 레벨로 설정되는 동안 안전하게 보호될 수 있다. 따라서 커널이 SC 모듈에서 페이지 테이블 변경 요청을 전송하면, SC 모듈은 그 변경 요청이 기 설정된 조건을 만족하는지 파악한다. 페이지 테이블의 무결성을 유지하기 위한 종래의 다양한 조건들이 존재할 수 있다. 이와 함께, SC 모듈은 보호 영역의 물리적 주소가 다른 접근 허락을 가진 다른 가상 주소와 맵핑할 때 발생하는 이중-맵핑 문제(double-mapping problem)을 검출하고 방지한다. SC 모듈은 MMU를 비활성화시키거나 페이지 테이블의 베이스 주소를 가리키는 레지스터(예를 들어, ARM 아키텍터의 TTBR(Translation Table Base Register))를 변경하여 보호 영역의 보호를 무력화시키는 커널의 시도를 차단한다.If the PAN bits are properly maintained, the protection area can be safeguarded while being set to a non-privileged level. Therefore, when the kernel sends a page table change request from the SC module, the SC module determines whether the change request meets predetermined conditions. Various conventional conditions for maintaining the integrity of the page table may exist. In addition, the SC module detects and prevents the double-mapping problem that occurs when the physical address of the protected area is mapped to another virtual address with a different access permission. The SC module blocks the kernel's attempt to disable protection of the protection area by disabling the MMU or by changing a register (eg, the Translation Table Base Register (TTBR) in the ARM architecture) that points to the base address of the page table.

도 2는 본 발명의 실시 예에 따른 특수 명령어의 일 예를 도시한 도면이다.2 is a diagram illustrating an example of a special instruction word according to an embodiment of the present invention.

도 2를 참조하면, 특수 명령어는 비특권 레벨에서 동작하는 명령어로 메모리에 저장된 데이터를 읽는 다양한 종류의 Load 명령어와 메모리에 데이터를 저장하는 다양한 종류의 Store 명령어들을 포함한다. Referring to FIG. 2, a special instruction word includes various kinds of Load instructions for reading data stored in a memory with instructions operating at a non-privileged level, and various types of Store instructions for storing data in the memory.

특권 레벨에서 특수 명령어가 실행되면, 특수 명령어는 비특권 레벨에서 수행되는 것처럼 취급된다. 다시 말해, 메모리 영역에 접근하기 위하여 특수 명령어를 사용하면, 해당 접근은 페이지 테이블에 기술된 비특권 레벨의 접근 허가(access permission)에 의존한다.When a special instruction is executed at a privilege level, the special instruction is treated as if it were executed at a non-privileged level. In other words, if you use special commands to access the memory area, the access depends on the access privileges of the non-privileged levels described in the page table.

본 실시 예는 ARM 아키텍처에서 제공하는 특수 명령어의 일 예를 도시하고 있으나, 본 발명은 이에 한정되는 것은 아니며 x86 아키텍처를 포함한 다양한 종류의 아키텍처에서 비특권 레벨에서 동작하는 특수 명령어를 제공하면 이를 이용할 수 있다.Although the present embodiment shows an example of a special instruction word provided in the ARM architecture, the present invention is not limited thereto. It is possible to use special instruction words that operate at a non-privilege level in various kinds of architectures including the x86 architecture have.

도 3은 본 발명의 실시 예에 따른 페이지 테이블 맵핑 방법의 일 예를 도시한 도면이다.3 is a diagram illustrating an example of a page table mapping method according to an embodiment of the present invention.

도 3을 참조하면, 보호 영역(314)이 비특권으로 설정되어 있으므로, 악의적인 사용자 프로세스가 보호 영역을 침범할 우려가 존재한다. 이를 해결하기 위하여, 사용자 프로세스 또는 커널 중 어느 것이 동작 중인지에 따라 보호 영역(314)을 숨기거나 노출한다. 예를 들어, SC 모듈은 커널 공간 전체(312,314)의 주소 맵핑을 저장하는 기존의 제1 커널 페이지 테이블과 별도로 커널 영역에서 보호 영역을 제외한 영역(302)의 주소 맵핑을 저장하는 별도의 제2 커널 페이지 테이블을 만든다. Referring to FIG. 3, since the protection area 314 is set as non-privileged, there is a fear that a malicious user process may invade the protection area. In order to solve this, the protection area 314 is hidden or exposed depending on which of the user process or the kernel is operating. For example, the SC module may include a separate second kernel, which stores the address mapping of the area 302 excluding the protection area, in addition to the existing first kernel page table storing the address mapping of the entire kernel space 312, Create a page table.

예를 들어, ARM 아키텍처는 가상-물리 주소 변환(virtual-to-physical address translation)을 위하여, 현 페이지 테이블의 베이스 주소를 가지는 두 개의 레지스터(예를 들어, TTBR0 및 TTBR1)를 제공한다. TTBR0은 사용자 공간(300,310)에 해당하는 가상 주소를 변환하는데 사용되고, TTBR1은 커널 공간(302,312,314)에 해당하는 가상 주소를 변환하는데 사용된다.For example, the ARM architecture provides two registers (for example, TTBR0 and TTBR1) with a base address of the current page table for virtual-to-physical address translation. TTBR0 is used to convert the virtual address corresponding to the user space 300, 310, and TTBR1 is used to convert the virtual address corresponding to the kernel space 302, 312, 314.

따라서, 사용자 프로세스가 수행될 때, SC 모듈은 TTBR1이 제2 커널 페이지 테이블을 가리키도록 변경하여 제2 커널 페이지 테이블을 활성화시킨다. 제2 커널 페이지 테이블은 보호 영역(314)에 대한 어떠한 맵핑도 포함하지 않으므로, 사용자 프로세스는 보호 영역의 내용을 읽거나 변경할 수 없다. 제2 커널 페이지 테이블은 사용자 프로세스가 제어권한을 가지는 경우에만 사용된다. 인터럽트 또는 예외상황에 의해 제어권한이 커널로 넘어가면, SC 모듈은 TTBR1이 원래의 제1 커널 페이지 테이블을 가리키도록 변경하여 제1 커널 페이지 테이블을 활성화시킨다.Thus, when the user process is performed, the SC module changes the TTBR1 to point to the second kernel page table to activate the second kernel page table. Since the second kernel page table does not include any mapping to the protection area 314, the user process can not read or change the contents of the protection area. The second kernel page table is used only when the user process has control authority. When an interrupt or exception causes control to pass to the kernel, the SC module activates the first kernel page table by changing TTBR1 to point to the original first kernel page table.

보호 영역의 주소 맵핑은 TLB(Translation Lookaside Buffer)에 캐시(cache)되어 있을 수 있다. 이 경우 공격자는 사용자 프로세스로 TLB 엔트리를 이용하여 보호 영역에 대한 접근을 시도할 수 있다. 이 문제를 해결하기 위하여 커널이 사용자 프로세스에게 제어권한을 넘겨주기 전에 캐시된 TLB 엔트리를 무효화(invalidate)하는 방법이 있다. The address mapping of the protected area may be cached in the Translation Lookaside Buffer (TLB). In this case, the attacker can attempt to access the protected area using the TLB entry as a user process. To solve this problem, there is a way to invalidate a cached TLB entry before the kernel passes control to the user process.

다른 방법으로 ASID(Address Space Identifier)를 이용하는 방법이 있다. ARM 아키텍처는 가상 주소 공간을 매번 스위칭할 때마다 불필요한 TLB 플러시를 줄이기 위하여, TLB 엔트리에 태깅하는 식별자(즉, ASID)를 제공한다. 또한, ARM 아키텍처는 페이지 테이블 디스크립터(page table descriptor)에 non-Global(nG) 플래그를 제공하므로, 그 플래그를 해제하여 ASID가 특정 페이지에서 무시될 수 있도록 할 수 있다.Another way is to use an ASID (Address Space Identifier). The ARM architecture provides an identifier (i.e., ASID) tagging the TLB entry to reduce unnecessary TLB flushes each time the virtual address space is switched each time. In addition, the ARM architecture provides a non-Global (nG) flag in the page table descriptor, so you can disable it so that the ASID can be ignored on a particular page.

이러한 특징을 이용하여, SC 모듈은 두 개의 서로 다른 ASID를 커널과 사용자 프로세스에 각각 할당하고, 커널과 사용자 프로세스 중 현재 제어권한을 가진 것이 어느 것인지에 따라 해당 ASID를 활성화시킨다. 커널이 제어권한을 가진 상황에서 TLB 엔트리에 보호 영역의 맵핑이 캐시되어도, 사용자 프로세스는 커널의 ASID와 다른 ASID를 사용하므로 보호 영역의 캐시된 맵핑을 사용할 수 없다. 커널 공간은 대부분 전체 영역과 맵핑되므로, ASID 스위칭은 성능 불이익(performance penalty)을 일으키지 않는다. TLB 관리 커널 함수는 사용자 프로세스의 ASID와 커널의 ASID를 각각 가지고 두 번 동작한다. Using this feature, the SC module assigns two different ASIDs to the kernel and user processes, respectively, and activates the corresponding ASID depending on which of the kernel and user processes currently has control. Even if the mapping of the protection area is cached in the TLB entry in the situation where the kernel has control authority, the user process can not use the cached mapping of the protection area because it uses a different ASID than the ASID of the kernel. Since kernel space is mostly mapped to the entire area, ASID switching does not cause performance penalties. The TLB management kernel function operates twice with the ASID of the user process and the ASID of the kernel respectively.

도 4는 본 발명의 실시 예에 따른 명령어 레벨 데이터 격리 방법의 일 예를 도시한 도면이다.4 is a diagram illustrating an example of a command level data isolation method according to an embodiment of the present invention.

도 4를 참조하면, SC 모듈은 커널 공간에 비특권 레벨의 보호 영역을 설정한다(S400). SC 모듈은 PAN 비트 등으로 구현된 접근제어기능의 설정을 통해 특수 명령어만이 보호 영역에 접근가능하도록 한다.Referring to FIG. 4, the SC module sets a protection area of a non-privilege level in the kernel space (S400). The SC module makes access to the protection area only by special commands through the setting of the access control function implemented by the PAN bits and so on.

예를 들어, PAN 비트가 설정되고 보호 영역이 비특권으로 유지된 경우에, 명령어가 일반 커널 명령어이면(S410), 보호 영역에 대한 접근이 불가능하다(S430). 반면, 명령어가 비특권 레벨의 특수 명령어(예를 들어, 도 2)이면, 보호 영역에 대한 접근이 허락된다(S420). 커널이 특권 레벨에서 동작중인 경우에, 특수 명령어는 마치 비특권 레벨에서 동작되는 것처럼 취급되므로, PAN 비트가 설정된 경우에 특수 명령어는 비특권 레벨의 접근 허가에 따라 보호 영역에 대한 접근 여부가 결정될 수 있다. For example, when the PAN bit is set and the protection area is maintained as non-privileged, if the command is a general kernel command (S410), access to the protection area is not possible (S430). On the other hand, if the instruction is a special instruction of a non-privilege level (e.g., FIG. 2), access to the protected area is allowed (S420). When the kernel is operating at a privilege level, special instructions are treated as if they are operated at a non-privileged level, so that if the PAN bit is set, the special instruction can determine whether to access the protected area have.

도 5는 본 발명의 실시 예에 따른 명령어 레벨 데이터 격리 방법의 다른 예를 도시한 도면이다.5 is a diagram illustrating another example of a command level data isolation method according to an embodiment of the present invention.

도 5를 참조하면, 악의적인 사용자 프로세스가 보호 영역에 접근하는 것을 방지하기 위하여, SC 모듈은 커널 공간에 대한 제1 커널 페이지 테이블과, 커널 공간에서 보호 영역을 제외한 공간에 대한 제2 커널 페이지 테이블을 생성한다(S500).Referring to FIG. 5, in order to prevent a malicious user process from accessing the protection area, the SC module includes a first kernel page table for the kernel space, a second kernel page table for the space excluding the protection area in the kernel space, (S500).

사용자 프로세스에 제어권한이 넘어갈 때(S510), SC 모듈은 커널 페이지 테이블의 베이스 주소를 가리키는 레지스터의 값을 제2 커널 페이지 테이블의 베이스 주소로 변경한다(S530). 제어권한이 커널로 넘어갈 때(S510), SC 모듈은 커널 페이지 테이블의 베이스 주소를 가리키는 레지스터의 값을 제1 커널 페이지 테이블의 베이스 주소로 변경한다(S520).When the control right passes to the user process (S510), the SC module changes the value of the register indicating the base address of the kernel page table to the base address of the second kernel page table (S530). When the control right passes to the kernel (S510), the SC module changes the value of the register indicating the base address of the kernel page table to the base address of the first kernel page table (S520).

또한, SC 모듈은 사용자 프로세스가 TLB 캐시를 이용하여 보호 영역에 접근 하는 것을 방지하기 위하여, 주소공간식별자(ASID)를 커널과 사용자 프로세스에 각각 할당한 후 제어권한이 커널과 사용자 프로세스 중 어느 것이 가지는지에 따라 ASID를 스위칭할 수 있다.In order to prevent the user process from accessing the protection area using the TLB cache, the SC module allocates the address space identifier (ASID) to the kernel and the user process, respectively, The ASID can be switched according to whether or not the ASID is changed.

본 발명은 또한 컴퓨터로 읽을 수 있는 기록매체에 컴퓨터가 읽을 수 있는 코드로서 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 기록매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 컴퓨터가 읽을 수 있는 기록매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광데이터 저장장치 등이 있다. 또한 컴퓨터가 읽을 수 있는 기록매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어 분산방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다.The present invention can also be embodied as computer-readable codes on a computer-readable recording medium. A computer-readable recording medium includes all kinds of recording apparatuses in which data that can be read by a computer system is stored. Examples of the computer-readable recording medium include ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage, and the like. The computer-readable recording medium may also be distributed over a networked computer system so that computer readable code can be stored and executed in a distributed manner.

이제까지 본 발명에 대하여 그 바람직한 실시예들을 중심으로 살펴보았다. 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명이 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 변형된 형태로 구현될 수 있음을 이해할 수 있을 것이다. 그러므로 개시된 실시예들은 한정적인 관점이 아니라 설명적인 관점에서 고려되어야 한다. 본 발명의 범위는 전술한 설명이 아니라 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.The present invention has been described with reference to the preferred embodiments. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the disclosed embodiments should be considered in an illustrative rather than a restrictive sense. The scope of the present invention is defined by the appended claims rather than by the foregoing description, and all differences within the scope of equivalents thereof should be construed as being included in the present invention.

Claims (13)

메모리의 커널 공간에 비특권 레벨의 보호 영역을 설정하는 단계; 및
접근제어기능을 이용하여 특권 레벨에서 수행되는 명령어가 상기 보호 영역에 접근하는 것을 제한하고, 비특권 레벨에서 수행되는 기 설정된 특수 명령어가 상기 보호 영역에 접근하는 것을 허락하는 단계;를 포함하는 것을 특징으로 하는 명령어 레벨 데이터 격리 방법.
Setting a protection area of a non-privilege level in a kernel space of the memory; And
And restricting access to the protection area by an instruction executed at a privilege level using an access control function and allowing a predetermined special instruction executed at a non-privilege level to access the protection area Level data isolation method.
제 1항에 있어서,
상기 접근제어기능은 ARM 아키텍쳐의 PAN 비트로 구현되고,
상기 허락하는 단계는, 상기 PAN 비트가 1이면 상기 특수 명령어만이 상기 보호 영역에 접근하는 것을 허락하는 단계를 특징으로 하는 명령어 레벨 데이터 격리 방법.
The method according to claim 1,
The access control function is implemented with the PAN bits of the ARM architecture,
Wherein the granting step permits only the special instruction to access the protection area if the PAN bit is a &lt; RTI ID = 0.0 &gt; 1. &lt; / RTI &gt;
제 1항에 있어서,
상기 특수 명령어는 비특권 레벨에서 상기 보호 영역에 대한 읽기 또는 쓰기 동작을 수행하는 명령어인 것을 특징으로 하는 명령어 레벨 데이터 격리 방법.
The method according to claim 1,
Wherein the special instruction word is a command for performing a read or a write operation on the protection area at a non-privilege level.
제 1항에 있어서,
커널의 페이지 테이블 변경 요청이 있으면, 보호 영역의 물리적 주소가 다른 접근 권한을 가진 다른 가상 주소와 맵핑될 때 발생하는 이중-맵핑 문제를 검증하는 단계;를 더 포함하는 것을 특징으로 하는 명령어 레벨 데이터 격리 방법.
The method according to claim 1,
Further comprising verifying a double-mapping problem that occurs when a physical address of a protected area is mapped to another virtual address having a different access right, in response to a page table change request of the kernel, Way.
제 1항에 있어서,
커널 공간에 대한 제1 커널 페이지 테이블과 상기 커널 공간에서 상기 보호 영역을 제외한 공간에 대한 제2 커널 페이지 테이블을 생성하는 단계; 및
커널과 사용자 프로세스 중 어느 것이 동작하고 있는지에 따라 커널 페이지 테이블의 베이스 주소를 가리키는 레지스터의 값을 상기 제1 커널 페이지 테이블의 베이스 주소 또는 상기 제2 커널 페이지 테이블의 베이스 주소로 변경하는 단계;를 더 포함하는 것을 특징으로 하는 명령어 레벨 데이터 격리 방법.
The method according to claim 1,
Generating a first kernel page table for a kernel space and a second kernel page table for a space excluding the protection area in the kernel space; And
Changing a value of a register indicating a base address of a kernel page table to a base address of the first kernel page table or a base address of the second kernel page table depending on which of a kernel and a user process is operating Wherein the instruction-level data isolation method comprises:
제 1항에 있어서,
TLB(Translation Lookaside Buffer)의 각 엔트리를 식별하는 서로 다른 제1 주소공간식별자(제1 ASID)와 제2 주소공간식별자(제2 ASID)를 커널과 사용자 프로세스에 각각 할당하는 단계를 더 포함하는 것을 특징으로 하는 명령어 레벨 데이터 격리 방법.
The method according to claim 1,
(First ASID) and a second address space identifier (second ASID) that identify each entry of the Translation Lookaside Buffer (TLB) to the kernel and the user process, respectively A method for isolating instruction level data.
페이지 테이블 및 레지스터에 대한 전권을 가지고, 커널보다 더 높은 특권을 가지는 시스템제어모듈; 및
메모리의 커널 공간에 생성된 비특권 레벨의 보호 영역;을 포함하고,
상기 시스템제어모듈은 특권 레벨에서 수행되는 명령어가 상기 보호 영역에 접근하는 것을 제한하고, 비특권 레벨에서 수행되는 기 설정된 특수 명령어가 상기 보호 영역에 접근할 수 있도록 접근제어기능을 설정하는 것을 특징으로 하는 명령어 레벨 데이터 격리 장치.
A system control module with full privileges on page tables and registers, with higher privileges than the kernel; And
A protection area of a non-privilege level generated in a kernel space of the memory,
The system control module limits access of the instruction executed at the privilege level to the protection area and sets an access control function so that a predetermined special instruction executed at a non-privilege level can access the protection area. Command-level data isolation device.
제 7항에 있어서,
상기 페이지 테이블은 읽기전용으로 상기 커널 공간에 구현되는 것을 특징으로 하는 명령어 레벨 데이터 격리 장치.
8. The method of claim 7,
Wherein the page table is implemented in the kernel space as read-only.
제 7항에 있어서,
상기 접근제어기능은 ARM 아키텍쳐의 PAN 비트로 구현되고,
상기 시스템제어모듈은, 상기 PAN 비트의 설정을 통해 보호 영역에 대한 접근 제어를 수행하는 것을 특징으로 하는 명령어 레벨 데이터 격리 장치.
8. The method of claim 7,
The access control function is implemented with the PAN bits of the ARM architecture,
Wherein the system control module performs access control on the protection area through the setting of the PAN bit.
제 7항에 있어서,
상기 시스템제어모듈은, 보호 영역의 물리적 주소가 다른 접근 권한을 가진 다른 가상 주소와 맵핑될 때 발생하는 이중-맵핑 문제를 검증하는 것을 특징으로 하는 명령어 레벨 데이터 격리 장치.
8. The method of claim 7,
Wherein the system control module verifies a double-mapping problem that occurs when a physical address of a protected area is mapped to another virtual address having a different access right.
제 7항에 있어서,
커널 공간에 대한 제1 커널 페이지 테이블; 및
상기 커널 공간에서 상기 보호 영역을 제외한 공간에 대한 제2 커널 페이지 테이블;을 포함하고,
상기 시스템제어모듈은 커널과 사용자 프로세스 중 어느 것이 동작하고 있는지에 따라 페이지 테이블의 베이스 주소를 가리키는 레지스터의 값을 상기 제1 커널 페이지 테이블의 베이스 주소 또는 상기 제2 커널 페이지 테이블의 베이스 주소로 변경하는 것을 특징으로 하는 명령어 레벨 데이터 격리 장치.
8. The method of claim 7,
A first kernel page table for kernel space; And
And a second kernel page table for the space excluding the protection area in the kernel space,
The system control module changes a value of a register indicating a base address of a page table to a base address of the first kernel page table or a base address of the second kernel page table depending on which of a kernel and a user process is operating Wherein the instruction-level data isolation device comprises:
제 7항에 있어서,
상기 시스템제어모듈은 TLB의 각 엔트리를 식별하는 서로 다른 제1 주소공간식별자(제1 ASID)와 제2 주소공간식별자(제2 ASID)를 커널과 사용자 프로세스에 각각 할당하고, 커널과 사용자 프로세스 중 어느 것이 동작하는지에 따라 제1 ASID 또는 제2 ASID로 스위칭하는 것을 특징으로 하는 명령어 레벨 데이터 격리 장치.
8. The method of claim 7,
The system control module allocates a different first address space identifier (first ASID) and a second address space identifier (second ASID), which identify each entry of the TLB, to the kernel and the user process, respectively, And switches to a first ASID or a second ASID depending on which one is operating.
제 1항 내지 제 6항 중 어느 한 항에 기재된 방법을 수행하기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체.A computer-readable recording medium storing a program for performing the method according to any one of claims 1 to 6.
KR1020170157942A 2017-11-24 2017-11-24 Instruction-level data isolation method and apparatus KR102075701B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020170157942A KR102075701B1 (en) 2017-11-24 2017-11-24 Instruction-level data isolation method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020170157942A KR102075701B1 (en) 2017-11-24 2017-11-24 Instruction-level data isolation method and apparatus

Publications (2)

Publication Number Publication Date
KR20190060109A true KR20190060109A (en) 2019-06-03
KR102075701B1 KR102075701B1 (en) 2020-02-10

Family

ID=66849157

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020170157942A KR102075701B1 (en) 2017-11-24 2017-11-24 Instruction-level data isolation method and apparatus

Country Status (1)

Country Link
KR (1) KR102075701B1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486356A (en) * 2021-06-30 2021-10-08 佛山职业技术学院 Method and device for controlling operation of interrupt source, terminal equipment and storage medium
KR20220107824A (en) * 2021-01-26 2022-08-02 한양대학교 산학협력단 Fine-grained isolation to protect data against in-process attacks

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20220057005A (en) * 2020-10-29 2022-05-09 삼성전자주식회사 Electronic device and method for protecting memory using the same

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012068741A (en) * 2010-09-21 2012-04-05 Fujitsu Ltd Memory access control program, memory access control method and information processor
KR20130051271A (en) * 2011-11-09 2013-05-20 상명대학교 천안산학협력단 System and method that provides policies for virtualizing arm based operating system
KR20130112034A (en) * 2010-09-24 2013-10-11 에이알엠 리미티드 Debugging of a data processing apparatus
KR101666032B1 (en) * 2012-05-31 2016-10-14 한국전자통신연구원 Method and apparatus for supporting virtualization of loadable module
KR20170067740A (en) 2014-09-30 2017-06-16 마이크로소프트 테크놀로지 라이센싱, 엘엘씨 Protecting application secrets from operating system attacks

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012068741A (en) * 2010-09-21 2012-04-05 Fujitsu Ltd Memory access control program, memory access control method and information processor
KR20130112034A (en) * 2010-09-24 2013-10-11 에이알엠 리미티드 Debugging of a data processing apparatus
KR20130051271A (en) * 2011-11-09 2013-05-20 상명대학교 천안산학협력단 System and method that provides policies for virtualizing arm based operating system
KR101666032B1 (en) * 2012-05-31 2016-10-14 한국전자통신연구원 Method and apparatus for supporting virtualization of loadable module
KR20170067740A (en) 2014-09-30 2017-06-16 마이크로소프트 테크놀로지 라이센싱, 엘엘씨 Protecting application secrets from operating system attacks

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20220107824A (en) * 2021-01-26 2022-08-02 한양대학교 산학협력단 Fine-grained isolation to protect data against in-process attacks
CN113486356A (en) * 2021-06-30 2021-10-08 佛山职业技术学院 Method and device for controlling operation of interrupt source, terminal equipment and storage medium
CN113486356B (en) * 2021-06-30 2024-05-07 佛山职业技术学院 Operation method, device, terminal equipment and storage medium for controlling interrupt source

Also Published As

Publication number Publication date
KR102075701B1 (en) 2020-02-10

Similar Documents

Publication Publication Date Title
US11436161B2 (en) System for address mapping and translation protection
US11768931B2 (en) Technologies for object-oriented memory management with extended segmentation
US9129106B2 (en) Systems and methods for secure in-VM monitoring
US7401358B1 (en) Method of controlling access to control registers of a microprocessor
US7043616B1 (en) Method of controlling access to model specific registers of a microprocessor
US7130977B1 (en) Controlling access to a control register of a microprocessor
US20160210069A1 (en) Systems and Methods For Overriding Memory Access Permissions In A Virtual Machine
US7082507B1 (en) Method of controlling access to an address translation data structure of a computer system
EP3881189B1 (en) An apparatus and method for controlling memory accesses
WO2021032943A1 (en) Capability write address tracking
US11003597B2 (en) Memory domains protection method and apparatus with composite protection key numbers
KR102075701B1 (en) Instruction-level data isolation method and apparatus
KR102547479B1 (en) Apparatus and method for controlling change of command set
Gutierrez et al. Cachelight: Defeating the cachekit attack
Sun et al. Kernel code integrity protection based on a virtualized memory architecture
Zhou et al. Protecting Virtual Machines against Untrusted Hypervisor on ARM64 Cloud Platform
TW202418067A (en) Stack pointer switch validity checking
JP2024517627A (en) Techniques for constraining access to memory using capabilities - Patents.com
Gutierrez CacheLight: A Lightweight Approach for Preventing Malicious Use of Cache Locking Mechanisms
CN116635855A (en) Apparatus and method for managing access of executable code to data memory based on execution context

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant