KR101155123B1 - Apparatus and method for protecting memory of application from failure of kernel code - Google Patents

Apparatus and method for protecting memory of application from failure of kernel code Download PDF

Info

Publication number
KR101155123B1
KR101155123B1 KR1020100104656A KR20100104656A KR101155123B1 KR 101155123 B1 KR101155123 B1 KR 101155123B1 KR 1020100104656 A KR1020100104656 A KR 1020100104656A KR 20100104656 A KR20100104656 A KR 20100104656A KR 101155123 B1 KR101155123 B1 KR 101155123B1
Authority
KR
South Korea
Prior art keywords
application
kernel
address space
permission
user address
Prior art date
Application number
KR1020100104656A
Other languages
Korean (ko)
Other versions
KR20120043377A (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 KR1020100104656A priority Critical patent/KR101155123B1/en
Publication of KR20120043377A publication Critical patent/KR20120043377A/en
Application granted granted Critical
Publication of KR101155123B1 publication Critical patent/KR101155123B1/en

Links

Images

Classifications

    • 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/1458Protection against unauthorised use of memory or access to memory by checking the subject access rights
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Storage Device Security (AREA)

Abstract

본 발명은 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 장치, 방법 및 그 방법을 기록한 기록매체에 관한 것으로서, 본 발명에 따른 응용 프로그램의 메모리를 보호하는 방법은 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하고, 보호 대상으로 설정된 응용 프로그램이 커널 모드에 진입할 때 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고, 보호 대상으로 설정된 응용 프로그램의 커널 모드가 해제된 때 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구한다.The present invention relates to an apparatus, a method for protecting a memory of an application program from errors of kernel code, and a recording medium for recording the method. The method of protecting a memory of an application program according to the present invention protects some of one or more application programs. Set the target, turn off write access to the application's user address space when the protected application enters kernel mode, and the application's user address when the protected application's kernel mode is turned off. Restore write access to the space.

Description

커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 장치 및 방법{Apparatus and method for protecting memory of application from failure of kernel code}Apparatus and method for protecting memory of application from failure of kernel code}

본 발명은 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 장치 및 방법에 관한 것으로, 특히 커널 코드의 오류로 인해 응용 프로그램의 사용자 주소 공간이 쓰기(write) 명령에 의해 침범당하는 것을 차단하는 장치, 방법 및 그 방법을 기록한 기록매체에 관한 것이다.The present invention relates to a device and a method for protecting the memory of an application from an error of the kernel code, in particular, a device for preventing the user address space of the application from being invaded by a write command due to the error of the kernel code, A method and a recording medium recording the method.

최근 임베디드 시스템(embedded system) 제품의 비중이 증대하는 가운데 소비자 가전 시장이 급속하게 성장하고 있다. 디지털 TV 및 냉장고와 같은 다양한 유형의 소비자 가전 기기에 임베디드 시스템이 설치되어 출시되고 있는 추세이다. 이러한 시장 환경하에서 소비자의 제품에 대한 요구는 급격하게 변화하고 있으며, 많은 제조사들은 적시에 소비자의 요구에 부응하는 제품을 출시하려 노력하고 있다. 이러한 소비자의 요구에 따라 시스템을 동작시키는 소프트웨어를 하드웨어에 내장하여 특수한 기능을 수행하는 임베디드 시스템들이 다양한 기기들에 적용되고 있다. 제조사들은 소비자들의 수요 요구에 맞춘 제품을 적시에 출시하여야만 하는 제약 하에서 시간 부족을 이유로 이러한 기기들에 대한 디바이스 드라이버(device driver)의 무결성을 시험하고 검증하는데 어려움을 겪고 있다. 동시에 소비자들은 여전히 소비자 가전 제품들에서 발견되는 소프트웨어 버그(buggy software)에 대해 불평을 토로하고 있다. 비록 일부 기업들은 소프트웨어 업데이트나 소프트웨어 버그를 해소하기 위해 제품 리콜 조치를 취하고 있으나, 그들 기업의 신뢰도 손실은 복구할 수 없는 문제이다.Recently, the consumer electronics market is growing rapidly with the increasing proportion of embedded system products. Embedded systems are being installed in various types of consumer electronics such as digital TVs and refrigerators. In this market environment, consumer demand for products is changing rapidly, and many manufacturers are trying to launch products that meet the needs of consumers in a timely manner. Embedded systems that perform special functions by embedding software that operates the system in hardware according to the demands of consumers are applied to various devices. Manufacturers are struggling to test and verify the integrity of the device driver for these devices because of the lack of time under the constraint of having timely products to meet consumer demand. At the same time, consumers are still complaining about software bugs found in consumer electronics products. Although some companies are taking product recalls to address software updates or software bugs, their loss of credibility is irreparable.

디바이스 드라이버라고 불리는 디바이스 제어 소프트웨어는 시스템 고장(system failure)의 중요한 원인들 중 하나이다. 최근 대부분의 소비자 가전 제품들은 USB 콘트롤러나 디스플레이와 같은 다양한 디바이스들을 포함하고 있고, 임베디드 시스템의 운영체제는 이러한 디바이스들을 제어하기 위한 디바이스 드라이버들을 포함한다. 많은 디바이스 드라이버들이 특권 레벨(privileged level)을 획득함으로써 커널(kernel) 레벨의 메모리 공간에 접근하여 동작하기 때문에, 만약 버그가 존재하는 드라이버가 이러한 메모리 공간에 접근할 경우 심각한 시스템 오류를 일으킬 수 있다.Device control software, called device drivers, is one of the major causes of system failure. Recently, most consumer electronic products include various devices such as USB controllers and displays, and an operating system of an embedded system includes device drivers for controlling these devices. Many device drivers operate by accessing kernel-level memory space by gaining a privileged level, which can cause serious system errors if a buggy driver accesses this memory space.

본 발명이 해결하고자 하는 기술적 과제는 응용 프로그램의 주소 공간을 보호하기 위해 특별한 하드웨어나 가상화(visualization)를 사용할 경우 과도한 비용이 소모되는 문제점을 해결하고, 다양한 플랫폼(platform)의 운영체제에 이식하기 어려운 한계를 극복하며, 디바이스 드라이버와 같은 커널 코드의 오류로 인해 시스템의 주요 기능이 정상적으로 수행되지 못하는 불편함을 해소하고자 한다.The technical problem to be solved by the present invention is to solve the problem of excessive cost when using special hardware or visualization to protect the address space of the application, and difficult to port to various platforms (OS) In order to overcome this problem, main functions of the system cannot be normally performed due to an error in kernel code such as a device driver.

상기 기술적 과제를 해결하기 위하여, 본 발명에 따른 응용 프로그램의 메모리를 보호하는 방법은 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 단계; 상기 보호 대상으로 설정된 응용 프로그램이 운영체제의 가장 높은 권한인 커널 모드(kernel mode)에 진입할 때, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하는 단계; 및 상기 보호 대상으로 설정된 응용 프로그램의 커널 모드가 해제된 때, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 단계를 포함한다.In order to solve the above technical problem, a method of protecting a memory of an application program according to the present invention comprises the steps of setting a portion of one or more application programs to be protected; Releasing write permission for the user address space of the application when the application set as the protection target enters kernel mode, which is the highest level of an operating system; And restoring write permission to the user address space of the application when the kernel mode of the application set as the protection target is released.

상기 기술적 과제를 해결하기 위하여, 본 발명에 따른 응용 프로그램의 메모리를 보호하는 방법은 상기 커널 모드의 진행 중 상기 커널 모드에서 사용하는 커널 영역의 데이터를 상기 응용 프로그램의 사용자 주소 공간으로 복사하는 함수가 호출되면, 상기 함수가 접근할 사용자 주소 공간에 대한 쓰기 권한을 부여하는 단계; 및 상기 함수의 실행이 종료될 때, 상기 함수가 접근하는 사용자 주소 공간에 대한 쓰기 권한을 해제하는 단계를 더 포함한다.In order to solve the above technical problem, a method of protecting a memory of an application according to the present invention includes a function of copying data of a kernel area used in the kernel mode to the user address space of the application during the kernel mode; When called, granting write permission to the user address space that the function is to access; And when the execution of the function ends, releasing write permission for the user address space to which the function accesses.

상기 다른 기술적 과제를 해결하기 위하여, 본 발명에 따른 응용 프로그램의 메모리를 보호하는 방법은 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 단계; 상기 보호 대상으로 설정된 응용 프로그램이 할당받은 메모리의 물리 주소가 직접-사상(direct-mapped) 영역에 포함되는지 여부를 검사하는 단계; 상기 검사 결과 상기 물리 주소가 직접-사상 영역에 포함될 경우, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하는 단계; 및 상기 직접-사상 영역이 해제된 때, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 단계를 포함한다.In order to solve the other technical problem, a method of protecting a memory of an application program according to the present invention comprises the steps of setting a portion of one or more application programs to be protected; Checking whether a physical address of a memory allocated by the application set as the protection target is included in a direct-mapped region; Releasing write permission for the user address space of the application if the physical address is included in the direct-imaging region as a result of the checking; And restoring write permission to the user address space of the application when the direct-imaging region is released.

또한, 이하에서는 상기 기재된 응용 프로그램의 메모리를 보호하는 방법들을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체를 제공한다.In addition, the following provides a computer-readable recording medium having recorded thereon a program for executing the methods for protecting the memory of the application program described above on a computer.

상기 기술적 과제를 해결하기 위하여, 본 발명에 따른 응용 프로그램의 메모리를 보호하는 장치는 상기 응용 프로그램을 실행하기 위한 메모리; 상기 응용 프로그램의 가상 주소를 물리 주소를 변환하는 페이지 테이블(page table); 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 보호 대상 설정부; 및 상기 보호 대상으로 설정된 응용 프로그램이 운영체제의 가장 높은 권한인 커널 모드에 진입할 때 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고, 상기 보호 대상으로 설정된 응용 프로그램의 커널 모드가 해제된 때 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 권한 설정부를 포함한다.In order to solve the above technical problem, an apparatus for protecting a memory of an application program according to the present invention includes a memory for executing the application program; A page table for converting a virtual address of the application to a physical address; A protected target setting unit that sets some of one or more applications as a protected target; And when the application set as the protection target enters kernel mode, which is the highest privilege of the operating system, releases write permission to the user address space of the application, and when the kernel mode of the application set as the protection target is released. And a permission setting unit for restoring write permission to the user address space of the application.

상기 기술적 과제를 해결하기 위하여, 본 발명에 따른 응용 프로그램의 메모리를 보호하는 장치에서 상기 권한 설정부는 상기 커널 모드의 진행 중 상기 커널 모드에서 사용하는 커널 영역의 데이터를 상기 응용 프로그램의 사용자 주소 공간으로 복사하는 함수가 호출되면 상기 함수가 접근할 사용자 주소 공간에 대한 쓰기 권한을 부여하고, 상기 함수의 실행이 종료될 때 상기 함수가 접근하는 사용자 주소 공간에 대한 쓰기 권한을 해제한다.In order to solve the above technical problem, in the device for protecting the memory of the application program according to the present invention, the permission setting unit to the data of the kernel area used in the kernel mode during the kernel mode in the user address space of the application program When the copying function is called, the write permission is given to the user address space to which the function is to access, and when the execution of the function is terminated, the write permission to the user address space to which the function is accessed is released.

상기 다른 기술적 과제를 해결하기 위하여, 본 발명에 따른 응용 프로그램의 메모리를 보호하는 장치는 상기 응용 프로그램을 실행하기 위한 메모리; 상기 응용 프로그램의 가상 주소를 물리 주소를 변환하는 페이지 테이블; 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 보호 대상 설정부; 상기 보호 대상으로 설정된 응용 프로그램이 할당받은 메모리의 물리 주소가 직접-사상 영역에 포함되는지 여부를 검사하는 검사부; 및 상기 검사 결과 상기 물리 주소가 직접-사상 영역에 포함될 경우 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고, 상기 직접-사상 영역이 해제된 때 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 권한 설정부를 포함한다.In order to solve the other technical problem, an apparatus for protecting a memory of an application program according to the present invention includes a memory for executing the application program; A page table for converting a virtual address of the application program into a physical address; A protected target setting unit that sets some of one or more applications as a protected target; A checker to check whether a physical address of a memory allocated by the application set as the protection target is included in the direct-imaging area; And when the physical address is included in the direct-imaging region as a result of the check, releases the write right to the user address space of the application and writes the user address space to the application address when the direct-imaging region is released. It includes a permission setting unit to recover.

본 발명은 사용자에 의해 설정된 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고 복구함으로써 디바이스 드라이버와 같은 커널 코드의 오류로부터 응용 프로그램의 사용자 주소 공간을 선택적으로 보호할 수 있고, 나아가 시스템의 주요 기능이 멈춤없이 정상적으로 수행될 수 있다. 또한, 소프트웨어를 통해 페이지 테이블의 권한을 설정함으로써 응용 프로그램의 주소 공간을 보호하기 위한 별도의 하드웨어나 가상화가 불필요하고, 그 결과 비용 절감과 타 플랫폼 이식의 용이성을 확보할 수 있다.The present invention can selectively protect the user address space of an application from errors of kernel code such as a device driver by releasing and restoring write permission to the user address space of an application set by the user, and furthermore, the main functions of the system. This can be done normally without stopping. In addition, by setting the permissions of the page table through software, no additional hardware or virtualization is required to protect the address space of the application, and as a result, cost reduction and ease of porting to other platforms can be secured.

도 1은 32-비트 x86 아키텍처에서 동작하는 운영체제의 메모리 관리 시스템을 예시한 도면이다.
도 2는 본 발명의 일 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 방법을 도시한 흐름도이다.
도 3은 도 2에 도시된 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 방법에서 커널 영역과 사용자 영역이 데이터를 주고 받는 과정을 설명하기 위한 흐름도이다.
도 4는 본 발명의 일 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 장치를 도시한 블록도이다.
도 5는 본 발명의 다른 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 방법을 도시한 흐름도이다.
도 6은 본 발명의 다른 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 장치를 도시한 블록도이다.
1 illustrates a memory management system of an operating system operating on a 32-bit x86 architecture.
2 is a flowchart illustrating a method of protecting a memory of an application program from an error of kernel code according to an embodiment of the present invention.
FIG. 3 is a flowchart illustrating a process of exchanging data between a kernel region and a user region in a method of protecting a memory of an application program from an error of the kernel code illustrated in FIG. 2.
4 is a block diagram illustrating an apparatus for protecting a memory of an application program from an error of kernel code according to an embodiment of the present invention.
5 is a flowchart illustrating a method of protecting a memory of an application program from an error of kernel code according to another exemplary embodiment of the present invention.
6 is a block diagram illustrating an apparatus for protecting a memory of an application program from an error of kernel code according to another embodiment of the present invention.

본 발명의 실시예들을 설명하기에 앞서, 오류가 존재하는 디바이스 드라이버의 불법적인 접근으로부터 메모리 공간을 보호하기 위해 기본 아이디어들이 소개하고자 한다.Prior to describing embodiments of the present invention, basic ideas are introduced to protect memory space from illegal access of a faulty device driver.

일반적으로 응용 프로그램의 오류는 다른 응용 프로그램 또는 커널에 전파되지 않는 특성이 있기 때문에, 메모리 공간 보호 기술의 대부분은 커널을 보호하는데에만 집중하고 있다. 그러나, 소비자 가전의 경우 제품의 특성상 핵심 응용 프로그램(core application)의 신뢰도를 보장하는 것이 커널의 신뢰도만큼이나 중요하다. 예를 들어, 휴대용 미디어 플레이어(portable media player, PMP)에서 미디어 재생기는 해당 기기의 가장 중요한 핵심 응용 프로그램이다. 만약 디바이스 드라이버 내에 존재하는 버그가 미디어 재생기와 관련한 메모리를 침범한다면 PMP의 주요 기능인 미디어 재생 서비스가 정상적으로 동작하지 않을 것이다. 통상적으로 소비자 가전 기기의 경우 주요 기능이 정상적으로 동작하지 않을 때 사용자의 불만이 매우 크게 나타나게 되므로, 해당 기기의 기능성을 유지하기 위해 핵심 응용 프로그램은 반드시 보호되어야만 한다.In general, most of the memory space protection techniques focus on protecting the kernel because an application error is not propagated to other applications or the kernel. However, in the case of consumer electronics, ensuring the reliability of a core application is just as important as the reliability of a kernel. For example, in a portable media player (PMP), the media player is the device's most important core application. If a bug in the device driver invades the memory associated with the media player, the media playback service, which is a major feature of PMP, will not work properly. In general, in the case of consumer electronic devices, when the main functions do not operate normally, the user's dissatisfaction is very large, so the core application must be protected to maintain the functionality of the device.

비록 응용 프로그램에 일부 오류가 존재하더라도 전체 시스템에는 큰 위해를 가하지 못하는 경우가 많았기 때문에, 종래에 대부분의 신뢰도 이슈는 커널의 컨텍스트(context)와 관련하여 발생해 왔다. 최근 커널 확장 기술의 등장과 다양한 디바이스 드라이버들이 커널 내에 포함되면서 이러한 신뢰도 이슈들은 좀 더 관심을 받게 되었다. 시스템의 신뢰도를 향상시키기 위해 잘 알려진 방법은 시스템의 구성요소들을 고립시키는 방법을 제시하기도 하였다.Even though some errors exist in the application, most of the reliability issues have been related to the context of the kernel in the past, because the entire system is often not very harmful. With the recent advent of kernel extension technology and the inclusion of various device drivers in the kernel, these reliability issues have become more interesting. Well-known methods to improve the reliability of the system have also suggested ways to isolate the components of the system.

디바이스 드라이버를 고립시키기 위해 사용되는 방법 중 하나는 가상화(virtualization)이다. 각각의 가상 머신(virtual machine, VM)은 각각의 주소 공간을 가지며, 서로 다른 가상 머신의 주소 공간을 직접적으로 접근할 수는 없다. 이러한 성질로 인해 디바이스 드라이버를 포함하는 전체 커널 구성요소들은 고립화될 수 있다. 비록 이러한 고립화 기술이 컴퓨터 하드웨어에 대한 오류 확산을 효과적으로 방지할 수는 있었으나, 가상화 기술은 구현을 위해 과도한 비용을 발생시키게 되었다. 이러한 비용 발생은 상당 부분은 고립화 기술이 다른 커널 코드의 접근으로부터 커널 객체를 보호하려는 시도에서 비롯된다. 특히, 이러한 커널 객체들이 모두 동일한 주소 공간에 존재하고 있기 때문에 모든 메모리 접근은 그 유효성이 검사되어야만 하고, 그로 인해 과다한 비용이 발생하게 된다.One method used to isolate device drivers is virtualization. Each virtual machine (VM) has its own address space and cannot directly access the address space of different virtual machines. Because of this nature, entire kernel components, including device drivers, can be isolated. Although this isolation technology has effectively prevented the spread of errors in computer hardware, virtualization technology has incurred excessive costs for implementation. Much of this cost comes from attempts by the isolation technology to protect kernel objects from access by other kernel code. In particular, since these kernel objects all reside in the same address space, all memory accesses must be validated, resulting in excessive costs.

디바이스 드라이버를 고립시키기 위해 사용되는 방법 중 또 다른 하나는 하드웨어-기반의 보호 방법이다. 이 방법은 특수한 하드웨어를 통해 유효하지 못한 접근으로부터 메모리를 보호한다. 그러나, 비록 이러한 하드웨어적인 접근 방법이 메모리를 효과적으로 보호하며 좋은 성능을 보여줄 수는 있으나, 대부분의 소비자 가전은 이러한 특별하게 고안된 하드웨어를 구비할 수 있을만한 성능이나 환경을 갖추고 있지 못하다. 따라서, 본 발명의 실시예들은 상기된 방법들과는 다른 접근 방법을 취하려 한다.Another method used to isolate device drivers is hardware-based protection. This method protects memory from invalid access through special hardware. However, although this hardware approach can effectively protect memory and show good performance, most consumer electronics do not have the performance or environment to have such specially designed hardware. Accordingly, embodiments of the present invention seek to take a different approach than the methods described above.

이하에서는 도 1을 참조하여 운영체제에서 메모리 관리 작업이 어떻게 수행되는지를 개괄적으로 설명한다. 도 1은 32-비트(bit) x86 아키텍처에서 동작하는 운영체제의 메모리 관리 시스템을 예시한 도면으로서, 메모리 관리를 설명하기 위해 편의상 x86 프로세서를 예시하였다. Hereinafter, a description will be given of how a memory management task is performed in an operating system with reference to FIG. 1. 1 is a diagram illustrating a memory management system of an operating system operating in a 32-bit x86 architecture, and illustrates an x86 processor for convenience of describing memory management.

32-비트 주소체계에서 프로세서는 4GB 크기의 가상 메모리 주소에 접근할 수 있다. 한편, 주소 공간은 두 종류로 구분될 수 있는데, 첫째는 가장 아랫 쪽의 주소 공간으로서 사용자 주소 공간(user address space)(132)이라고 불린다. 통상적으로 사용자 주소 공간(132)에는 2GB 내지 3GB의 공간이 할당되며, 모든 프로세스는 주소 공간에 대한 고유의 복사본을 가진다. 둘째는 커널에 대해 할당된 가장 윗쪽의 주소 공간(131)으로서, 이 영역에는 커널 모드(kernel mode)에서 사용되는 데이터와 코드들이 저장된다. 사용자 주소 공간(132)과는 달리 이 커널 모드를 위한 주소 공간(131)에는 하나의 커널 주소 공간만이 있으며, 특권을 가진 프로세스(privileged process)만이 직접적으로 이 공간에 접근할 수 있다. 커널은 페이지를 메모리 관리의 기본 단위로서 취급하고, 가상 주소(논리 주소를 의미한다.)는 페이지 테이블(page table)(121, 122)을 통해 물리 주소로 변환된다.In a 32-bit addressing system, the processor can access virtual memory addresses of 4 GB in size. On the other hand, the address space can be divided into two types, the first is the lowest address space is called the user address space (user address space) (132). Typically, user address space 132 is allocated 2 GB to 3 GB of space, and every process has its own copy of the address space. The second is the topmost address space 131 allocated for the kernel, where data and codes used in kernel mode are stored. Unlike the user address space 132, there is only one kernel address space in the address space 131 for this kernel mode, and only privileged processes can access this space directly. The kernel treats pages as a basic unit of memory management, and virtual addresses (meaning logical addresses) are translated into physical addresses through page tables 121 and 122.

한편, '프로세스 페이지 테이블'이라고도 불리는 '사용자 페이지 테이블(122)'은 사용자 주소를 특정 물리적 주소에 사상(map)시킨다. 중앙처리장치가 가상 주소를 통해 물리 페이지를 참조할 때, 대응하는 페이지 테이블(122)을 추적하여 해당 페이지의 접근 권한을 검사한다. 만약 접근이 유효하다면 중앙처리장치는 변환된 물리 주소를 통해 페이지를 독출한다.Meanwhile, the 'user page table 122', also called 'process page table', maps user addresses to specific physical addresses. When the CPU refers to a physical page via a virtual address, the corresponding page table 122 is tracked to check the access rights of the page. If access is valid, the CPU reads the page through the translated physical address.

커널 역시 '커널 페이지 테이블' 또는 '마스터 커널 글로벌 디렉토리(master kernel page global directory)'라고 불리는 페이지 테이블(121)을 갖는다. 대부분의 커널 주소는 커널 페이지 테이블(121)에 의해 직접적으로 물리 주소들에 사상된다. 예를 들어, 운영체제는 0xc0000000 부터 0xf7ffffff 까지의 선형적인 커널 주소들을 0x00000000 부터 0x37ffffff 까지의 물리 주소로 사상시킬 수 있다. 이렇게 단순한 방식으로 주소를 변환하는 직접 사상(direct mapping) 방법은 주소 사상의 성능을 향상시킬 수 있다. 마찬가지로 중앙처리장치는 사용자 페이지 테이블과 동일한 방법을 통해 커널 영역에 접근할 수 있다.The kernel also has a page table 121 called 'kernel page table' or 'master kernel page global directory'. Most kernel addresses are mapped to physical addresses directly by the kernel page table 121. For example, the operating system can map linear kernel addresses from 0xc0000000 to 0xf7ffffff as physical addresses from 0x00000000 to 0x37ffffff. A direct mapping method that translates addresses in this simple way can improve the performance of address mapping. Similarly, the CPU can access kernel space in the same way as user page tables.

한편, 주소 관리 시스템은 프로세스가 페이지 할당을 요구할 때 사용 가능한 물리 페이지를 할당하고, 사용자 페이지 테이블을 통해 맵(map)을 생성한다. 만약 할당된 물리 페이지의 주소가 커널 가상 주소에 직접 사상되었다면, 커널 가상 주소가 어떠한 커널 구성요소들에게 할당되지 않았음에도 불구하고 물리 페이지가 사용자 공간뿐만 아니라 커널 공간에도 같이 사상될 수 있다. 도 1에서 커널은 전체 4GB의 가상 메모리 중에서 0xc0000000 부터의 영역을 사용하는데(상위 3GB부터 4GB까지의 공간을 의미한다.), 이 영역이 물리 메모리(110) 영역 0B 내지 896MB에 그대로 사상(direct mapping)되어 있다. 즉, 물리 메모리의 1MB 영역을 접근하는 것은 가상 메모리의 3GB + 1MB 영역에 접근하는 것과 동일하다.The address management system, on the other hand, allocates available physical pages when a process requests page allocation, and generates a map through the user page table. If the address of an allocated physical page is mapped directly to a kernel virtual address, the physical page can be mapped to kernel space as well as user space even though the kernel virtual address is not assigned to any kernel component. In FIG. 1, the kernel uses an area from 0xc0000000 of the total 4GB of virtual memory (meaning a space from upper 3GB to 4GB). This area is directly mapped to the physical memory 110 areas 0B to 896MB. ) In other words, accessing a 1MB area of physical memory is the same as accessing a 3GB + 1MB area of virtual memory.

이 경우 커널이 물리 메모리의 0B 내지 896MB 영역을 독점해서 사용한다면 별다른 문제가 발생하지 않는다. 그러나, 실제로는 커널만이 해당 영역을 사용하는 것이 아니라 사용자 영역에서도 동일한 물리 메모리의 0B 내지 896MB 영역을 사용하기 때문에 문제가 발생한다. 즉, 물리 메모리의 0B 내지 896MB 영역은 커널 영역임과 동시에 사용자 영역일 수 있다. 이러한 구조(직접 사상 구조를 의미한다.)로 인해 오류가 발생한 커널이 커널 영역에 데이터를 기록할 경우, 이는 커널 영역뿐만 아니라 사용자 영역에도 데이터를 기록하는 결과가 되므로, 사용자 영역에서 동작하는 응용 프로그램에 치명적인 문제를 야기할 수 있게 된다. 다시 말해, 메모리 내에서 커널 공간과 사용자 공간은 물리 주소를 공유하기 때문에 커널 가상 주소에 접근한다는 것은 사용자 가상 주소를 침범할 수 있음을 의미한다.In this case, if the kernel exclusively uses the 0B to 896MB of physical memory, no problem occurs. In practice, however, a problem arises because the kernel does not only use the area but also uses the 0B to 896MB area of the same physical memory in the user area. That is, areas 0B to 896MB of the physical memory may be kernel areas and user areas. This structure (meaning direct mapping structure), when the failed kernel writes data to the kernel area, this results in the data being written to the user area as well as the kernel area. Can cause fatal problems. In other words, since kernel space and user space in memory share a physical address, accessing the kernel virtual address means that it can invade the user virtual address.

도 1에는 가상 주소 공간에서 커널 주소 공간(131)과 사용자 주소 공간(132)은 각각 검정색으로 표시된 자신의 영역을 가지고 있으나, 이 영역이 직접 사상된 구조를 가지고 있음을 가정하고 있다. 따라서, 커널 및 사용자 주소 공간의 가상 주소를 각각 자신의 페이지 테이블(121, 122)를 통해 물리 주소로 변환할 경우, 물리 메모리(110) 상에서 동일한 영역을 가리키고 있음을 알 수 있다. 따라서, 만약 커널 모드에서 해당 주소 공간에 오류로 인한 쓰기 명령을 수행할 경우, 사용자 응용 프로그램이 사용하고 있는 동일한 물리 공간이 침범될 수 있다. 그로 인해, 도 1의 메모리 관리 시스템에서 오동작하는 디바이스 드라이버에 의해 응용 프로그램의 메모리가 손상될 수 있다. In FIG. 1, although the kernel address space 131 and the user address space 132 each have their own regions shown in black in the virtual address space, it is assumed that the regions have a directly mapped structure. Accordingly, when the virtual addresses of the kernel and the user address space are converted into the physical addresses through their page tables 121 and 122, respectively, the same addresses may be indicated on the physical memory 110. Therefore, if a write command is generated due to an error in the corresponding address space in kernel mode, the same physical space used by the user application may be invaded. As a result, the memory of the application program may be damaged by a malfunctioning device driver in the memory management system of FIG. 1.

이하에서는 핵심 응용 프로그램 프로세스가 커널 코드에 의해 침범되는 상황(threat model)에 관해 보다 구체적으로 설명하고, 본 발명의 실시예를 통해 이러한 응용 프로그램을 보호하는 방법에 대해서 기술하도록 한다. 본 발명의 실시예들의 기본 아이디어는 메모리 관리 유닛(memory management unit, MMU)을 사용하여 응용 프로그램의 메모리에 대한 유효하지 않은 쓰기(write) 동작으로부터 핵심 응용 프로그램 소프트웨어를 보호하는 것이다. 대부분의 임베디드 프로세서는 응용 프로그램의 메모리 공간에 접근하기 위한 두 가지 메커니즘을 제공한다. 하나는 메모리 관리 유닛을 통해 접근하는 방법이고, 다른 하나는 DMA(direct memory access)를 통해 접근하는 방법이다. 디바이스 드라이버 코드 내에 저장된 명령은 응용 프로그램 주소 공간의 일부를 침범할 수 있는데, DMA 기반의 접근 방법은 반드시 커널 내의 DMA 서브시스템을 통해 수행되므로 본 발명의 실시예들이 가정하고 있는 디바이스 드라이버에 의한 위협 상황과는 맞지 않는다. 따라서, 이하에서는 DMA 접근 방법을 배제하고 메모리 관리 유닛에 집중하여 설명한다.Hereinafter, a description will be given in more detail of the situation (threat model) in which the core application process is invaded by the kernel code, and the method of protecting such an application through an embodiment of the present invention. The basic idea of embodiments of the present invention is to use a memory management unit (MMU) to protect the core application software from invalid write operations to the application's memory. Most embedded processors provide two mechanisms for accessing the application's memory space. One is through a memory management unit and the other is through direct memory access (DMA). Instructions stored in the device driver code may violate a portion of the application address space. A DMA-based approach is necessarily performed through the DMA subsystem in the kernel, thus threatening the situation by device drivers assumed by embodiments of the present invention. Does not fit. Therefore, the following description focuses on the memory management unit excluding the DMA approach.

핵심 응용 프로그램 프로세스가 커널 코드에 의해 침범되는 첫 번째 상황은 사용자 주소 공간에 대한 쓰기의 경우이다. 커널 모드(kernel mode)에서 프로세스는 어떠한 메모리 공간에도 접근할 수 있는 특권을 가지며, 디바이스 드라이버는 사용자 응용 프로그램으로부터의 시스템 호출(system call) 또는 하드웨어 인터럽트(hardware interrupt)에 의해 구동된다. 구동의 초기화 과정에서 만약 주소 산출에 오류가 있다면 디바이스 드라이버 코드는 잘못된 위치에 접근할 것이며, 해당 위치는 사용자 응용 프로그램에 속하는 물리 페이지 내의 위치일 수 있다. 그러면, 응용 프로그램은 그 본래의 기능을 수행함에 있어서 불안전한 상태에 놓여지게 된다. 이러한 불안전한 상태를 해소하기 위해 본 발명의 실시예들은 다양한 사용자 가전 기기들에서 활용될 수 있도록 낮은 기술 비용을 갖는 다음의 기술적 수단을 제공한다.The first situation where a core application process is invaded by kernel code is the case of writing to the user address space. In kernel mode, a process has the privilege of accessing any memory space, and the device driver is driven by a system call or hardware interrupt from a user application. If there is an error in the address calculation during the initialization of the drive, the device driver code will access the wrong location, which may be a location in the physical page belonging to the user application. The application is then in an insecure state in performing its original function. In order to alleviate this unsafe condition, embodiments of the present invention provide the following technical means having a low technical cost to be utilized in various user appliances.

대부분의 메모리 보호 기술은 커널 코딩을 요구하고 있기 때문에 복잡한 메커니즘으로 인해 다양한 임베디드 플랫폼에 적용하기에는 많은 비용이 소모된다. 비록 다른 커널의 불법적인 접근으로부터 커널 객체를 보호가는 것이 복잡한 메커니즘을 요구하지만, 사용자 응용 프로그램의 주소 공간은 상대적으로 보호하기에 용이하다. 왜냐하면 사용자 응용 프로그램의 주소 공간은 커널 공간으로 이격되어 있기 때문이다. 따라서, 본 발명의 실시예들은 메모리 관리 시스템에 주목하였다.Since most memory protection technologies require kernel coding, complex mechanisms can be expensive to apply to a variety of embedded platforms. Although protecting kernel objects from illegal access by other kernels requires a complex mechanism, the address space of a user application is relatively easy to protect. This is because the address space of the user application is separated from the kernel space. Accordingly, embodiments of the present invention have focused on a memory management system.

본 발명의 실시예는 페이지 테이블 항목(page table entries)에 대한 쓰기-보호(write-protection)를 설정함으로써 매우 적은 오버헤드(overhead)만으로도 커널의 잘못된 접근을 탐지할 수 있다. 또한, 보호되어야 할 응용 프로그램들은 사용자의 보호 요구, 보호 범위 및 효율의 수준에 따라 차별적으로 선택될 수 있다. 특히, 본 발명의 실시예는 많은 임베디드 시스템에서 채택되어 있는 통상적인 운영체제를 수정함으로써 용이하게 구현될 수 있다. 대부분의 운영체제들이 유사한 메모리 관리 시스템을 갖고 있기 때문에 다른 임베디드 시스템들 역시 별다른 어려움 없이 본 발명의 실시예를 적용하는 것이 가능하다.Embodiments of the present invention can set up write-protection for page table entries so that false access of the kernel can be detected with very little overhead. In addition, the applications to be protected may be differentially selected according to the user's protection needs, the scope of protection and the level of efficiency. In particular, embodiments of the present invention can be readily implemented by modifying common operating systems employed in many embedded systems. Since most operating systems have similar memory management systems, it is possible for other embedded systems to apply embodiments of the present invention without any difficulty.

우선 소개할 본 발명의 실시예는 "사용자 주소 공간 보호" 방법이라고 명명하자. 사용자 주소 공간 보호 방법은 커널의 쓰기 동작으로부터 응용 프로그램 공간을 보호한다. 커널 코드로부터의 쓰기는 오직 커널 코드가 시스템 호출이나 인터럽트에 의해 구동될 때만 발생한다. 프로세스가 커널 모드로 진입하면, 본 실시예의 메모리 관리 시스템은 각각의 페이지 테이블 항목의 허가 비트(permission bits)를 변경함으로써 모든 사용자 주소 공간에 대한 커널의 쓰기 권한을 해제한다. 만약 위험한 커널 코드가 사용자 주소 공간에 쓰기 동작을 수행하려 할지라도 페이지 테이블은 아무런 허가 비트를 포함하지 않으므로 이러한 커널 코드의 쓰기 시도는 실패할 것이다. 그 후, 커널이 작업을 완료하고 중단된 사용자 프로세스가 재개될 때 비로소 쓰기 허가가 다시 '금지'에서 '허가'로 복구될 것이다.First of all, an embodiment of the present invention to be introduced is called a "user address space protection" method. The user address space protection method protects the application space from kernel write operations. Writing from kernel code occurs only when the kernel code is driven by a system call or an interrupt. When the process enters kernel mode, the memory management system of this embodiment releases the kernel's write permission to all user address spaces by changing the permission bits of each page table entry. If dangerous kernel code attempts to write to the user address space, the page table will not contain any permission bits, so writing attempts to these kernel code will fail. After that, when the kernel completes its work and the suspended user process resumes, the write permission will be restored from 'prohibit' to 'permit' again.

커널은 응용 프로그램과 통신하기 위해 사용자 주소 공간으로부터 데이터를 독출하거나 사용자 주소 공간에 데이터를 기록하려 한다. 예를 들어 시스템 호출 읽기(read system call)는 파일, 네트워크 또는 파이프(pipe)로부터 사용자 주소 공간으로 독출되어야 하는 커널 메모리 컨텐츠를 복사한다. 유사하게 시스템 호출 쓰기(write system call)는 사용자 주소 공간에 거장된 데이터를 커널 주소 공간에 복사한다. The kernel tries to read data from or write data to the user address space to communicate with the application. For example, a read system call copies kernel memory content that must be read from a file, network, or pipe into the user address space. Similarly, a write system call copies data resident in the user address space into the kernel address space.

따라서, 상기 설명된 본 발명의 실시예에 따르면 읽기 권한은 변경되지 않았으므로 사용자 주소 공간으로부터의 읽기 동작은 통상적으로 수행될 수 있다. 그러나, 비록 쓰기 동작이 올바른 커널 동작에 대해 허용된 것일지라도 상기된 실시예에 따르면 사용자 주소 공간에 대한 쓰기 동작은 거부될 것이다. 따라서, 만약 쓰기 동작이 유효한 경우에는 대상 주소에 대한 금지된 쓰기 권한이 회복될 필요가 있다. 즉, 금지된 쓰기 권한을 다시 부여하여 유효한 쓰기 동작을 정상적으로 수행할 필요가 있다. 나아가 이러한 유효한 쓰기 동작이 종료되면 대상 주소는 다시 재보호되는 것이 바람직하다.Thus, according to the embodiment of the present invention described above, since the read permission has not been changed, a read operation from the user address space may be normally performed. However, even if the write operation is permitted for correct kernel operation, the write operation to the user address space will be rejected according to the embodiment described above. Therefore, if the write operation is valid, the forbidden write permission on the target address needs to be restored. In other words, it is necessary to grant the write permission again to perform a valid write operation normally. Further, when this valid write operation is terminated, the target address is preferably reprotected.

사용자 주소 공간 보호 방법에 따른 보호 기능은 커널 코드가 구동되기 전에 설정되어야 한다. 따라서, 시스템 호출이 발생한 경우 보호 기능은 시스템 호출 처리기(system call handler)보다 먼저 호출된다. 만약 현재의 프로세스가 보호되려면, 보호 기능은 쓰기 권한을 해제하기 위해 모든 페이지 테이블 항목을 추적하여야 한다. 마지막으로 시스템 호출이 종료되면 쓰기 권한은 다시 복구된다. Protection based on the user address space protection method must be set before the kernel code runs. Thus, when a system call occurs, the protection function is called before the system call handler. If the current process is to be protected, the protection must keep track of all page table entries to release write access. Finally, when the system call ends, the write permission is restored.

커널 코드가 동작 중일 때, 앞서 설명한 바와 같이 유효한 쓰기 동작은 허용되어야만 한다. 따라서, 어떠한 페이지들이 쓰기 허용되는지 여부를 알 필요가 있다. 통상적으로 널리 알려진 유닉스(unix)나 리눅스(linux) 기반의 시스템에서는 사용자 영역과 커널 영역 사이에서 데이터를 교환해야 하는 경우가 있다. 대표적인 예는 시스템 호출(system call)에 의해 변수/인자를 넘기는 경우로서, 커널 영역에서는 사용자 메모리를 바로 접근할 수 없으므로 사용자 영역의 데이터를 커널 영역으로 복사해야 한다. 이러한 작업을 위해 'get_user()', 'put_user()', 'copy_from_user()', 'copy_to_user()' 등의 함수들이 사용된다. 이 중, 'get_user()' 및 'copy_from_user()' 함수는 사용자 영역에서 커널 영역으로 복사를 하고, 'put_user()' 및 'copy_to_user()' 함수는 커널 영역에서 사용자 영역으로 복사를 하기 위해 사용된다. 따라서, 본 실시예에서는 'put_user()' 및 'copy_to_user()' 와 같은 함수를 통해 커널 영역의 변수를 사용자 영역(응용 프로그램의 변수 영역을 의미한다.)으로 복사하려 할 것이다.When the kernel code is running, valid write operations must be allowed as described above. Therefore, it is necessary to know which pages are writeable. Commonly known Unix or Linux based systems require the exchange of data between user and kernel space. A typical example is a case of passing a variable / argument by a system call. Since the user memory is not directly accessible in the kernel area, the data in the user area should be copied to the kernel area. Functions such as 'get_user ()', 'put_user ()', 'copy_from_user ()', and 'copy_to_user ()' are used for this task. Among these, 'get_user ()' and 'copy_from_user ()' functions are used to copy from user space to kernel space, and 'put_user ()' and 'copy_to_user ()' functions are used to copy from kernel space to user space. do. Therefore, in the present embodiment, a variable such as 'put_user ()' and 'copy_to_user ()' will attempt to copy a variable in the kernel area to a user area (meaning a variable area of an application program).

그러나, 본 발명의 실시예들은 보호 기능에 의해 쓰기 권한이 해제된 상태이다. 따라서, 상기된 특정 함수들이 실행될 때에는 이들 함수들이 올바르게 동작하도록 보장하기 위해 기록되어야 할 주소들을 사상시킨 페이지들에 대한 사용 권한을 허용하는 것이 바람직하다. 즉, 해제된 사용 권한을 허용하여 작업을 완료한 다음, 해당 함수들이 종료된 때 다시 해당 페이지들을 재보호한다.However, embodiments of the present invention have a write permission released by the protection function. Thus, it is desirable to allow usage rights for pages that map addresses to be written to ensure that these functions operate correctly when the specific functions described above are executed. In other words, after completing the operation by granting the released permission, the pages are reprotected when the functions are terminated.

도 2는 본 발명의 일 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 방법을 도시한 흐름도로서, 이상에서 소개하고 있는 사용자 주소 공간 보호 방법을 설명하고 있다.FIG. 2 is a flowchart illustrating a method of protecting a memory of an application program from an error of kernel code according to an embodiment of the present invention, and illustrates the user address space protection method introduced above.

210 단계에서 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정한다. 이 때, 보호 대상으로 설정되는 어플리케이션은 상기 하나 이상의 응용 프로그램 중 응용 프로그램의 기능, 사용자의 보호 요구, 보호 범위 및 보호 효율의 수준 중 적어도 하나를 고려함으로써 차별적으로 선택될 수 있다.In step 210, some of the one or more applications are set as protection targets. In this case, the application set as the protection target may be differentially selected by considering at least one of a function of an application program, a user's protection request, a protection range, and a protection efficiency level among the one or more applications.

220 단계에서는 210 단계를 통해 보호 대상으로 설정된 응용 프로그램이 시스템 호출이나 인터럽트 등에 의해 운영체제의 가장 높은 권한인 커널 모드(kernel mode)에 진입할 때, 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제한다. 구체적으로 쓰기 권한을 해제하는 단계는 상기 응용 프로그램의 페이지 테이블을 순회하며(traverse), 페이지 테이블 항목(page table entries)의 쓰기 권한에 대한 허가 비트(permission bits)를 변경함으로써 모든 사용자 주소 공간에 대한 커널의 쓰기 동작을 금지한다.In step 220, when the application set as the protection target in step 210 enters kernel mode, which is the highest privilege of the operating system, by a system call or interrupt, the write permission of the application's user address space is released. . Specifically, the step of releasing write permission traverses the page table of the application and changes the permission bits for write permission of page table entries for all user address spaces. Disable the write operation of the kernel.

이제 쓰기 권한이 해제된 채 230 단계에서 커널 모드의 작업을 수행하고, 작업이 완료되면 240 단계로 진입한다. The kernel mode operation is performed in step 230 with write permission released, and the operation enters step 240 when the operation is completed.

240 단계에서는 210 단계를 통해 보호 대상으로 설정된 응용 프로그램의 커널 모드가 해제된 때, 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구한다. 마찬가지로 응용 프로그램의 페이지 테이블 항목의 허가 비트를 재변경함으로써 모든 사용자 주소 공간에 대한 커널의 쓰기 동작을 허용한다.In step 240, when the kernel mode of the application set as the protection target is released in step 210, the write permission on the user address space of the application is restored. Similarly, changing the permission bit of the application's page table entry allows the kernel to write to all user address spaces.

도 3은 도 2에 도시된 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 방법에서 커널 영역과 사용자 영역이 데이터를 주고 받는 과정을 설명하기 위한 흐름도로서, 여기에서는 함수 호출에 의한 권한 처리에 집중하여 설명하도록 하겠다.FIG. 3 is a flowchart illustrating a process of exchanging data between a kernel region and a user region in a method of protecting a memory of an application program from an error of the kernel code illustrated in FIG. 2, and focusing on authorization processing by a function call. I will explain.

도 3의 235 단계에서는 커널 모드의 진행 중 특정 함수가 호출되었는지 여부를 검사한다. 여기서 특정 함수란 커널 모드에서 사용하는 커널 영역의 데이터를 응용 프로그램의 사용자 주소 공간으로 복사하는 함수를 의미하는 것으로, put_user()' 및 'copy_to_user()' 와 같은 함수가 될 수 있다.In step 235 of FIG. 3, it is checked whether a specific function is called while the kernel mode is in progress. Here, the specific function refers to a function that copies the data of the kernel area used in the kernel mode to the user address space of the application, and may be a function such as put_user () 'and' copy_to_user () '.

검사 결과, 특정 함수가 호출되었다면 310 단계로 진입한다. 310 단계에서는 특정 함수가 접근할 사용자 주소 공간에 대한 쓰기 권한을 부여한 후, 320 단계를 통해 해당 함수를 실행한다. 이어서, 330 단계에서 해당 함수의 실행이 종료될 때, 그 함수가 접근하는 사용자 주소 공간에 대한 쓰기 권한을 해제하게 된다.As a result of the check, if a specific function is called, step 310 is entered. In step 310, write permission is given to the user address space to which a specific function is to be accessed, and then, in step 320, the function is executed. Subsequently, when execution of the function is terminated in step 330, the write permission for the user address space accessed by the function is released.

도 4는 본 발명의 일 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 장치(400)를 도시한 블록도로서, 도 3의 실시예에 대응되므로 구체적인 설명은 생략한다.FIG. 4 is a block diagram illustrating an apparatus 400 for protecting a memory of an application program from an error of a kernel code according to an embodiment of the present invention, which corresponds to the embodiment of FIG.

메모리(410)는 응용 프로그램(450)을 실행하기 위한 것으로 응용 프로그램의 필요 페이지를 적재한다. 페이지 테이블(page table)(420)은 응용 프로그램(450)의 가상 주소를 물리 주소를 변환한다. 이러한 구성은 메모리 관리 시스템이 기본적으로 구비하여야 하는 구성으로서, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 자명한 구성이다.The memory 410 loads necessary pages of the application program to execute the application program 450. The page table 420 converts the virtual address of the application 450 into a physical address. Such a configuration is basically a configuration that a memory management system should be provided, and is obvious to those skilled in the art.

보호 대상 설정부(430)는 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정한다. 앞서 설명한 바와 같이 본 발명의 실시예가 구현되는 환경에서 가장 중요한 기능을 수행하는 핵심 응용 프로그램이 보호 대상이 되는 것이 바람직하나, 구현 환경에 따라 다양한 응용 프로그램을 보소 대상으로 설정하는 것이 가능하다.The protection target setting unit 430 sets some of one or more application programs as protection targets. As described above, it is preferable that a core application program that performs the most important function in an environment in which an embodiment of the present invention is implemented is a target of protection, but it is possible to set various application programs as targets of protection according to the implementation environment.

권한 설정부(440)는 보호 대상 설정부(430)에 의해 보호 대상으로 설정된 응용 프로그램이 운영체제의 가장 높은 권한인 커널 모드에 진입할 때 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고, 다시 커널 모드가 해제된 때 쓰기 권한을 복구한다. 또한, 권한 설정부(440)는 커널 모드의 진행 중 특정 함수가 호출되면 해당 함수가 접근할 사용자 주소 공간에 대한 쓰기 권한을 부여하고, 이러한 함수의 실행이 종료될 때 해당 함수가 접근하는 사용자 주소 공간에 대한 쓰기 권한을 해제한다.The permission setting unit 440 releases write permission on the user address space of the application when the application set as the protection target by the protection target setting unit 430 enters the kernel mode, which is the highest permission of the operating system. Restore write permission when kernel mode is released again. In addition, the permission setting unit 440 grants write permission to the user address space that the function will access when a specific function is called during kernel mode, and the user address accessed by the function when execution of such a function is terminated. Turn off write access to the space.

이러한 보호 대상 설정부(430) 및 권한 설정부(440)는 일련의 연산을 처리할 수 있는 처리기(processor) 및 이러한 연산에 따른 데이터를 기록하는데 필요한 기억공간(memory)을 통해 구현될 수 있다. 이러한 처리기 및 기억공간은 본 발명이 속하는 기술분야의 활용 환경이나 동작 환경을 고려하여 통상의 지식을 가진 기술자에 의해 적절하게 선택될 수 있을 것이다. 나아가, 이러한 처리 과정에는 이상에서 예시된 하드웨어들을 제어하기 위한 부가적인 소프트웨어 코드(code)도 활용될 수 있을 것이다.The protection target setting unit 430 and the authority setting unit 440 may be implemented through a processor capable of processing a series of operations and a memory required to record data according to these operations. Such a processor and a storage space may be appropriately selected by those skilled in the art in consideration of the utilization environment or operating environment of the technical field to which the present invention belongs. Furthermore, this process may also utilize additional software code for controlling the hardware illustrated above.

상기된 본 발명의 실시예들에 따르면 사용자에 의해 설정된 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고 복구함으로써 디바이스 드라이버와 같은 커널 코드의 오류로부터 응용 프로그램의 사용자 주소 공간을 선택적으로 보호할 수 있고, 나아가 시스템의 주요 기능이 멈춤없이 정상적으로 수행될 수 있다. 또한, 소프트웨어를 통해 페이지 테이블의 권한을 설정함으로써 응용 프로그램의 주소 공간을 보호하기 위한 별도의 하드웨어나 가상화가 불필요하고, 그 결과 비용 절감과 타 플랫폼 이식의 용이성을 확보할 수 있다.According to the embodiments of the present invention described above, the user address space of the application can be selectively protected from an error of kernel code such as a device driver by releasing and restoring write permission to the user address space of the application set by the user. In addition, the main functions of the system can be performed normally without stopping. In addition, by setting the permissions of the page table through software, no additional hardware or virtualization is required to protect the address space of the application, and as a result, cost reduction and ease of porting to other platforms can be secured.

이제 핵심 응용 프로그램 프로세스가 커널 코드에 의해 침범되는 두 번째 상황(직접 매핑을 통한 쓰기의 경우)을 살펴보자. 앞서 도 1을 통해 설명한 바와 같이 물리 페이지들이 커널 및 응용 프로그램 모두에 사상되어 있는 경우, 커널의 직접 사상 역시 디바이스 드라이버들로부터 인증되지 않은 접근을 야기할 수 있다. 버그가 존재하는 디바이스 드라이버는 커널뿐만 아니라 응용 프로그램에도 사상된 페이지에 대한 잘못된 접근을 허용할 수 있다. 따라서, 만약 커널 주소가 이중으로 사상된 물리 주소라면(주소가 커널 공간 및 사용자 공간에 같이 사상된 경우를 의미한다.), 커널 주소에 대한 쓰기 동작은 사용자 주소에 영향을 줄 수 있다.Let's look at the second situation (in the case of writing through direct mapping) where the core application process is intruded by kernel code. As described above with reference to FIG. 1, when physical pages are mapped to both the kernel and the application program, direct mapping of the kernel may also cause unauthorized access from device drivers. Buggy device drivers can allow incorrect access to mapped pages in the application as well as the kernel. Thus, if the kernel address is a dual mapped physical address (meaning that the address is mapped in kernel space and user space together), writing to the kernel address can affect the user address.

이러한 직접 사상을 통한 쓰기는 시스템 내의 모든 프로세스들에 영향을 끼칠 수 있으므로 특히 위험하다. 앞서 설명한 첫 번째 경우에 커널은 오직 현재의 컨텍스트를 갖는 프로세스만을 접근할 수 있었던 반면, 직접 사상된 메모리는 임의의 프로세스의 사용자 주소 공간에 대해 사상될 수 있으므로 커널 코드는 현재의 시스템 상태와 아무런 관련이 없는 프로세스에 악영향을 줄 수 있다. This direct mapping is particularly dangerous because it can affect all processes in the system. In the first case described above, the kernel could only access the process with the current context, while the directly mapped memory could be mapped to the user address space of any process, so that the kernel code has nothing to do with the current system state. This can adversely affect a process that is missing.

이하에서 소개할 본 발명의 두 번째 실시예는 "직접-사상 보호" 방법이라고 명명하자. 직접-사상 보호 방법은 직접 사상을 통해 커널 쓰기 요청이 발생한 경우 커널 쓰기로부터 사용자 공간을 보호한다. 이러한 직접-사상 보호 방법은 메모리 관리 시스템의 페이지 할당 모듈(page allocator)이 직접 사상돤 영역으로부터 사용자 주소에 물리 주소를 사상시킬 때 구동된다. 직접-사상 보호 방법은 이러한 주소 사상이 완료될 때 해당 페이지에 대한 쓰기 권한을 해제한다. 따라서, 만약 커널 내의 프로세스가 보호된 커널 가상 주소에 쓰기 동작을 수행하려 한다면 예외(exception) 오류가 발생할 것이며, 쓰기 시도가 저지될 것이다. 이러한 사용자 가상 주소에 대한 사상이 해제되면, 쓰기 권한은 다시 복원된다. A second embodiment of the invention, which will be introduced below, is termed a "direct-ideal protection" method. Direct-imaging protection protects user space from kernel writes when a kernel write request occurs through direct mapping. This direct-imaging protection method is driven when the page allocator of the memory management system maps the physical address from the direct mapping area to the user address. Direct-imaging protection releases write access to the page when this address mapping is complete. Thus, if a process in the kernel attempts to write to a protected kernel virtual address, an exception error will occur and the write attempt will be blocked. When the mapping for this user virtual address is released, the write permission is restored again.

통상적인 운영체제에 대해 직접-사상 보호를 구현하기 위해서는 페이지 할당 및 해제(free)에 관한 함수에 단지 몇 줄의 코드만을 추가하면 된다. 응용 프로그램이 페이지 할당을 요구할 때 커널은 물리 페이지를 할당하는데, 만약 물리 페이지가 직접 사상된 메모리 영역 내에 위치해 있다면 직접-사상 보호 방법은 물리 주소에 사상된 커널 가상 주소를 발견하게 된다. 그러면, 본 실시예는 이러한 주소가 포함된 페이지 테이블 항목으로부터 쓰기 권한을 빼앗는다. 이어서, 할당된 페이지가 해제되면 비로소 커널 페이지 테이블 항목의 쓰기 권한이 회복되게 된다.To implement direct-ideal protection for a typical operating system, you only need to add a few lines of code to the functions for page allocation and free. When an application requests page allocation, the kernel allocates a physical page. If the physical page is located in a directly mapped memory region, the direct-imaging protection method finds a kernel virtual address mapped to a physical address. The present embodiment then deprives the write permission of the page table entry containing this address. Subsequently, when the allocated page is released, the write permission of the kernel page table entry is restored.

도 5는 본 발명의 다른 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 방법을 도시한 흐름도로서 이상에서 소개한 직접-사상 보호 방법을 설명하고 있다. 본 실시예에서 응용 프로그램은 메모리 할당 요청을 하게 되고, 메모리 관리 유닛은 이러한 요청에 따라 할당할 메모리 페이지를 결정한다.FIG. 5 is a flowchart illustrating a method of protecting a memory of an application program from an error of kernel code according to another embodiment of the present invention, and illustrates the direct-imaginary protection method introduced above. In this embodiment, the application program makes a memory allocation request, and the memory management unit determines a memory page to allocate according to the request.

510 단계에서 하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정한다. 이 과정은 도 2의 210 단계와 유사하므로 구체적인 설명은 생략한다.In operation 510, some of the one or more applications are set as protection targets. Since this process is similar to step 210 of FIG. 2, a detailed description thereof will be omitted.

520 단계에서는 510 단계를 통해 보호 대상으로 설정된 응용 프로그램이 할당받은 메모리의 물리 주소가 직접-사상(direct-mapped) 영역에 포함되는지 여부를 검사하고, 검사 결과 상기 물리 주소가 직접-사상 영역에 포함될 경우 530 단계로 진행한다.In step 520, the application set as the target of protection in step 510 determines whether the physical address of the allocated memory is included in the direct-mapped area. If the case proceeds to step 530.

530 단계에서는 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제한다. 구체적으로 쓰기 권한을 해제하는 단계는 응용 프로그램의 페이지 테이블 항목(커널 직접 사상 맵을 의미한다.)의 허가 비트를 변경함으로써 사용자 주소 공간에 대한 커널의 쓰기 동작을 금지한다.In operation 530, the write permission of the user address space of the application is released. Specifically, the step of releasing the write permission prohibits the kernel writing operation to the user address space by changing the permission bit of the page table item (meaning the kernel direct mapping map) of the application.

이제 540 단계로 진행하여 메모리를 할당하고 작업을 수행한다. 작업이 완료되었으면 메모리를 반환한다.The flow now proceeds to step 540 to allocate memory and perform tasks. When the operation is complete, the memory is returned.

550 단계에서는 직접-사상 영역이 해제된 때, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구한다. 마찬가지로 쓰기 권한을 복구하는 단계는 응용 프로그램의 페이지 테이블 항목의 허가 비트를 재변경함으로써 사용자 주소 공간에 대한 커널의 쓰기 동작을 허용한다.In step 550, when the direct-imaging region is released, write permission to the user address space of the application is restored. Similarly, restoring write permission allows the kernel's write operation to the user address space by changing the permission bits of the application's page table entries.

만약 520 단계의 검사 결과 응용 프로그램이 할당받은 메모리의 물리 주소가 직접-사상 영역에 포함되지 않았다면 곧바로 560 단계로 진행하여 작업을 수행한다.If it is determined in step 520 that the physical address of the memory allocated by the application program is not included in the direct-imaging region, the process proceeds directly to step 560 to perform a task.

도 6은 본 발명의 다른 실시예에 따른 커널 코드의 오류로부터 응용 프로그램의 메모리를 보호하는 장치(600)를 도시한 블록도로서, 도 5의 실시예에 대응되므로 구체적인 설명은 생략한다.FIG. 6 is a block diagram illustrating an apparatus 600 for protecting a memory of an application program from an error of a kernel code according to another embodiment of the present invention, and thus a detailed description thereof will be omitted.

메모리(610), 페이지 테이블(620) 및 보호 대상 설정부(630)은 각각 도 4의 메모리(410), 페이지 테이블(420) 및 보호 대상 설정부(430)와 유사한 구성에 해당한다.The memory 610, the page table 620, and the protection target setting unit 630 correspond to similar configurations to the memory 410, the page table 420, and the protection target setting unit 430 of FIG. 4, respectively.

검사부(660)는 보호 대상 설정부(630)에 의해 보호 대상으로 설정된 응용 프로그램이 할당받은 메모리의 물리 주소가 직접-사상 영역에 포함되는지 여부를 검사한다. 도 6에서 검사부(660)는 권한 설정부(640) 내에 도시하였으나 이는 구현의 일례로서 제시된 것이므로 본 발명이 속하는 기술에서 통상의 지식을 가진 자에 의해 다양한 구조로 변형되어 구현될 수 있음은 당연하다.The checker 660 checks whether the physical address of the memory allocated by the application set as the protection target by the protection target setting unit 630 is included in the direct-imaging region. In FIG. 6, the inspection unit 660 is illustrated in the authority setting unit 640. However, since the inspection unit 660 is provided as an example of the implementation, it is obvious that the inspection unit 660 may be modified and implemented in various structures by those skilled in the art. .

권한 설정부(640)는 검사부(660)의 검사 결과 물리 주소가 직접-사상 영역에 포함될 경우 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고, 직접-사상 영역이 해제된 때 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구한다. 구체적으로, 권한 설정부(640)는 응용 프로그램의 페이지 테이블 항목의 허가 비트를 변경함으로써 사용자 주소 공간에 대한 커널의 쓰기 동작을 금지하거나 허용한다.The permission setting unit 640 releases the write permission of the application address space of the application when the physical address is included in the direct-imaging region and the user of the application when the direct-imaging region is released. Restore write access to the address space. Specifically, the permission setting unit 640 prohibits or allows the kernel's write operation to the user address space by changing the permission bit of the page table item of the application.

이러한 검사부(660), 보호 대상 설정부(630) 및 권한 설정부(640)는 일련의 연산을 처리할 수 있는 처리기 및 이러한 연산에 따른 데이터를 기록하는데 필요한 기억공간을 통해 구현될 수 있다. 이러한 처리기 및 기억공간은 본 발명이 속하는 기술분야의 활용 환경이나 동작 환경을 고려하여 통상의 지식을 가진 기술자에 의해 적절하게 선택될 수 있을 것이며, 이상에서 예시된 하드웨어들을 제어하기 위한 부가적인 소프트웨어 코드도 활용될 수 있을 것이다.The inspection unit 660, the protection target setting unit 630, and the authority setting unit 640 may be implemented through a processor capable of processing a series of operations and a storage space necessary for recording data according to these operations. Such a processor and a storage space may be appropriately selected by those skilled in the art in consideration of the utilization environment or operating environment of the technical field to which the present invention belongs, and additional software code for controlling the hardware illustrated above. May also be utilized.

상기된 본 발명의 실시예들에 따르면 디바이스 드라이버와 같은 커널 코드의 오류로부터 응용 프로그램의 사용자 주소 공간을 선택적으로 보호할 수 있고, 나아가 시스템의 주요 기능이 멈춤없이 정상적으로 수행될 수 있으며, 응용 프로그램의 주소 공간을 보호하기 위한 별도의 하드웨어나 가상화가 불필요하므로 비용 절감과 타 플랫폼 이식의 용이성을 확보할 수 있다.According to the embodiments of the present invention described above it is possible to selectively protect the user address space of the application from the error of kernel code, such as a device driver, furthermore, the main function of the system can be performed normally without stop, No extra hardware or virtualization is required to protect the address space, which reduces cost and eases porting to other platforms.

한편, 본 발명은 컴퓨터로 읽을 수 있는 기록 매체에 컴퓨터가 읽을 수 있는 코드로 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 기록 매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록 장치를 포함한다.Meanwhile, the present invention can be embodied as computer readable codes on a computer readable recording medium. The computer-readable recording medium includes all kinds of recording devices in which data that can be read by a computer system is stored.

컴퓨터가 읽을 수 있는 기록 매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광 데이터 저장장치 등이 있으며, 또한 캐리어 웨이브(예를 들어 인터넷을 통한 전송)의 형태로 구현하는 것을 포함한다. 또한, 컴퓨터가 읽을 수 있는 기록 매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어, 분산 방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다. 그리고 본 발명을 구현하기 위한 기능적인(functional) 프로그램, 코드 및 코드 세그먼트들은 본 발명이 속하는 기술 분야의 프로그래머들에 의하여 용이하게 추론될 수 있다.Examples of computer-readable recording media include ROM, RAM, CD-ROM, magnetic tape, floppy disks, optical data storage devices, and the like, which may also be implemented in the form of carrier waves (for example, transmission over the Internet). Include. The computer readable recording medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion. In addition, functional programs, codes, and code segments for implementing the present invention can be easily deduced by programmers skilled in the art to which the present invention belongs.

이상에서 본 발명에 대하여 그 다양한 실시예들을 중심으로 살펴보았다. 본 발명에 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명이 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 변형된 형태로 구현될 수 있음을 이해할 수 있을 것이다. 그러므로 개시된 실시예들은 한정적인 관점이 아니라 설명적인 관점에서 고려되어야 한다. 본 발명의 범위는 전술한 설명이 아니라 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.The present invention has been described above with reference to various embodiments thereof. 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 shown in the claims rather than the foregoing description, and all differences within the scope will be construed as being included in the present invention.

110 : 물리 메모리
121 : 커널 페이지 테이블 122 : 사용자 페이지 테이블
131 : 커널 주소 공간 132 : 사용자 주소 공간
400, 600 : 컴퓨터 시스템
410, 610 : 메모리 420, 620 : 페이지 테이블
430, 630 : 보호 대상 설정부 440, 640 : 권한 설정부
450, 650 : 응용 프로그램
660 : 검사부
110: physical memory
121: Kernel Page Table 122: User Page Table
131: kernel address space 132: user address space
400, 600: computer system
410, 610: memory 420, 620: page table
430, 630: protection target setting unit 440, 640: authority setting unit
450, 650: application
660: inspection unit

Claims (15)

응용 프로그램의 메모리를 보호하는 방법에 있어서,
하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 단계;
상기 보호 대상으로 설정된 응용 프로그램이 운영체제의 가장 높은 권한인 커널 모드(kernel mode)에 진입할 때, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하는 단계; 및
상기 보호 대상으로 설정된 응용 프로그램의 커널 모드가 해제된 때, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 단계를 포함하는 방법.
In the method of protecting the memory of the application,
Setting some of the one or more applications to be protected;
Releasing write permission for the user address space of the application when the application set as the protection target enters kernel mode, which is the highest level of an operating system; And
Restoring write permission to the user address space of the application when the kernel mode of the application set to be protected is released.
제 1 항에 있어서,
상기 커널 모드의 진행 중 소정 함수가 호출되면, 상기 소정 함수가 접근할 사용자 주소 공간에 대한 쓰기 권한을 부여하는 단계; 및
상기 소정 함수의 실행이 종료될 때, 상기 소정 함수가 접근하는 사용자 주소 공간에 대한 쓰기 권한을 해제하는 단계를 더 포함하는 방법.
The method of claim 1,
Granting write permission to a user address space to which the predetermined function is to access if a predetermined function is called during the kernel mode; And
When the execution of the predetermined function ends, releasing write permission for the user address space to which the predetermined function accesses.
제 2 항에 있어서,
상기 소정 함수는 상기 커널 모드에서 사용하는 커널 영역의 데이터를 상기 응용 프로그램의 사용자 주소 공간으로 복사하는 함수인 것을 특징으로 하는 방법.
The method of claim 2,
Wherein the predetermined function is a function for copying data of a kernel area used in the kernel mode to a user address space of the application program.
제 1 항에 있어서,
상기 쓰기 권한을 해제하는 단계는 상기 응용 프로그램의 페이지 테이블 항목(page table entries)의 허가 비트(permission bits)를 변경함으로써 모든 사용자 주소 공간에 대한 커널의 쓰기 동작을 금지하고,
상기 쓰기 권한을 복구하는 단계는 상기 응용 프로그램의 페이지 테이블 항목의 허가 비트를 변경함으로써 모든 사용자 주소 공간에 대한 커널의 쓰기 동작을 허용하는 것을 특징으로 하는 방법.
The method of claim 1,
The step of releasing the write permission prohibits the kernel from writing to all user address spaces by changing the permission bits of the page table entries of the application.
And restoring the write permission to allow the kernel to write to all user address spaces by changing the permission bits of the page table entry of the application.
제 1 항에 있어서,
상기 보호 대상으로 설정되는 어플리케이션은 상기 하나 이상의 응용 프로그램 중 응용 프로그램의 기능, 사용자의 보호 요구, 보호 범위 및 보호 효율의 수준 중 적어도 하나를 고려함으로써 차별적으로 선택된 것을 특징으로 하는 방법.
The method of claim 1,
The application set as the protection target may be differentially selected by considering at least one of a function of an application, a protection request of a user, a protection range, and a level of protection efficiency among the one or more applications.
응용 프로그램의 메모리를 보호하는 방법에 있어서,
하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 단계;
상기 보호 대상으로 설정된 응용 프로그램이 할당받은 메모리의 물리 주소가 직접-사상(direct-mapped) 영역에 포함되는지 여부를 검사하는 단계;
상기 검사 결과 상기 물리 주소가 직접-사상 영역에 포함될 경우, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하는 단계; 및
상기 직접-사상 영역이 해제된 때, 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 단계를 포함하는 방법.
In the method of protecting the memory of the application,
Setting some of the one or more applications to be protected;
Checking whether a physical address of a memory allocated by the application set as the protection target is included in a direct-mapped region;
Releasing write permission for the user address space of the application if the physical address is included in the direct-imaging region as a result of the checking; And
Restoring write permission to the user address space of the application when the direct-imaging region is released.
제 6 항에 있어서,
상기 쓰기 권한을 해제하는 단계는 상기 응용 프로그램의 페이지 테이블 항목의 허가 비트를 변경함으로써 사용자 주소 공간에 대한 커널의 쓰기 동작을 금지하고,
상기 쓰기 권한을 복구하는 단계는 상기 응용 프로그램의 페이지 테이블 항목의 허가 비트를 변경함으로써 사용자 주소 공간에 대한 커널의 쓰기 동작을 허용하는 것을 특징으로 하는 방법.
The method according to claim 6,
The step of releasing the write permission prohibits the kernel from writing to the user address space by changing the permission bit of the page table entry of the application,
And restoring the write permission to allow the kernel's write operation to the user address space by changing the permission bits of the page table entry of the application.
제 6 항에 있어서,
상기 보호 대상으로 설정되는 어플리케이션은 상기 하나 이상의 응용 프로그램 중 응용 프로그램의 기능, 사용자의 보호 요구, 보호 범위 및 보호 효율의 수준 중 적어도 하나를 고려함으로써 차별적으로 선택된 것을 특징으로 하는 방법.
The method according to claim 6,
The application set as the protection target may be differentially selected by considering at least one of a function of an application, a protection request of a user, a protection range, and a level of protection efficiency among the one or more applications.
제 1 항 내지 제 8 항 중에 어느 한 항의 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체.A non-transitory computer-readable recording medium having recorded thereon a program for executing the method of claim 1. 응용 프로그램의 메모리를 보호하는 장치에 있어서,
상기 응용 프로그램을 실행하기 위한 메모리;
상기 응용 프로그램의 가상 주소를 물리 주소를 변환하는 페이지 테이블(page table);
하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 보호 대상 설정부; 및
상기 보호 대상으로 설정된 응용 프로그램이 운영체제의 가장 높은 권한인 커널 모드에 진입할 때 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고, 상기 보호 대상으로 설정된 응용 프로그램의 커널 모드가 해제된 때 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 권한 설정부를 포함하는 장치.
In a device for protecting the memory of the application,
A memory for executing the application program;
A page table for converting a virtual address of the application to a physical address;
A protected target setting unit that sets some of one or more applications as a protected target; And
When the application set as the protection target enters kernel mode, which is the highest level of the operating system, releases write permission to the user address space of the application, and when the kernel mode of the application set as the protection target is released. A device that includes a permission setter that restores write access to the user address space of the application.
제 10 항에 있어서,
상기 권한 설정부는 상기 커널 모드의 진행 중 소정 함수가 호출되면 상기 소정 함수가 접근할 사용자 주소 공간에 대한 쓰기 권한을 부여하고, 상기 소정 함수의 실행이 종료될 때 상기 소정 함수가 접근하는 사용자 주소 공간에 대한 쓰기 권한을 해제하는 것을 특징으로 하는 장치.
11. The method of claim 10,
The permission setting unit grants write permission to a user address space to which the predetermined function accesses when a predetermined function is called during the kernel mode, and accesses the user address space to which the predetermined function accesses when execution of the predetermined function ends. And disabling write permission for the device.
제 11 항에 있어서,
상기 소정 함수는 상기 커널 모드에서 사용하는 커널 영역의 데이터를 상기 응용 프로그램의 사용자 주소 공간으로 복사하는 함수인 것을 특징으로 하는 장치.
The method of claim 11,
And the predetermined function is a function for copying data of a kernel area used in the kernel mode to a user address space of the application program.
제 10 항에 있어서,
상기 권한 설정부는 상기 응용 프로그램의 페이지 테이블 항목의 허가 비트를 변경함으로써 모든 사용자 주소 공간에 대한 커널의 쓰기 동작을 금지하거나 허용하는 것을 특징으로 하는 장치.
11. The method of claim 10,
And the permission setting unit prohibits or allows the kernel to write to all user address spaces by changing the permission bits of the page table entry of the application.
응용 프로그램의 메모리를 보호하는 장치에 있어서,
상기 응용 프로그램을 실행하기 위한 메모리;
상기 응용 프로그램의 가상 주소를 물리 주소를 변환하는 페이지 테이블;
하나 이상의 응용 프로그램 중 일부를 보호 대상으로 설정하는 보호 대상 설정부;
상기 보호 대상으로 설정된 응용 프로그램이 할당받은 메모리의 물리 주소가 직접-사상 영역에 포함되는지 여부를 검사하는 검사부; 및
상기 검사 결과 상기 물리 주소가 직접-사상 영역에 포함될 경우 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 해제하고, 상기 직접-사상 영역이 해제된 때 상기 응용 프로그램의 사용자 주소 공간에 대한 쓰기 권한을 복구하는 권한 설정부를 포함하는 장치.
In a device for protecting the memory of the application,
A memory for executing the application program;
A page table for converting a virtual address of the application program into a physical address;
A protected target setting unit that sets some of one or more applications as a protected target;
A checker to check whether a physical address of a memory allocated by the application set as the protection target is included in the direct-imaging area; And
If the physical address is included in the direct-imaging region as a result of the checking, the write permission of the user address space of the application is released and the write permission of the application address space of the application is released when the direct-imaging region is released. Device including a permission setting to recover.
제 14 항에 있어서,
상기 권한 설정부는 상기 응용 프로그램의 페이지 테이블 항목의 허가 비트를 변경함으로써 사용자 주소 공간에 대한 커널의 쓰기 동작을 금지하거나 허용하는 것을 특징으로 하는 장치.
15. The method of claim 14,
And the permission setting unit prohibits or permits a kernel write operation to a user address space by changing a permission bit of a page table entry of the application program.
KR1020100104656A 2010-10-26 2010-10-26 Apparatus and method for protecting memory of application from failure of kernel code KR101155123B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020100104656A KR101155123B1 (en) 2010-10-26 2010-10-26 Apparatus and method for protecting memory of application from failure of kernel code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020100104656A KR101155123B1 (en) 2010-10-26 2010-10-26 Apparatus and method for protecting memory of application from failure of kernel code

Publications (2)

Publication Number Publication Date
KR20120043377A KR20120043377A (en) 2012-05-04
KR101155123B1 true KR101155123B1 (en) 2012-06-11

Family

ID=46263574

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020100104656A KR101155123B1 (en) 2010-10-26 2010-10-26 Apparatus and method for protecting memory of application from failure of kernel code

Country Status (1)

Country Link
KR (1) KR101155123B1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101460451B1 (en) * 2013-09-06 2014-11-12 포항공과대학교 산학협력단 Apparatus and method for controlling process address space
KR102202633B1 (en) * 2019-12-09 2021-01-13 국방과학연구소 Error handling Processor and Error handling Method using the same

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101375658B1 (en) * 2012-08-20 2014-03-18 주식회사 안랩 Program data change protecting apparatus and program data change protecting method
KR101592916B1 (en) * 2014-04-03 2016-02-18 오픈스택 주식회사 Method of transferring data to multiple destinations in network with minimizing context switching and data copying between user space and kernel space
US9628279B2 (en) * 2014-09-30 2017-04-18 Microsoft Technology Licensing, Llc Protecting application secrets from operating system attacks
KR102494167B1 (en) * 2015-11-25 2023-02-01 삼성전자주식회사 A Electronic Device And Method For Protecting The Kernel Space of the Memory
KR102201669B1 (en) * 2019-06-05 2021-01-12 성균관대학교산학협력단 Idempotent kernel generateing method and apparatus
KR102267500B1 (en) * 2019-06-05 2021-06-22 성균관대학교산학협력단 Idempotent kernel generateing method and apparatus
KR102254159B1 (en) * 2020-12-09 2021-05-18 연세대학교 산학협력단 Method for detecting real-time error in operating system kernel memory

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060059759A (en) * 2004-11-29 2006-06-02 주식회사 안철수연구소 Method for preventing from inventing data of memory in a computer application program
KR100645983B1 (en) 2005-08-31 2006-11-14 (주)와이즈로직 Module for detecting an illegal process and method thereof
KR20080089002A (en) * 2007-03-30 2008-10-06 삼성전자주식회사 Method of controlling memory access
KR20080104591A (en) * 2007-05-28 2008-12-03 삼성전자주식회사 Memory protection method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060059759A (en) * 2004-11-29 2006-06-02 주식회사 안철수연구소 Method for preventing from inventing data of memory in a computer application program
KR100645983B1 (en) 2005-08-31 2006-11-14 (주)와이즈로직 Module for detecting an illegal process and method thereof
KR20080089002A (en) * 2007-03-30 2008-10-06 삼성전자주식회사 Method of controlling memory access
KR20080104591A (en) * 2007-05-28 2008-12-03 삼성전자주식회사 Memory protection method and apparatus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101460451B1 (en) * 2013-09-06 2014-11-12 포항공과대학교 산학협력단 Apparatus and method for controlling process address space
KR102202633B1 (en) * 2019-12-09 2021-01-13 국방과학연구소 Error handling Processor and Error handling Method using the same

Also Published As

Publication number Publication date
KR20120043377A (en) 2012-05-04

Similar Documents

Publication Publication Date Title
KR101155123B1 (en) Apparatus and method for protecting memory of application from failure of kernel code
US7380049B2 (en) Memory protection within a virtual partition
KR101253394B1 (en) Managing use of storage by multiple pageable guests of a computing environment
US10198578B2 (en) Secure privilege level execution and access protection
US8909898B2 (en) Copy equivalent protection using secure page flipping for software components within an execution environment
EP1966706B1 (en) Identifier associated with memory locations for managing memory accesses
US20180232319A1 (en) Protection key management and prefixing in virtual address space legacy emulation system
US20080040565A1 (en) Method and apparatus for supporting immutable memory
JP2009516310A (en) Page coloring that maps memory pages to programs
Chubachi et al. Hypervisor-based prevention of persistent rootkits
JP2023526811A (en) Tag check device and method
KR20230101826A (en) Techniques for restricting access to memory using capabilities
JP7369720B2 (en) Apparatus and method for triggering actions
KR20240109286A (en) 2 stage address conversion
TW202340955A (en) Technique for constraining access to memory using capabilities
CN118339542A (en) Two-stage address translation
JP2024504987A (en) key capabilities storage
Price Virtual Breakpoints for x86/64
TW202318210A (en) Technique for handling sealed capabilities
TW202343257A (en) Memory management
CN117222990A (en) Techniques for access to memory using capability constraints
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
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20150526

Year of fee payment: 4

FPAY Annual fee payment

Payment date: 20160526

Year of fee payment: 5

FPAY Annual fee payment

Payment date: 20180525

Year of fee payment: 7

FPAY Annual fee payment

Payment date: 20190603

Year of fee payment: 8