KR102545765B1 - Method and system for detecting memory errors - Google Patents

Method and system for detecting memory errors Download PDF

Info

Publication number
KR102545765B1
KR102545765B1 KR1020180060689A KR20180060689A KR102545765B1 KR 102545765 B1 KR102545765 B1 KR 102545765B1 KR 1020180060689 A KR1020180060689 A KR 1020180060689A KR 20180060689 A KR20180060689 A KR 20180060689A KR 102545765 B1 KR102545765 B1 KR 102545765B1
Authority
KR
South Korea
Prior art keywords
memory
information
application
computer system
crash
Prior art date
Application number
KR1020180060689A
Other languages
Korean (ko)
Other versions
KR20190135337A (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 KR1020180060689A priority Critical patent/KR102545765B1/en
Priority to PCT/KR2019/006330 priority patent/WO2019231194A1/en
Publication of KR20190135337A publication Critical patent/KR20190135337A/en
Application granted granted Critical
Publication of KR102545765B1 publication Critical patent/KR102545765B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/073Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance

Abstract

컴퓨터 시스템에서 실행되는 애플리케이션 프로그램에 의해 발생되는 메모리 오류를 검출하는 방법 및 시스템을 제공한다. 본 개시의 일 실시예는 애플리케이션의 실행 전에 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하고, 추출된 글로벌 변수 및 로컬 변수를 인포메이션 태그 저장부에 저장하고, 저장된 글로벌 변수 및 로컬 변수의 정보에 기초하여 정적 메모리 오류를 검출하고, 애플리케이션의 실행 중에 수집된 동적 메모리 오류를 검출하는 방법 및 컴퓨터 시스템을 제공한다. A method and system for detecting memory errors caused by application programs running on a computer system are provided. An embodiment of the present disclosure extracts global variables and local variables of an application before execution of the application, stores the extracted global variables and local variables in an information tag storage unit, and static static variables are stored based on information of the stored global variables and local variables. Methods and computer systems for detecting memory errors and detecting dynamic memory errors collected during execution of an application are provided.

Description

메모리 오류를 검출하는 방법 및 시스템 {METHOD AND SYSTEM FOR DETECTING MEMORY ERRORS} Method and system for detecting memory errors {METHOD AND SYSTEM FOR DETECTING MEMORY ERRORS}

본 개시는 컴퓨터 시스템에서 실행되는 애플리케이션 프로그램에 의해 발생되는 메모리 오류를 검출하는 방법 및 시스템에 관한 것이다. 구체적으로, 본 개시는 애플리케이션 프로그램의 잘못된 메모리 참조로 인하여 발생되는 메모리의 크래쉬(crash) 오류를 바이너리(binary) 기반으로 검출하고, 메모리 오류의 원인을 분석하는 방법 및 시스템에 관한 것이다. The present disclosure relates to a method and system for detecting memory errors caused by application programs running on a computer system. Specifically, the present disclosure relates to a method and system for detecting a memory crash error caused by an incorrect memory reference of an application program on a binary basis and analyzing the cause of the memory error.

컴퓨터 시스템은 애플리케이션 프로그램의 실행 정보를 바이너리(binary)에 정해진 규격에 의해 기록하고, 해당 바이너리를 메모리 상에 탑재한 후 메모리를 참조(읽기/쓰기)함으로써 애플리케이션 프로그램을 실행한다. 컴퓨터 시스템 상에서 실행되는 애플리케이션 프로그램은 시스템에서 제공하는 일련의 메모리 명령(instruction)을 수행하여 임의의 메모리 영역을 참조할 수 있고, 의도하지 않는 메모리 참조로 인하여 시스템의 오류(error)를 유발할 수 있다. The computer system executes the application program by recording execution information of the application program in a binary according to a predetermined standard, loading the corresponding binary into a memory, and then referring to (reading/writing) the memory. An application program running on a computer system may refer to an arbitrary memory area by performing a series of memory instructions provided by the system, and may cause a system error due to unintended memory reference.

애플리케이션 프로그램이 컴퓨터 시스템 상에서 실행되기 위해 사용되는 메모리 영역은, 애플리케이션 프로그램이 실행되더라도 애플리케이션 프로그램 내부에 고정되어 있는 정적(static) 메모리 영역 및 애플리케이션 프로그램이 실행되는 동안 필요에 따라 생성/소멸 되는 동적(dynamic) 메모리 영역으로 구분된다. The memory area used to run the application program on the computer system includes a static memory area that is fixed inside the application program even when the application program is running, and a dynamic memory area that is created/destroyed as needed while the application program is running. ) is divided into memory areas.

종래의 메모리 분석 기술은 애플리케이션 프로그램에 메모리 오류를 검출하기 위한 도구를 컴파일 시점에 사전에 탑재하는 방식(Compile Time Instrumentation 및 Static Binary Instrumentation)과 애플리케이션 프로그램 수행 직전에 미리 검출 도구를 탑재하는 방식(Dynamic Binary Instrumentation) 및 애플리케이션 프로그램 실행 중의 임의의 시점에 검출 도구를 탑재하는 방식(Dynamic Binary Injection)이 존재한다. Conventional memory analysis techniques include a method of loading an application program with tools for detecting memory errors in advance at the time of compilation (Compile Time Instrumentation and Static Binary Instrumentation) and a method of loading a tool for detecting errors in advance just before application program execution (Dynamic Binary Instrumentation). Instrumentation) and a method (Dynamic Binary Injection) of loading a detection tool at an arbitrary point in time during execution of an application program.

종래의 프로그램 실행 중에 도구를 탑재하여 메모리 오류를 검출하는 기술들은 애플리케이션 프로그램의 실행 시점 이후에 메모리 검출 도구가 탑재되기 때문에 메모리 검출 도구의 탑재 이후 시점에서 접근, 할당, 및 해제되는 동적 메모리 오류는 분석 가능하지만, 애플리케이션의 실행 이전에 할당이 완료된 글로벌 변수(Global variable) 및 스택 영역(Stack)에 할당되는 로컬 변수(Local variable)에 대해서는 정보를 획득할 수 없어 메모리의 글로벌 영역 및 스택 영역에서 발생되는 메모리 오류는 검출해낼 수 없는 문제점이 있다. In the conventional techniques for detecting memory errors by loading tools during program execution, since the memory detection tools are loaded after the application program is executed, dynamic memory errors that are accessed, allocated, and freed after the memory detection tools are loaded are analyzed. It is possible, but it is not possible to obtain information about global variables that have been allocated before application execution and local variables that are allocated to the stack. Memory errors are problems that cannot be detected.

또한, 메모리 오류가 발생한다 하더라도 애플리케이션 프로그램이 의도하지 않은 방향으로 계속적으로 실행될 수 있으며, 이후 더 이상 애플리케이션 프로그램이 실행될 수 없는 상황이 되었을 때 시스템 크래쉬(crash)가 발생되어 종료되지만, 해당 종료 시점에서 메모리 오류의 원인에 관한 정보를 알 수 없어 프로그램 오류를 수정하는데 어려움이 있다.In addition, even if a memory error occurs, the application program may continue to run in an unintended direction, and when the application program can no longer be executed, a system crash occurs and is terminated, but at the point of termination It is difficult to correct the program error because information about the cause of the memory error is unknown.

본 개시는 애플리케이션 프로그램의 실행 전에 글로벌 변수 및 로컬 변수를 추출하고, 추출된 글로벌 변수 및 로컬 변수를 활용하여 메모리 오류를 검출함으로써, 동적 메모리의 결함을 검출할 뿐만 아니라 글로벌 영역 및 스택 영역에서의 메모리 오류도 함께 검출할 수 있는 방법 및 시스템을 제공하는 것을 목적으로 한다. The present disclosure detects defects in dynamic memory by extracting global variables and local variables before execution of an application program and detecting memory errors using the extracted global variables and local variables, as well as memory errors in global and stack areas. An object of the present invention is to provide a method and system capable of detecting errors together.

또한, 본 개시는 커널(kernel)의 시그널 핸들러(signal handler)를 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체함으로써 애플리케이션 프로그램의 크래쉬가 발생한 시점의 메모리 정보 및 크래쉬 발생 이전까지의 메모리 결함 정보를 수집하여 메모리 오류의 원인 분석을 용이하게 하는 방법 및 시스템을 제공하는 것을 목적으로 한다. In addition, the present disclosure collects memory information at the time when an application program crashes and memory defect information before a crash occurs by replacing a signal handler of a kernel with a signal handler that monitors memory defect information. It is an object to provide a method and system that facilitates analysis of the causes of memory errors.

상술한 기술적 과제를 해결하기 위하여, 본 개시의 일 실시예는 애플리케이션의 실행 이전에 상기 애플리케이션의 글로벌 변수(Global variable) 및 로컬 변수(local variable) 정보를 추출하는 단계; 추출된 상기 글로벌 변수 및 상기 로컬 변수 정보를 인포메이션 태그 저장부(information tag repository)에 저장하는 단계; 및 상기 인포메이션 태그 저장부에 저장된 상기 글로벌 변수 및 상기 로컬 변수 정보와 상기 애플리케이션이 실행 중에 수집된 동적 메모리(dynamic memory) 정보에 기초하여 메모리 오류를 검출하는 단계를 포함하는, 컴퓨터 시스템에서 발생되는 메모리 오류를 검출하는 방법을 제공한다. In order to solve the above-described technical problem, an embodiment of the present disclosure extracts global variable and local variable information of the application before execution of the application; storing the extracted global variable and local variable information in an information tag repository; and detecting a memory error based on the global variable and the local variable information stored in the information tag storage unit and dynamic memory information collected while the application is running. Provides a way to detect errors.

예를 들어, 상기 글로벌 변수 및 로컬 변수 정보를 추출하는 단계는, 사용자 입력에 따라 상기 애플리케이션이 실행되기 전에 상기 애플리케이션의 정적 메모리 정보를 추출하는 바이너리 분석기를 실행하도록 설정하고, 상기 바이너리 분석기를 통해 상기 애플리케이션의 글로벌 변수 및 로컬 변수를 추출할 수 있다.For example, in the step of extracting global variable and local variable information, a binary analyzer for extracting static memory information of the application is set to be executed before the application is executed according to a user input, and the binary analyzer is configured to perform the binary analyzer. Global and local variables of the application can be extracted.

예를 들어, 상기 글로벌 변수 및 로컬 변수 정보를 추출하는 단계는 추출된 상기 글로벌 변수 및 상기 로컬 변수 각각의 주소(address), 크기, 호출함수 중 적어도 하나를 분석하는 단계를 포함할 수 있다. For example, the extracting of global variable and local variable information may include analyzing at least one of an address, a size, and a call function of each of the extracted global and local variables.

예를 들어, 상기 메모리 오류를 검출하는 단계는 DBI(Dynamic Binary Injection) 기법을 통해 상기 실행 중인 애플리케이션에 의해 메모리의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 상기 동적 메모리 정보를 모니터링하는 단계를 포함할 수 있다. For example, the detecting of the memory error includes monitoring the dynamic memory information that is dynamically allocated, accessed, and released from a heap area of memory by the running application through a dynamic binary injection (DBI) technique. can do.

예를 들어, 상기 메모리 오류를 검출하는 단계는 메모리의 글로벌 영역, 스택 영역(Stack) 및 Heap 영역 중 적어도 하나의 영역에서의 메모리 결함을 검출할 수 있다. For example, the detecting of the memory error may detect a memory defect in at least one of a global area, a stack area, and a heap area of the memory.

예를 들어, 상기 방법은 애플리케이션에 크래쉬(crash)가 발생되어 상기 애플리케이션이 종료되는 신호에 따라, 커널(kernel)의 시그널 핸들러(signal handler)를 상기 크래쉬가 발생한 시점의 메모리 정보 및 상기 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체하는 단계를 더 포함할 수 있다. For example, in the method, according to a signal that a crash occurs in an application and the application is terminated, a signal handler of a kernel receives memory information at the time when the crash occurs and the occurrence of the crash. A step of replacing previous memory defect information with a signal handler that monitors may be further included.

예를 들어, 상기 방법은 교체된 시그널 핸들러를 호출하는 단계; 및 호출된 시그널 핸들러를 이용하여 상기 크래쉬와 관련된 애플리케이션의 콜 스택(Call Stack) 정보를 수집하는 단계를 더 포함할 수 있다. For example, the method may include calling a replaced signal handler; and collecting call stack information of an application related to the crash using the called signal handler.

예를 들어, 상기 메모리 오류를 검출하는 단계는 메모리의 글로벌 영역, 스택 영역, Heap 영역에서의 메모리 결함 정보 및 상기 수집된 콜 스택 정보에 기초하여 상기 메모리 오류의 원인을 분석할 수 있다. For example, in the detecting of the memory error, the cause of the memory error may be analyzed based on memory defect information in a global area, a stack area, and a heap area of memory and the collected call stack information.

예를 들어, 상기 방법은 메모리 오류의 분석 결과를 출력하는 단계를 더 포함할 수 있다. For example, the method may further include outputting a memory error analysis result.

상술한 기술적 과제를 해결하기 위하여, 본 개시의 일 실시예는 메모리; 및 상기 컴퓨터 시스템에 의해 수행되는 애플리케이션이 상기 메모리를 참조함에 따라 발생되는 메모리 오류를 검출하는 프로세서를 포함하고, 상기 프로세서는 상기 애플리케이션의 실행 이전에 상기 애플리케이션의 글로벌 변수(Global variable) 및 로컬 변수(local variable) 정보를 추출하는 바이너리 분석 모듈; 추출된 상기 글로벌 변수 및 상기 로컬 변수 정보에 기초하여 상기 메모리의 결함을 탐지하는 결함 탐지 모듈; 및 상기 탐지된 메모리 결함에 기초하여 상기 메모리 오류를 검출하고, 검출된 오류를 분석하는 결함 분석 모듈을 포함하는, 메모리 오류를 검출하는 컴퓨터 시스템을 제공한다. In order to solve the above technical problem, an embodiment of the present disclosure is a memory; And a processor for detecting a memory error generated as an application executed by the computer system refers to the memory, wherein the processor determines global variables and local variables of the application before execution of the application ( A binary analysis module that extracts local variable) information; a defect detection module configured to detect a defect of the memory based on the extracted global variable and local variable information; and a defect analysis module configured to detect the memory error based on the detected memory defect and to analyze the detected error.

예를 들어, 상기 바이너리 분석 모듈은 사용자 입력에 따라 상기 애플리케이션이 실행되기 전에 상기 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는 바이너리 분석기가 실행되도록 설정하고, 상기 바이너리 분석기를 통해 상기 애플리케이션의 글로벌 변수 및 로컬 변수를 추출할 수 있다. For example, the binary analysis module sets a binary analyzer for extracting global variables and local variables of the application to be executed before the application is executed according to a user input, and sets the global variables and local variables of the application to be executed through the binary analyzer. variables can be extracted.

예를 들어, 상기 컴퓨터 시스템은 추출된 정적 메모리 정보를 저장하는 저장부를 더 포함하고, 상기 결함 탐지 모듈은 상기 저장부에 저장된 상기 글로벌 변수 및 상기 로컬 변수 정보에 기초하여 상기 메모리의 결함을 탐지할 수 있다. For example, the computer system may further include a storage unit for storing extracted static memory information, and the defect detection module may detect a defect in the memory based on the global variable and local variable information stored in the storage unit. can

예를 들어, 상기 결함 탐지 모듈은 추출된 상기 글로벌 변수 및 상기 로컬 변수 각각의 주소(address), 크기, 호출함수 중 적어도 하나를 분석하고, 분석 결과에 기초하여 상기 메모리 결함에 관한 정보를 획득할 수 있다. For example, the defect detection module analyzes at least one of an address, a size, and a call function of each of the extracted global variable and the local variable, and obtains information about the memory defect based on the analysis result. can

예를 들어, 상기 결함 탐지 모듈은 DBI(Dynamic Binary Injection) 기법을 사용하여 상기 애플리케이션이 실행 중에 상기 메모리의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 동적 메모리 정보를 모니터링할 수 있다. For example, the defect detection module may monitor dynamic memory information that is dynamically allocated, accessed, and released from a heap area of the memory while the application is running using a dynamic binary injection (DBI) technique.

예를 들어, 상기 결함 탐지 모듈은 상기 메모리의 글로벌 영역, 스택 영역(Stack) 및 상기 Heap 영역 중 적어도 하나의 영역에서의 메모리 결함을 검출할 수 있다. For example, the defect detection module may detect a memory defect in at least one of a global area, a stack area, and the heap area of the memory.

예를 들어, 상기 프로세서는 상기 애플리케이션이 실행 중에 발생되는 크래쉬(crash)를 분석하여 상기 크래쉬 관련 데이터를 수집하는 크래쉬 모니터링 모듈을 더 포함할 수 있다. For example, the processor may further include a crash monitoring module that collects data related to the crash by analyzing a crash occurring while the application is running.

예를 들어, 상기 크래쉬 모니터링 모듈은 상기 애플리케이션에 크래쉬가 발생되어 상기 애플리케이션이 종료되는 신호에 따라, 커널(kernel)의 시그널 핸들러(signal handler)를 상기 크래쉬가 발생한 시점의 메모리 정보 및 상기 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체할 수 있다. For example, the crash monitoring module transmits a signal handler of a kernel according to a signal that a crash occurs in the application and the application is terminated, memory information at the time when the crash occurs and occurrence of the crash It can be replaced with a signal handler that monitors previous memory defect information.

예를 들어, 상기 크래쉬 모니터링 모듈은 상기 교체된 시그널 핸들러를 호출하고, 상기 호출된 시그널 핸들러를 이용하여 상기 크래쉬와 관련된 애플리케이션의 콜 스택(Call Stack) 정보를 수집할 수 있다. For example, the crash monitoring module may call the replaced signal handler and collect call stack information of an application related to the crash using the called signal handler.

예를 들어, 상기 결함 분석 모듈은 상기 결함 탐지 모듈에서 탐지한 상기 메모리의 글로벌 영역, 스택 영역, Heap 영역에서의 메모리 결함 정보 및 상기 크래쉬 모니터링 모듈에서 수집한 상기 콜 스택 정보에 기초하여 상기 메모리 오류의 원인을 분석할 수 있다. For example, the defect analysis module may perform the memory error based on memory defect information in the global area, stack area, and heap area of the memory detected by the defect detection module and the call stack information collected by the crash monitoring module. causes can be analyzed.

상술한 기술적 과제를 해결하기 위하여, 본 개시의 일 실시예는 컴퓨터로 읽을 수 있는 저장 매체를 포함하는 컴퓨터 프로그램 제품을 제공하고, 상기 저장 매체는 애플리케이션의 실행 이전에 상기 애플리케이션의 글로벌 변수(Global variable) 및 로컬 변수(local variable) 정보를 추출하는 단계; 추출된 상기 글로벌 변수 및 상기 로컬 변수 정보를 인포메이션 태그 저장부(information tag repository)에 저장하는 단계; 및 상기 인포메이션 태그 저장부에 저장된 상기 글로벌 변수 및 상기 로컬 변수 정보와 상기 애플리케이션이 실행 중에 수집된 동적 메모리(dynamic memory) 정보에 기초하여 메모리 오류를 검출하는 단계를 수행하는 명령어들(instructions)을 포함할 수 있다. In order to solve the above technical problem, an embodiment of the present disclosure provides a computer program product including a computer-readable storage medium, wherein the storage medium is a global variable (global variable) of the application before execution of the application. ) and extracting local variable information; storing the extracted global variable and local variable information in an information tag repository; and instructions for performing a step of detecting a memory error based on the global variable and the local variable information stored in the information tag storage unit and dynamic memory information collected while the application is running. can do.

본 개시의 일 실시예에 따른 방법 및 시스템은, 애플리케이션 프로그램이 컴퓨터 시스템의 메모리 상에 동적으로 할당, 접근 및 해제 시에 발생되는 메모리 오류 뿐만 아니라, 메모리의 글로벌 영역 및 스택 영역으로 인한 메모리 오류에 대해서도 검출이 가능하므로, 메모리 오류 검출의 정확성을 향상시킬 수 있다. 또한, 본 개시의 일 실시예에 따른 방법 및 시스템은 애플리케이션 프로그램의 크래쉬가 발생하는 경우 크래수의 발생 시점의 메모리 정보 및 크래쉬 발생 이전까지의 메모리 결함 정보를 모니터링한 결과를 출력함으로써 사용자가 메모리 오류의 원인을 정확하게 파악할 수 있도록 할 수 있다. A method and system according to an embodiment of the present disclosure is directed to memory errors caused by global and stack areas of memory as well as memory errors that occur when an application program dynamically allocates, accesses, and frees a memory of a computer system. Since it is also possible to detect errors, the accuracy of memory error detection can be improved. In addition, the method and system according to an embodiment of the present disclosure, when an application program crashes, outputs a result of monitoring memory information at the time of the crash and memory defect information until before the crash, so that the user can receive a memory error. can accurately determine the cause of

본 개시는, 다음의 자세한 설명과 그에 수반되는 도면들의 결합으로 쉽게 이해될 수 있으며, 참조 번호(reference numerals)들은 구조적 구성요소(structural elements)를 의미한다.
도 1은 본 개시의 일 실시예에 따른 컴퓨터 시스템의 구성 요소를 도시한 블록도이다.
도 2는 본 개시의 일 실시예에 따른 컴퓨터 시스템이 메모리 오류를 검출하는 방법을 도시한 흐름도이다.
도 3은 애플리케이션 프로그램의 실행 파일인 ELF 파일의 구조를 도시한 개념도이다.
도 4는 애플리케이션 프로그램의 글로벌 변수의 정보를 추출하는데 사용하는 프로그램 코드의 일 례를 도시한 도면이다.
도 5는 애플리케이션 프로그램의 로컬 변수의 정보를 추출하는데 사용하는 프로그램 코드의 일 례를 도시한 도면이다.
도 6은 인포메이션 태그(information tag)에 저장되는 메모리 정보를 도식화한 도면이다.
도 7은 본 개시의 일 실시예에 따른 메모리 오류 검출 시스템의 구성 요소를 도시한 블록도이다.
도 8은 본 개시의 일 실시예에 따른 컴퓨터 시스템이 메모리의 글로벌 영역, 스택 영역 및 Heap 영역 중 적어도 하나의 영역에서의 메모리 결함을 검출하는 방법을 도시한 흐름도이다.
도 9는 본 개시의 일 실시예에 따른 컴퓨터 시스템이 시그널 핸들러를 교체하여 동적 메모리 영역의 오류의 원인을 검출하고, 이를 분석하는 방법을 도시한 흐름도이다.
도 10은 본 개시의 일 실시예에 따른 컴퓨터 시스템이 애플리케이션 프로그램으로 인한 메모리 오류를 검출하는 방법을 도시한 흐름도이다.
도 11a는 할당되지 않은 포인터의 해제 결함으로 인한 메모리 오류를 분석하기 위한 프로그램 코드의 일 례를 도시한 도면이고, 도 11b는 인포메이션 태그 저장부에 저장된 메모리 정보를 도식화한 도면이다.
This disclosure may be readily understood in combination with the detailed description that follows and the accompanying drawings, wherein reference numerals denote structural elements.
1 is a block diagram illustrating components of a computer system according to an embodiment of the present disclosure.
2 is a flowchart illustrating a method of detecting a memory error by a computer system according to an embodiment of the present disclosure.
3 is a conceptual diagram illustrating the structure of an ELF file, which is an execution file of an application program.
4 is a diagram showing an example of program code used to extract information of global variables of an application program.
5 is a diagram showing an example of program codes used to extract information of local variables of an application program.
6 is a diagram illustrating memory information stored in an information tag.
7 is a block diagram illustrating components of a memory error detection system according to an embodiment of the present disclosure.
8 is a flowchart illustrating a method of detecting a memory defect in at least one of a global area, a stack area, and a heap area of a memory by a computer system according to an embodiment of the present disclosure.
9 is a flowchart illustrating a method of detecting and analyzing a cause of an error in a dynamic memory area by replacing a signal handler by a computer system according to an embodiment of the present disclosure.
10 is a flowchart illustrating a method for a computer system to detect a memory error due to an application program according to an embodiment of the present disclosure.
11A is a diagram showing an example of a program code for analyzing a memory error due to a release defect of an unallocated pointer, and FIG. 11B is a diagram illustrating memory information stored in an information tag storage unit.

본 명세서의 실시예들에서 사용되는 용어는 본 개시의 기능을 고려하면서 가능한 현재 널리 사용되는 일반적인 용어들을 선택하였으나, 이는 당 분야에 종사하는 기술자의 의도 또는 판례, 새로운 기술의 출현 등에 따라 달라질 수 있다. 또한, 특정한 경우는 출원인이 임의로 선정한 용어도 있으며, 이 경우 해당되는 실시예의 설명 부분에서 상세히 그 의미를 기재할 것이다. 따라서 본 명세서에서 사용되는 용어는 단순한 용어의 명칭이 아닌, 그 용어가 가지는 의미와 본 개시의 전반에 걸친 내용을 토대로 정의되어야 한다. The terms used in the embodiments of this specification have been selected from general terms that are currently widely used as much as possible while considering the functions of the present disclosure, but they may vary depending on the intention or precedent of a person skilled in the art, the emergence of new technologies, and the like. . In addition, in a specific case, there is also a term arbitrarily selected by the applicant, and in this case, the meaning will be described in detail in the description of the corresponding embodiment. Therefore, the term used in this specification should be defined based on the meaning of the term and the overall content of the present disclosure, not a simple name of the term.

단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함할 수 있다. 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 용어들은 본 명세서에 기재된 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가질 수 있다. Singular expressions may include plural expressions unless the context clearly dictates otherwise. Terms used herein, including technical or scientific terms, may have the same meaning as commonly understood by one of ordinary skill in the art described herein.

명세서 전체에서 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있음을 의미한다. 또한, 명세서에 기재된 "...부", "...모듈" 등의 용어는 적어도 하나의 기능이나 동작을 처리하는 단위를 의미하며, 이는 하드웨어 또는 소프트웨어로 구현되거나 하드웨어와 소프트웨어의 결합으로 구현될 수 있다.When it is said that a certain part "includes" a certain component throughout the specification, it means that it may further include other components without excluding other components unless otherwise stated. In addition, terms such as "...unit" and "...module" described in the specification mean a unit that processes at least one function or operation, which is implemented as hardware or software or a combination of hardware and software. It can be.

본 명세서에서 사용된 표현 "~하도록 구성된(또는 설정된)(configured to)"은 상황에 따라, 예를 들면, "~에 적합한(suitable for)", "~하는 능력을 가지는(having the capacity to)", "~하도록 설계된(designed to)", "~하도록 변경된(adapted to)", "~하도록 만들어진(made to)", 또는 "~를 할 수 있는(capable of)"과 바꾸어 사용될 수 있다. 용어 "~하도록 구성된(또는 설정된)"은 하드웨어적으로 "특별히 설계된(specifically designed to)" 것만을 반드시 의미하지 않을 수 있다. 대신, 어떤 상황에서는, "~하도록 구성된 시스템"이라는 표현은, 그 시스템이 다른 장치 또는 부품들과 함께 "~할 수 있는" 것을 의미할 수 있다. 예를 들면, 문구 "A, B, 및 C를 수행하도록 구성된(또는 설정된) 프로세서"는 해당 동작을 수행하기 위한 전용 프로세서(예: 임베디드 프로세서), 또는 메모리에 저장된 하나 이상의 소프트웨어 프로그램들을 실행함으로써, 해당 동작들을 수행할 수 있는 범용 프로세서(generic-purpose processor)(예: CPU 또는 application processor)를 의미할 수 있다.The expression “configured to (or configured to)” as used herein means depending on the situation, for example, “suitable for”, “having the capacity to” ", "designed to", "adapted to", "made to", or "capable of" can be used interchangeably. The term "configured (or set) to" may not necessarily mean only "specifically designed to" hardware. Instead, in some contexts, the phrase "a system configured to" may mean that the system "is capable of" in conjunction with other devices or components. For example, the phrase "a processor configured (or configured) to perform A, B, and C" may include a dedicated processor (e.g., an embedded processor) to perform those operations, or by executing one or more software programs stored in memory; It may mean a general-purpose processor (eg, CPU or application processor) capable of performing corresponding operations.

본 개시에서, "컴퓨터 시스템"은 예를 들면, 데스크탑 PC(desktop personal computer), 랩탑 PC(laptop personal computer), 넷북 컴퓨터(netbook computer), 워크스테이션(workstation), 서버, PDA(personal digital assistant) 등을 의미하나, 이에 한정되는 것은 아니다. 본 개시의 일 실시예에서, 컴퓨터 시스템은 스마트폰(smartphone), 태블릿 PC(tablet personal computer), 이동 전화기(mobile phone), 영상 전화기, 전자책 리더기(e-book reader), PMP(portable multimedia player), MP3 플레이어, 모바일 의료기기, 카메라(camera), 자동자 전자 제어 장치, 또는 웨어러블 장치(wearable device) 중 적어도 하나를 포함할 수 있다. In the present disclosure, a "computer system" includes, for example, a desktop personal computer (PC), a laptop personal computer (laptop PC), a netbook computer, a workstation, a server, and a personal digital assistant (PDA). etc., but is not limited thereto. In one embodiment of the present disclosure, the computer system is a smartphone, a tablet personal computer (tablet PC), a mobile phone, a video phone, an e-book reader, a portable multimedia player (PMP) ), an MP3 player, a mobile medical device, a camera, an automobile electronic control device, or a wearable device.

본 개시에서, "애플리케이션 프로그램(application program)"은 컴퓨터 시스템의 운영 체제(Operating System, OS) 상에서 구동되는 컴퓨터 프로그램을 의미하고, 표현의 간소화 및 명확화를 위해 이하에서는 "애플리케이션"으로 지칭하기로 한다. In the present disclosure, "application program" means a computer program that runs on an operating system (OS) of a computer system, and will be referred to as "application" hereinafter for simplicity and clarity of expression. .

아래에서는 첨부한 도면을 참고하여 본 개시의 실시예에 대하여 본 개시가 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 그러나 본 개시는 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시 예에 한정되지 않는다.Hereinafter, with reference to the accompanying drawings, embodiments of the present disclosure will be described in detail so that those skilled in the art can easily carry out the present disclosure. However, the present disclosure may be implemented in many different forms and is not limited to the embodiments described herein.

이하에서는 도면을 참조하여 본 개시의 실시예들을 상세하게 설명한다. Hereinafter, embodiments of the present disclosure will be described in detail with reference to the drawings.

도 1은 본 개시의 일 실시예에 따른 컴퓨터 시스템(100)의 구성 요소를 도시한 블록도이다.1 is a block diagram showing components of a computer system 100 according to an embodiment of the present disclosure.

도 1을 참조하면, 컴퓨터 시스템(100)은 프로세서(110), 메모리(120), 및 저장부(130)을 포함할 수 있다. 컴퓨터 시스템(100)은, 도 1에 도시된 구성 요소 중 적어도 하나를 생략하거나, 또는 다른 구성 요소를 추가적으로 포함할 수 있다. 일 실시예에서, 컴퓨터 시스템(100)은 프로세서(110), 메모리(120), 및 저장부(130)를 서로 전기적으로 연결하고, 구성 요소들 간의 통신(예를 들어, 제어 메시지 및/또는 데이터)을 전달하는 버스(bus)를 더 포함할 수 있다. Referring to FIG. 1 , a computer system 100 may include a processor 110, a memory 120, and a storage unit 130. The computer system 100 may omit at least one of the components shown in FIG. 1 or may additionally include other components. In one embodiment, computer system 100 electrically connects processor 110, memory 120, and storage 130 to each other and communicates between the components (eg, control messages and/or data). ) may be further included.

프로세서(110)는 메모리(120)에 저장된 컴퓨터로 읽을 수 있는 명령어(instruction) 또는 데이터를 로드(load)하고, 로드된 명령어 또는 데이터에 따라 적어도 하나의 소프트웨어 프로그램을 실행하는 범용 프로세서(generic-purpose processor)일 수 있다. 프로세서(110)는 예를 들어, 중앙 처리 장치(Central Processing Unit, CPU), 어플리케이션 프로세서(Application Processor, AP), 및 커뮤니케이션 프로세서(Communication Processor, CP) 중 적어도 하나로 구성될 수 있으나, 이에 한정되는 것은 아니다. 일 실시예에서, 프로세서(110)는 ASIC(application-specific integrated circuit) 칩, FPGA(field-programmable gate arrays), 및 프로그램 가능 논리 장치(programmable-logic device) 중 어느 하나로 구성될 수도 있다. The processor 110 is a general-purpose processor that loads computer-readable instructions or data stored in the memory 120 and executes at least one software program according to the loaded instructions or data. processor). The processor 110 may include, for example, at least one of a central processing unit (CPU), an application processor (AP), and a communication processor (CP), but is not limited thereto. no. In one embodiment, the processor 110 may be composed of any one of an application-specific integrated circuit (ASIC) chip, field-programmable gate arrays (FPGA), and a programmable-logic device.

프로세서(110)는 메모리(120)의 오류를 검출하고, 분석하는 분석 도구(110-1) 및 컴퓨터 시스템(100)에서 실행되는 애플리케이션의 각 프로세스(process)에 삽입(injection)되어 메모리(120)의 결함 탐지 및 애플리케이션의 크래쉬(crash)를 모니터링하는 에이전트(agent)(110-2)를 포함할 수 있다. The processor 110 is injected into the analysis tool 110-1 for detecting and analyzing errors in the memory 120 and each process of an application running on the computer system 100, It may include an agent (agent) 110-2 that monitors defect detection and application crashes.

분석 도구(110-1)는 바이너리 분석 모듈(112) 및 결함 분석 모듈(114)을 포함할 수 있다. 에이전트(110-2)는 결함 탐지 모듈(116) 및 크래쉬 모니터링 모듈(118)을 포함할 수 있다. 여기서, "모듈"은 하드웨어 및 소프트웨어 중 어느 하나 또는 이들의 조합을 포함하는 단위(unit)를 의미할 수 있다. "모듈"은 예를 들면, 유닛(unit), 로직(logic), 논리 블록(logical block), 부품(component), 또는 회로(circuit) 등의 용어로 대체될 수 있다. "모듈"은 하나 또는 그 이상의 기능을 수행하는 최소 단위 또는 그 일부가 될 수도 있다. 도 1에서 바이너리 분석 모듈(112), 결함 분석 모듈(114), 결함 탐지 모듈(116), 및 크래쉬 모니터링 모듈(118)은 서로 분리된 별개의 것으로 도시되어 있지만, 도시된 것으로 한정되지는 않는다. 일 실시예에서, 바이너리 분석 모듈(112), 결함 분석 모듈(114), 결함 탐지 모듈(116), 및 크래쉬 모니터링 모듈(118)은 하나의 모듈 또는 세개 이하의 복수의 모듈로 통합될 수 있다. The analysis tool 110 - 1 may include a binary analysis module 112 and a defect analysis module 114 . Agent 110 - 2 may include a fault detection module 116 and a crash monitoring module 118 . Here, "module" may mean a unit including any one or a combination of hardware and software. A “module” may be replaced with a term such as, for example, a unit, logic, logical block, component, or circuit. A “module” may be a minimal unit or part thereof that performs one or more functions. In FIG. 1 , the binary analysis module 112 , the defect analysis module 114 , the defect detection module 116 , and the crash monitoring module 118 are shown as being separated from each other, but are not limited thereto. In one embodiment, the binary analysis module 112, fault analysis module 114, fault detection module 116, and crash monitoring module 118 may be integrated into one module or a plurality of modules of three or less.

바이너리 분석 모듈(112)은 컴퓨터 시스템(100)에 의해 실행되는 애플리케이션의 글로벌 변수(Global variable) 및 로컬 변수(local variable)를 포함하는 정적 메모리(static memory) 정보를 추출할 수 있다. 일 실시예에서, 바이너리 분석 모듈(112)은 애플리케이션이 컴퓨터 시스템(100) 상에서 실행되기 전에 미리 애플리케이션의 글로벌 변수 및 로컬 변수를 추출할 수 있다. 바이너리 분석 모듈(112)은 사용자 입력을 통해 애플리케이션이 실행되기 전에 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는 바이너리 분석기(analyzer)를 먼저 실행하도록 할 수 있다. 일 실시예에서, 바이너리 분석 모듈(112)은 상기 바이너리 분석기를 디폴트(default)로 실행하도록 설정할 수 있다. The binary analysis module 112 may extract static memory information including global variables and local variables of applications executed by the computer system 100 . In one embodiment, the binary analysis module 112 may extract global variables and local variables of the application in advance before the application is executed on the computer system 100 . The binary analysis module 112 may first execute a binary analyzer that extracts global variables and local variables of the application before the application is executed through user input. In one embodiment, the binary analysis module 112 may be set to run the binary analyzer by default.

바이너리 분석 모듈(112)은 애플리케이션의 ELF 파일의 코드를 분석하여 글로벌 변수와 로컬 변수를 추출할 수 있다. 바이너리 분석 모듈(112)은 추출된 글로벌 변수 및 로컬 변수를 저장부(130)에 저장할 수 있다. 일 실시예에서, 바이너리 분석 모듈(112)은 Windows의 PE 파일의 코드를 분석하여 글로벌 변수와 로컬 변수를 추출할 수 있다. 바이너리 분석 모듈(112)이 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하고, 저장부(130)에 저장하는 구체적인 방법은 도 3 내지 도 6의 설명 부분에서 상세하게 설명하기로 한다.The binary analysis module 112 may extract global variables and local variables by analyzing the code of the ELF file of the application. The binary analysis module 112 may store the extracted global variables and local variables in the storage unit 130 . In one embodiment, the binary analysis module 112 may extract global variables and local variables by analyzing the code of the Windows PE file. A specific method for the binary analysis module 112 to extract the global and local variables of the application and store them in the storage unit 130 will be described in detail in the description of FIGS. 3 to 6 .

결함 탐지 모듈(116)은 바이너리 분석 모듈(112)에 의해 추출되고 저장부(130)에 저장된 글로벌 변수 및 로컬 변수 정보에 기초하여 메모리(120)의 결함을 탐지할 수 있다. 일 실시예에서, 결함 탐지 모듈(116)은 추출된 애플리케이션의 글로벌 변수 및 로컬 변수 각각의 주소(address), 크기, 호출함수 중 적어도 하나를 분석하고, 분석 결과에 기초하여 메모리(120)의 결함 정보를 획득할 수 있다. The defect detection module 116 may detect defects in the memory 120 based on global variable and local variable information extracted by the binary analysis module 112 and stored in the storage 130 . In one embodiment, the defect detection module 116 analyzes at least one of an address, a size, and a call function of each of the global and local variables of the extracted application, and the defect of the memory 120 based on the analysis result. information can be obtained.

결함 탐지 모듈(116)은 Dynamic Binary Injection(DBI) 기술을 이용하여 애플리케이션이 실행 중에 메모리(120)의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 동적 메모리 정보를 모니터링할 수 있다. 일 실시예에서, 결함 탐지 모듈(116)은 저장부(130)에 저장된 글로벌 변수 및 로컬 변수에 기초하여 메모리(120)의 글로벌 영역 및 스택 영역(Stack)의 메모리 결함을 검출하고, DBI 기술을 이용하여 메모리(120)의 Heap 영역에서의 함수 호출을 모니터링하여 메모리 결함을 검출할 수 있다. 스택 영역에는 로컬 변수가 저장되어 있을 수 있다. The defect detection module 116 may monitor dynamic memory information that is dynamically allocated, accessed, and released from the heap area of the memory 120 while an application is running using Dynamic Binary Injection (DBI) technology. In one embodiment, the defect detection module 116 detects memory defects in the global area and the stack area of the memory 120 based on the global and local variables stored in the storage unit 130, and uses DBI technology. It is possible to detect a memory defect by monitoring function calls in the heap area of the memory 120. Local variables may be stored in the stack area.

결함 탐지 모듈(116)은 메모리의 할당, 접근, 및 해제 관련 함수가 실행되는 경우, 저장부(130)에 저장된 메모리 주소 정보를 이용하여 메모리의 결함을 검출할 수 있다. 예를 들어, 결함 탐지 모듈(116)은 메모리 할당 함수의 파라미터 중 할당 크기에 해당하는 파라미터의 값이 '0'인 경우(zero-size 메모리 할당), 메모리 할당 함수의 실행 결과가 NULL인 경우(메모리 할당 실패), 및 애플리케이션이 종료된 이후 해제되지 않은 동적 메모리 할당이 있는 경우(메모리 누수) 중 적어도 하나의 경우 메모리 할당과 관련된 결함이 있는 것으로 판단할 수 있다. The defect detection module 116 may detect defects in the memory using memory address information stored in the storage unit 130 when functions related to allocation, access, and release of memory are executed. For example, the defect detection module 116 determines whether the value of a parameter corresponding to an allocation size among parameters of a memory allocation function is '0' (zero-size memory allocation), and when the execution result of the memory allocation function is NULL ( It may be determined that there is a defect related to memory allocation in the case of at least one of a memory allocation failure) and a case in which there is dynamic memory allocation that is not freed after the application is terminated (memory leak).

또한, 결함 탐지 모듈(116)은 메모리 접근 함수의 주소 파라미터 값이 NULL인 경우(NULL 포인터 접근), 접근하고자 하는 포인터에 대한 인포메이션 태그의 해제 flag 값이 설정되어 있는 경우(해제된 포인터 접근), 접근하고자 하는 포인터에 대한 인포메이션 태그가 존재하지 않고, 스택 주소 공간에 해당되지 않는 경우(할당되지 않은 포인터 접근), 접근하고자 하는 포인터에 대한 인포메이션 태그의 할당 크기의 범위를 벗어나는 경우(할당 범위를 벗어난 접근), 및 문자열 함수의 소스(source)에 해당되는 문자열에 '\0' 처리가 되어 있지 않은 경우(다른 변수의 메모리 공간과 충돌) 중 적어도 하나의 경우에 메모리 접근과 관련된 결함이 있는 것으로 판단할 수 있다. In addition, the defect detection module 116 detects when the address parameter value of the memory access function is NULL (NULL pointer access), when the release flag value of the information tag for the pointer to be accessed is set (released pointer access), When the information tag for the pointer to be accessed does not exist and does not correspond to the stack address space (unallocated pointer access), when the information tag for the pointer to be accessed is out of the range of the allocation size (out of the allocation range) access), and when '\0' is not processed in the string corresponding to the source of the string function (collision with the memory space of other variables), it is determined that there is a defect related to memory access. can do.

또한, 결함 탐지 모듈(116)은 메모리 해제 함수의 파라미터 값이 NULL인 경우(NULL 포인터 해제), 저장부(130) 내에 인포메이션 태그가 존재하지 않거나, 할당 flag의 값이 정적 할당에 해당하는 경우(할당되지 않은 포인터 해제), 인포메이션 태그의 할당 함수 유형 flag 값이 해제 함수의 유형과 불일치하는 경우(할당/해제 불일치), 및 저장부(130) 내의 인포메이션 태그 상의 해제 flag가 설정되어 있는 경우(해제된 메모리 재해제) 중 적어도 하나의 경우에 메모리 해제와 관련된 결함이 있는 것으로 판단할 수 있다. In addition, the defect detection module 116 is used when the parameter value of the memory release function is NULL (NULL pointer release), when the information tag does not exist in the storage unit 130, or when the value of the allocation flag corresponds to static allocation ( unallocated pointer release), when the allocation function type flag value of the information tag does not match the release function type (allocation/release mismatch), and when the release flag on the information tag in the storage unit 130 is set (release It can be determined that there is a defect related to memory release in at least one of the above).

크래쉬 모니터링 모듈(Crash Monitoring module)(118)은 애플리케이션이 실행 중에 메모리(120)에 잘못 할당, 접근, 해제되어 발생되는 크래쉬(crash)를 분석하여 크래쉬 관련 데이터를 수집할 수 있다. 크래쉬 모니터링 모듈(118)은 애플리케이션에 크래쉬가 발생하는 경우 크래쉬를 모니터링하도록 시그널을 후킹(hooking)할 수 있다. 일 실시예에서, 크래쉬 모니터링 모듈(118)은 애플리케이션에 크래쉬가 발생되어 애플리케이션이 종료되는 신호(signal)에 따라, 커널(kernel)의 시그널 핸들러(signal handler)를 크래쉬가 발생한 시점의 메모리 정보 및 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체할 수 있다. 크래쉬 모니터링 모듈(118)은 교체된 시그널 핸들러를 호출하고, 호출된 시그널 핸들러를 이용하여 크래쉬와 관련된 애플리케이션의 콜 스택(Call Stack) 정보를 수집할 수 있다. 크래쉬 모니터링 모듈(118)은 수집된 콜 스택 정보를 저장부(130)에 저장할 수 있다. The crash monitoring module 118 may collect data related to crashes by analyzing crashes caused by incorrectly allocating, accessing, or releasing the memory 120 while the application is running. The crash monitoring module 118 may hook a signal to monitor the crash when an application crashes. In one embodiment, the crash monitoring module 118 sends a signal handler of a kernel to the memory information at the time of the crash and the crash according to the signal that the application crashes and the application is terminated. It can be replaced with a signal handler that monitors memory defect information prior to the occurrence of The crash monitoring module 118 may call the replaced signal handler and collect call stack information of an application related to the crash using the called signal handler. The crash monitoring module 118 may store the collected call stack information in the storage unit 130 .

결함 분석 모듈(114)은 에이전트(110-2)로부터 획득된 로그 정보를 분석하여 메모리(120)의 결함 정보를 출력할 수 있다. 일 실시예에서, 결함 분석 모듈(114)은 결함 탐지 모듈(116)에서 검출한 메모리(120)의 글로벌 영역, 스택 영역, Heap 영역에서의 메모리 결함 정보 및 크래쉬 모니터링 모듈(118)에서 수집한 콜 스택 정보에 기초하여 메모리(120)의 오류 원인을 분석할 수 있다. 결함 분석 모듈(114)은 메모리 오류가 어느 위치에서 발생되었는지, 또는 메모리 세팅(setting), 버퍼 오류, 참조 번지 오류 등을 포함하는 메모리 오류의 원인을 분석할 수 있다. 결함 분석 모듈(114)은 분석된 결과를 텍스트 형태로 출력할 수 있다. The defect analysis module 114 may output defect information of the memory 120 by analyzing log information obtained from the agent 110-2. In one embodiment, the fault analysis module 114 includes memory defect information in the global area, stack area, and heap area of the memory 120 detected by the fault detection module 116 and calls collected by the crash monitoring module 118. An error cause of the memory 120 may be analyzed based on the stack information. The defect analysis module 114 may analyze the location where the memory error occurred or the cause of the memory error including memory setting, buffer error, reference address error, and the like. The defect analysis module 114 may output the analyzed result in text form.

메모리(120)는 컴퓨터 시스템(100)의 적어도 하나의 구성 요소에 관계된 명령어(instruction) 또는 데이터를 저장할 수 있다. 메모리(120)는 예를 들어, DRAM(dynamic RAM), SRAM(static RAM), 또는 SDRAM(synchronous dynamic RAM)으로 구성될 수 있지만, 이에 한정되는 것은 아니다. The memory 120 may store instructions or data related to at least one component of the computer system 100 . The memory 120 may include, for example, dynamic RAM (DRAM), static RAM (SRAM), or synchronous dynamic RAM (SDRAM), but is not limited thereto.

일 실시예에서, 메모리(120)는 소프트웨어 및/또는 프로그램을 저장하는 비휘발성 메모리를 포함할 수 있다. 프로그램은 예를 들어, 커널(kernel), 라이브러리 및 애플리케이션을 포함할 수 있지만, 이에 한정되지는 않는다. 메모리(120)에는 미들웨어(middleware) 및 API(Application Programming Interface)이 저장되어 있을 수 있다. In one embodiment, memory 120 may include non-volatile memory that stores software and/or programs. A program may include, for example, a kernel, a library, and an application, but is not limited thereto. Middleware and API (Application Programming Interface) may be stored in the memory 120 .

저장부(130)는 프로세서(110)에서 검출한 메모리 오류 정보를 저장할 수 있다. 저장부(130)는 플래시 메모리(예: NAND flash 또는 NOR flash 등), 하드 드라이브, 및 솔리드 스테이트 드라이브(solid state drive(SSD)) 중 어느 하나로 구성될 수 있다. 다만, 저장부(130)가 나열된 예시로 구성되는 것으로 한정되지는 않는다. The storage unit 130 may store memory error information detected by the processor 110 . The storage unit 130 may be configured with any one of a flash memory (eg, NAND flash or NOR flash), a hard drive, and a solid state drive (SSD). However, the storage unit 130 is not limited to being composed of the listed examples.

저장부(130)는 바이너리 분석 모듈(112)에서 추출한 애플리케이션의 글로벌 변수 및 로컬 변수를 포함하는 정적 메모리 정보를 저장하는 인포메이션 태그 저장부(information tag repository)를 포함할 수 있다. 일 실시예에서, 저장부(130)는 결함 탐지 모듈(116)에서 분석한 메모리(120)의 Heap 영역에서의 결함 정보를 로그(log) 형태로 저장할 수 있다. 일 실시예에서, 저장부(130)는 크래쉬 모니터링 모듈(118)에서 수집한 콜 스택 정보를 애플리케이션 크래쉬 로그 형태로 저장하고, 커널 자체에서 발생된 크래쉬를 분석한 데이터를 커널 크래쉬 로그로 저장할 수 있다. 이에 대해서는 도 10의 설명 부분에서 상세하게 설명하기로 한다. The storage unit 130 may include an information tag repository for storing static memory information including global variables and local variables of the application extracted by the binary analysis module 112 . In one embodiment, the storage unit 130 may store defect information in the heap area of the memory 120 analyzed by the defect detection module 116 in a log form. In one embodiment, the storage unit 130 may store the call stack information collected by the crash monitoring module 118 in the form of an application crash log, and store data obtained by analyzing crashes generated in the kernel itself as a kernel crash log. . This will be described in detail in the description of FIG. 10 .

도 2는 본 개시의 일 실시예에 따른 컴퓨터 시스템(100)이 메모리 오류를 검출하는 방법을 도시한 흐름도이다.2 is a flowchart illustrating a method for the computer system 100 to detect a memory error according to an embodiment of the present disclosure.

단계 S210에서, 컴퓨터 시스템(100)은 애플리케이션의 실행 이전에 애플리케이션의 글로벌 변수 및 로컬 변수를 추출한다. 일 실시예에서, 컴퓨터 시스템(100)은 사용자 입력에 따라 애플리케이션이 실행되기 전에 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는 바이너리 분석기(Analyer)를 먼저 실행되도록 설정하고, 실행된 바이너리 분석기를 통해 애플리케이션의 글로벌 변수 및 로컬 변수를 추출할 수 있다. 일 실시예에서, 컴퓨터 시스템(100)은 애플리케이션의 ELF 파일의 코드를 분석하여 애플리케이션의 글로벌 변수와 로컬 변수를 추출할 수 있다. 일 실시예에서, 컴퓨터 시스템(100)은 추출된 글로벌 변수 및 로컬 변수 각각의 주소(address), 크기, 호출 함수 중 적어도 하나를 분석할 수 있다. In step S210, the computer system 100 extracts global variables and local variables of the application before execution of the application. In one embodiment, the computer system 100 sets a binary analyzer that extracts global variables and local variables of the application to be executed first before the application is executed according to a user input, and analyzes the application through the executed binary analyzer. Global and local variables can be extracted. In one embodiment, the computer system 100 may extract global and local variables of the application by analyzing the code of the ELF file of the application. In one embodiment, the computer system 100 may analyze at least one of an address, a size, and a call function of each of the extracted global variable and local variable.

단계 S220에서, 컴퓨터 시스템(100)은 추출된 애플리케이션의 글로벌 변수 및 로컬 변수를 인포메이션 태그 저장부(information tag repository)에 저장한다. 인포메이션 태깅(information tagging)은 글로벌 변수 및 로컬 변수에 관한 정보(주소, 크기)와 동적으로 할당, 접근, 해제되는 Heap 영역의 정보(주소, 크기, 할당 함수 콜 스택, 해제 함수 콜 스택, 할당 함수 유형)를 메모리 공간에 저장하는 방법을 의미한다. 이에 대해서는 도 6의 설명 부분에서 상세하게 설명하기로 한다. In step S220, the computer system 100 stores the global and local variables of the extracted application in an information tag repository. Information tagging is information on global and local variables (address, size) and dynamically allocated, accessed, and deallocated heap area information (address, size, allocation function call stack, release function call stack, allocation function type) in memory space. This will be described in detail in the description of FIG. 6 .

단계 S230에서, 컴퓨터 시스템(100)은 저장된 글로벌 변수 및 로컬 변수 정보와 애플리케이션의 실행 중에 수집된 동적 메모리 정보에 기초하여 메모리 오류를 검출한다. 일 실시예에서, 컴퓨터 시스템(100)은 인포메이션 태그 저장부에 저장된 애플리케이션의 글로벌 변수 및 로컬 변수 정보에 기초하여 정적 메모리 영역의 결함을 탐지할 수 있다. In step S230, the computer system 100 detects a memory error based on the stored global variable and local variable information and dynamic memory information collected during execution of the application. In one embodiment, the computer system 100 may detect a defect in a static memory area based on global variable and local variable information of an application stored in the information tag storage unit.

컴퓨터 시스템(100)은 또한, Dynamic Binary Injection(DBI) 기술을 이용하여 애플리케이션이 실행 중에 메모리의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 동적 메모리 정보를 모니터링할 수 있다. 즉, 컴퓨터 시스템(100)은 인포메이션 태그 저장부에 저장된 글로벌 변수 및 로컬 변수에 기초하여 메모리의 글로벌 영역 및 스택 영역(Stack)의 메모리 결함을 검출하고, DBI 기술을 이용하여 메모리의 Heap 영역에서의 함수 호출을 모니터링하여 메모리 결함을 검출할 수 있다.The computer system 100 may also monitor dynamic memory information that is dynamically allocated, accessed, and released from a heap area of memory while an application is running using a dynamic binary injection (DBI) technique. That is, the computer system 100 detects memory defects in the global area and the stack area of the memory based on the global and local variables stored in the information tag storage unit, and in the heap area of the memory using DBI technology. Memory defects can be detected by monitoring function calls.

일 실시예에서, 컴퓨터 시스템(100)은 애플리케이션이 실행 중에 잘못된 메모리 참조(memory corruption) 등으로 인하여 크래쉬가 발생되는 경우, 크래쉬를 모니터링하도록 시그널을 후킹(hooking)할 수 있다. 컴퓨터 시스템(100)은 애플리케이션의 크래쉬가 발생한 시점의 메모리 정보 및 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하고, 크래쉬와 관련된 콜 스택(Call Stack) 정보를 수집할 수 있다. In one embodiment, the computer system 100 may hook a signal to monitor the crash when a crash occurs due to memory corruption or the like while an application is running. The computer system 100 may monitor memory information at the time of application crash and memory defect information prior to the crash, and collect call stack information related to the crash.

컴퓨터 시스템(100)은 인포메이션 태그 저장부에 저장된 애플리케이션의 글로벌 변수와 로컬 변수로 인한 정적 메모리 영역에서의 결함 정보, 애플리케이션 실행 중에 동적으로 할당, 접근, 해제되는 동적 메모리 영역에서의 결함 정보, 및 콜 스택 정보를 기초로 메모리의 오류를 검출하고, 오류 원인을 분석할 수 있다. 일 실시예에서, 컴퓨터 시스템(100)은 분석 결과를 텍스트 형태로 출력할 수 있다.The computer system 100 includes defect information in a static memory area due to global and local variables of the application stored in the information tag storage unit, defect information in a dynamic memory area that is dynamically allocated, accessed, and freed during application execution, and call Based on the stack information, a memory error can be detected and the cause of the error can be analyzed. In one embodiment, the computer system 100 may output analysis results in text form.

종래의 메모리 오류를 검출하는 기술들은 애플리케이션의 실행 시점에 메모리 검출 도구가 탑재되기 때문에 메모리 검출 도구의 탑재 이후 시점에서 접근, 할당, 및 해제되는 동적 메모리 오류는 분석 가능하지만, 애플리케이션의 실행 이전에 할당이 완료된 글로벌 변수 및 스택 영역에 할당되는 로컬 변수에 대해서는 정보를 획득할 수 없어 메모리의 글로벌 영역 및 스택 영역에서 발생되는 메모리 오류는 검출해낼 수 없는 문제점이 있었다. 또한, 시스템 상에서 메모리 오류가 발생한다 하더라도 애플리케이션이 의도하지 않은 방향으로 계속적으로 실행될 수 있으며, 애플리케이션의 크래쉬가 발생되어 종료되는 경우 종료 시점에서의 메모리 오류의 원인에 관한 정보를 알 수 없어 프로그램 오류를 수정하는데 어려움이 있었다.Conventional technologies for detecting memory errors can analyze dynamic memory errors that are accessed, allocated, and freed after the memory detection tool is loaded because the memory detection tool is loaded at the time of application execution, but allocated before application execution. There is a problem in that memory errors occurring in the global and stack areas of memory cannot be detected because information cannot be obtained about the completed global variables and local variables allocated to the stack area. In addition, even if a memory error occurs in the system, the application may continue to run in an unintended direction, and if the application crashes and is terminated, information about the cause of the memory error is not known at the time of termination, resulting in program errors. It was difficult to correct.

도 1 및 도 2에 도시된 실시예에 따른 컴퓨터 시스템 및 메모리 오류 검출 방법은 애플리케이션의 실행으로 인하여 동적으로 할당, 접근, 해제되는 동적 메모리 정보에 의한 오류를 검출할 뿐만 아니라, 애플리케이션이 실행되기 전에 미리 애플리케이션의 글로벌 변수 및 로컬 변수와 같은 정적 메모리 정보를 추출하고, 추출된 정적 메모리 정보를 이용하여 메모리의 오류를 검출함으로써, 메모리 오류 검출의 정확성을 향상시킬 수 있다. 또한, 본 개시의 실시예에 따른 컴퓨터 시스템 및 메모리 오류 검출 방법은, 애플리케이션의 크래쉬가 발생하는 경우 크래수의 발생 시점의 메모리 정보 및 크래쉬 발생 이전까지의 메모리 결함 정보를 모니터링한 결과를 분석하고, 분석된 결과를 출력함으로써 사용자가 메모리 오류의 원인을 정확하게 파악할 수 있도록 할 수 있다. The computer system and memory error detection method according to the embodiment shown in FIGS. 1 and 2 not only detects errors due to dynamic memory information that is dynamically allocated, accessed, and freed due to application execution, but also detects errors before the application is executed. Accuracy of memory error detection may be improved by extracting static memory information such as global variables and local variables of an application in advance and detecting memory errors using the extracted static memory information. In addition, a computer system and memory error detection method according to an embodiment of the present disclosure, when an application crashes, analyzes the result of monitoring memory information at the time of the crash and memory defect information until before the crash, By outputting the analyzed result, the user can accurately determine the cause of the memory error.

또한, 본 개시의 실시예에 따른 컴퓨터 시스템 및 메모리 오류 검출 방법은 별도의 하드웨어 장비의 추가 없이, 소프트웨어 적인 방법으로 메모리의 결함 탐지 및 오류 분석이 가능하므로, 추가 비용 및 공간이 필요하지 않아 효율적이다. 또한, 종래의 DBI (Dynamic Binary Injection) 기법을 활용하므로, 실행 바이너리의 변경이 필요하지 않다. In addition, the computer system and memory error detection method according to an embodiment of the present disclosure is efficient because it does not require additional cost and space because it is possible to detect defects and analyze errors in a memory using a software method without adding additional hardware equipment. . In addition, since the conventional DBI (Dynamic Binary Injection) technique is used, it is not necessary to change the execution binary.

도 3은 애플리케이션의 실행 파일인 ELF 파일(300)의 구조를 도시한 개념도이고, 도 4는 애플리케이션의 글로벌 변수의 정보를 추출하는데 사용하는 프로그램 코드(400)의 일 례를 도시한 도면이다.3 is a conceptual diagram showing the structure of an ELF file 300, which is an execution file of an application, and FIG. 4 is a diagram showing an example of a program code 400 used to extract global variable information of an application.

도 3을 참조하면, 리눅스(Linux) 또는 유닉스(UNIX)에서 사용하는 실행 파일인 ELF 파일(300)에는 애플리케이션의 실행 명령어를 적재하는 영역인 텍스트 영역(310), 애플리케이션이 실행되는데 있어 필요한 변수가 저장되는 데이터 영역(320), 및 초기화되지 않은 데이터 영역인 BSS 영역(330)을 포함될 수 있다. 데이터 영역(320)에는 초기화된 변수가 저장되고, 애플리케이션이 종료될 때까지 메모리 상에 상주할 수 있다. Referring to FIG. 3, the ELF file 300, which is an executable file used in Linux or UNIX, includes a text area 310, which is an area for loading application execution commands, and variables necessary for executing the application. A stored data area 320 and an uninitialized data area BSS area 330 may be included. Initialized variables are stored in the data area 320 and may reside in memory until the application is terminated.

데이터 영역(320) 및 BSS 영역(330)에 글로벌 변수가 저장되어 있다. 컴퓨터 시스템은 ELF 파일(300)의 데이터 영역(320) 및 BSS 영역(330)에 저장된 글로벌 변수 정보 중 주소(address)와 크기를 추출할 수 있다. 일 실시예에서, 컴퓨터 시스템이 Windows 기반인 경우, Windows의 실행 파일 포맷인 PE 파일을 통해 글로벌 변수 정보를 추출할 수 있다. Global variables are stored in the data area 320 and the BSS area 330 . The computer system can extract addresses and sizes from global variable information stored in the data area 320 and the BSS area 330 of the ELF file 300 . In one embodiment, if the computer system is based on Windows, global variable information may be extracted through a PE file, which is an executable file format of Windows.

컴퓨터 시스템의 바이너리 분석 모듈(112, 도 1 참조)은 도 4에 도시된 프로그램 코드(400)에 따라 ELF 파일에서 글로벌 변수 정보를 추출할 수 있다. 도 4는 애플리케이션의 글로벌 변수를 추출하는 프로그램 코드(400)의 일 례를 도시한 것이고, 본 개시의 실시예가 도시된 프로그램 코드로 한정되는 것은 아니다. 바이너리 분석 모듈(112)은 프로그램 코드(400)와 같이 buffer(410)라는 글로벌 변수를 작성하고, ELF 헤더(ELF header)를 분석하여 ELF 파일(300, 도 3 참조)의 BSS 영역(330, 도 3 참조)의 글로벌 변수 주소 및 크기 정보를 추출할 수 있다. The binary analysis module 112 (see FIG. 1 ) of the computer system may extract global variable information from the ELF file according to the program code 400 shown in FIG. 4 . 4 illustrates an example of a program code 400 for extracting global variables of an application, and embodiments of the present disclosure are not limited to the program code shown. The binary analysis module 112 creates a global variable called buffer 410 like the program code 400, analyzes the ELF header, and analyzes the BSS area 330 of the ELF file 300 (see FIG. 3). 3) global variable address and size information can be extracted.

도 5는 애플리케이션의 로컬 변수의 정보를 추출하는데 사용하는 프로그램 코드(500)의 일 례를 도시한 도면이다.5 is a diagram showing an example of program code 500 used to extract information of a local variable of an application.

컴퓨터 시스템의 바이너리 분석 모듈(112, 도 1 참조)은 프로그램 코드(500)에 따라 ELF 파일의 텍스트 영역(.text 영역)에 저장되는 실행 코드(510)를 분석하여 로컬 변수(520)를 추출할 수 있다. 도 5는 애플리케이션의 글로벌 변수를 추출하는 프로그램 코드(500)의 일 례를 도시한 것이고, 본 개시의 실시예가 도시된 프로그램 코드로 한정되는 것은 아니다. The binary analysis module 112 (see FIG. 1) of the computer system extracts the local variable 520 by analyzing the executable code 510 stored in the text area (.text area) of the ELF file according to the program code 500. can 5 illustrates an example of a program code 500 for extracting global variables of an application, and embodiments of the present disclosure are not limited to the program code shown.

프로그램 코드(500)에 따르면, 메인 함수의 수행 시 스택 포인터(Stack pointer, SP)에 값을 추가 또는 삭제하는 연산을 수행할 수 있다. 바이너리 분석 모듈(112)은 프로그램 코드(500)의 스택 포인터 추가 또는 삭제 연산을 분석하여 로컬 변수(520)의 주소(address), 크기, 및 호출 함수 중 적어도 하나를 포함하는 로컬 변수 정보를 추출할 수 있다. 여기서, 스택(Stack)의 주소는 애플리케이션 실행 시에 변경되므로, 로컬 변수의 주소는 스택 포인터의 오프셋(offset)값으로 추출될 수 있다. According to the program code 500, when the main function is executed, an operation of adding or deleting a value to a stack pointer (SP) may be performed. The binary analysis module 112 analyzes a stack pointer addition or deletion operation of the program code 500 to extract local variable information including at least one of the address, size, and call function of the local variable 520. can Here, since the address of the stack is changed during application execution, the address of the local variable can be extracted as an offset value of the stack pointer.

도 6은 인포메이션 태그(information tag)(600)에 저장되는 메모리 정보를 도식화한 도면이다. 6 is a diagram illustrating memory information stored in an information tag 600 .

도 6을 참조하면, 인포메이션 태그(600)는 정적 메모리 영역 및 동적 메모리 영역의 주소(610), 크기(620), 할당 플래그(630), 할당 함수 유형(640), 해제 플래그(650), 할당 Caller(660), 및 해제 Caller(670)의 정보를 포함할 수 있다. 인포메이션 태그(600)의 주소(610) 및 크기(620)에는 Heap 메모리 영역의 주소 및 크기에 관한 정보 뿐만 아니라, 애플리케이션의 글로벌 변수 및 로컬 변수 각각의 주소와 크기가 저장될 수 있다. Referring to FIG. 6 , an information tag 600 includes an address 610, a size 620, an allocation flag 630, an allocation function type 640, a release flag 650, and an allocation of a static memory area and a dynamic memory area. Information on the caller 660 and the release caller 670 may be included. In the address 610 and size 620 of the information tag 600, information about the address and size of the heap memory area as well as the address and size of each of the global and local variables of the application may be stored.

일반적인 인포메이션 태그에는 특정 메모리 영역에 대한 기본 정보(예를 들어, 주소, 크기 등)만을 저장한다. 그러나, 본 개시의 일 실시예에 따른 인포메이션 태그(600)는 메모리 오류의 원인 분석을 용이하게 하기 위하여 Heap 메모리 영역에서의 할당 Caller(660) 및 해제 Caller(670)와 같은 부가적인 정보를 추가로 저장하도록 구성할 수 있다. A general information tag stores only basic information (eg, address, size, etc.) for a specific memory area. However, the information tag 600 according to an embodiment of the present disclosure adds additional information such as an allocation caller 660 and a release caller 670 in the heap memory area to facilitate analysis of the cause of a memory error. Can be configured to save.

컴퓨터 시스템(100)은 인포메이션 태그(600)에 저장된 글로벌 변수 및 로컬 변수 각각의 주소(610)와 크기(620)를 참조하여 정적 메모리 영역의 오류를 검출할 수 있다. 또한, 컴퓨터 시스템(100)은 인포메이션 태그(600)를 이용하여 Heap 메모리 영역에 동적으로 할당, 접근, 및 해제된 함수의 호출 정보를 모니터링함으로써 동적 메모리 영역의 오류를 검출할 수 있다. The computer system 100 may detect an error in the static memory area by referring to the address 610 and size 620 of each of the global variable and the local variable stored in the information tag 600 . In addition, the computer system 100 may detect errors in the dynamic memory area by monitoring call information of functions that are dynamically allocated, accessed, and deallocated in the heap memory area using the information tag 600 .

도 7은 본 개시의 일 실시예에 따른 메모리 오류 검출 시스템(700)의 구성 요소를 도시한 블록도이다. 메모리 오류 검출 시스템(700)은 컴퓨터 시스템 상에서 발생되는 메모리 오류를 검출하고, 메모리 오류의 원인을 분석하는 시스템으로서, 프로세서(110, 도 1 참조)에 의해 구현(implement)될 수 있다. 다만, 이에 한정되는 것은 아니고, 메모리 오류 검출 시스템(700)은 하드웨어 및 소프트웨어의 조합을 통해 구현될 수도 있다. 메모리 오류 검출 시스템(700)은 적어도 하나 이상의 기능을 수행하기 위한 모듈, 프로그램, 루틴(routine), 명령어 세트(sets of instructions), 및 프로세스 중 적어도 하나를 포함할 수 있다. 7 is a block diagram illustrating components of a memory error detection system 700 according to an embodiment of the present disclosure. The memory error detection system 700 is a system for detecting a memory error occurring in a computer system and analyzing the cause of the memory error, and may be implemented by a processor 110 (see FIG. 1 ). However, it is not limited thereto, and the memory error detection system 700 may be implemented through a combination of hardware and software. The memory error detection system 700 may include at least one of a module, a program, a routine, a set of instructions, and a process for performing at least one or more functions.

도 7을 참조하면, 메모리 오류 검출 시스템(700)은 애플리케이션(702), 라이브러리(704), 디바이스 드라이버(706), 및 운영 체제(708)를 포함할 수 있다. Referring to FIG. 7 , a memory error detection system 700 may include an application 702 , a library 704 , a device driver 706 , and an operating system 708 .

애플리케이션(702)은 역 어셈블러(disassembler)(712), 바이너리 분석기(714), 메모리 결함 모니터(716), 및 적어도 하나의 프로세스(P1 내지 Pn)를 포함할 수 있다. 역 어셈블러(712)는 라이브러리(704), 컴파일된 오브젝트 모듈, 공유 오브젝트 파일, 또는 독립 실행 파일 등의 바이너리 파일들의 정보를 제공하고, ELF 파일을 어셈블리어로 나타낼 수 있다. 또한, 일 실시예에서 역 어셈블러(712)는 Windows 운영체제에서의 PE 파일을 역 어셈블하여 바이너리 파일들의 정보를 제공할 수 있다. 예를 들어, 역 어셈블러(712)는 Objdump와 같은 프로그램으로 구현될 수 있으나, 이에 한정되지는 않는다. The application 702 may include a disassembler 712 , a binary analyzer 714 , a memory defect monitor 716 , and at least one process P 1 to P n . The disassembler 712 may provide information on binary files such as the library 704, a compiled object module, a shared object file, or an independent executable file, and express the ELF file in assembly language. Also, in one embodiment, the disassembler 712 may disassemble PE files in the Windows operating system and provide information on binary files. For example, the disassembler 712 may be implemented as a program such as Objdump, but is not limited thereto.

바이너리 분석기(714)는, 사용자 입력에 따라 애플리케이션이 실행되기 전에 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하도록 구성될 수 있다. 바이너리 분석 모듈(710)은 역 어셈블러(712)를 이용하여 애플리케이션의 실행 파일인 ELF 파일을 역 어셈블(disassemble)시켜 바이너리 분석기(714)에 전달하고, 바이너리 분석기(714)는 애플리케이션의 글로벌 변수 및 로컬 변수 각각의 주소(address)와 크기에 관한 정보를 추출할 수 있다. 일 실시예에서, 바이너리 분석기(714)는 애플리케이션의 실행 전에 미리 동작되도록 디폴트(default)로 설정될 수 있다. 바이너리 분석 모듈(710)은 추출된 글로벌 변수 및 로컬 변수의 주소와 크기에 관한 정보를 인포메이션 태그 저장부(734)에 저장할 수 있다. 바이너리 분석 모듈(710)은 도 1에 도시된 바이너리 분석 모듈(112)과 동일한 기능을 수행하는바, 중복되는 설명은 생략하기로 한다. The binary analyzer 714 may be configured to extract global and local variables of an application before the application is executed according to user input. The binary analysis module 710 disassembles the ELF file, which is an executable file of the application, using the disassembler 712 and transfers the disassembled file to the binary analyzer 714. Information about the address and size of each variable can be extracted. In one embodiment, the binary analyzer 714 may be set to default so that it is pre-activated prior to execution of the application. The binary analysis module 710 may store information about addresses and sizes of extracted global variables and local variables in the information tag storage unit 734 . The binary analysis module 710 performs the same function as the binary analysis module 112 shown in FIG. 1, and duplicate descriptions will be omitted.

메모리 결함 모니터(716)는 애플리케이션 실행 시의 함수의 호출 관계를 분석하고, 트레이스 로그(trace log) 및 크래쉬 로그(crash log)를 분석하여 메모리 오류의 원인을 분석할 수 있다. 트레이스 로그 및 크래쉬 로그에 관해서는 도 10의 설명 부분에서 상세하게 설명하기로 한다. The memory defect monitor 716 may analyze a cause of a memory error by analyzing function call relationships during application execution and analyzing a trace log and a crash log. The trace log and the crash log will be described in detail in the description of FIG. 10 .

일 실시예에서, 메모리 결함 모니터(716)는 결함 분석 모듈(720)에 의해 동작될 수 있다. 메모리 결함 모니터(716)는 인포메이션 태그 저장부(734)에 저장된 글로벌 변수 및 로컬 변수 정보에 기초하여 메모리의 글로벌 영역 및 스택 영역에서의 결함 정보를 분석할 수 있다. 또한, 메모리 결함 모니터(716)는 애플리케이션의 실행 시 메모리의 Heap 영역에 할당, 접근, 및 해제되는 함수 호출 정보에 기초하여 수집된 콜 스택 정보(Call Stack)를 통해 동적 메모리 결함 정보를 분석할 수 있다. 메모리 결함 모니터(716)는 메모리 오류가 어느 위치에서 발생되었는지, 또는 메모리 세팅(setting), 버퍼 오류, 참조 번지 오류 등을 포함하는 메모리 오류의 원인을 분석할 수 있다.In one embodiment, memory defect monitor 716 may be operated by defect analysis module 720 . The memory defect monitor 716 may analyze defect information in the global area and the stack area of the memory based on global variable and local variable information stored in the information tag storage unit 734 . In addition, the memory defect monitor 716 may analyze dynamic memory defect information through call stack information collected based on function call information allocated, accessed, and released in the heap area of memory during application execution. there is. The memory defect monitor 716 may analyze the location where the memory error occurred or the cause of the memory error including memory setting, buffer error, reference address error, and the like.

프로세스(process)는 컴퓨터 시스템 상에서 실행되는 애플리케이션의 단위를 의미할 수 있다. 예를 들어, 문서 작성 애플리케이션 프로그램의 실행 창 하나를 의미할 수 있다. 애플리케이션(702)은 적어도 하나의 프로세스(P1 내지 Pn)를 포함할 수 있다. A process may refer to a unit of an application executed on a computer system. For example, it may mean one execution window of a document writing application program. Application 702 can include at least one process P 1 to P n .

라이브러리(704)는 적어도 하나의 프로세스(P1 내지 Pn)가 공통적으로 필요로 하는 기능을 제공할 수 있다. 라이브러리(704)는 예를 들어 적어도 하나의 프로세스(P1 내지 Pn)의 입출력 관리, 메모리 관리, 또는 함수 호출에 관한 기능 등을 수행할 수 있다. The library 704 may provide functions commonly required by at least one process P 1 to P n . The library 704 may perform, for example, functions related to input/output management, memory management, or function calls of at least one process (P 1 to P n ).

라이브러리(704)는 모니터링 라이브러리(MMonitor.so)(732) 및 사용자 부(742)를 포함할 수 있다. 모니터링 라이브러리(732)는 프로세스(P1 내지 Pn 중 어느 하나)가 실행됨에 따라 호출되고, 프로세스에 의해 메모리의 Heap 영역에 할당, 접근, 및 해제되는 함수 호출 정보를 추적할 수 있다. 일 실시예에서, 모니터링 라이브러리(732)는 결함 탐지 모듈(730)에 의해 호출될 수 있다. 일 실시예에서, 결함 탐지 모듈(730)은 메모리의 Heap 영역에 할당, 접근, 및 해제되는 함수 호출 정보를 인포메이션 태그 저장부(734)에 저장할 수 있다. 여기에서, 결함 탐지 모듈(730)은 인포메이션 태그 저장부(734)를 포함한다는 점을 제외하고는 도 1에 도시된 결함 탐지 모듈(116)과 동일한 기능을 수행하는바, 중복되는 설명은 생략하기로 한다. The library 704 may include a monitoring library (MMonitor.so) 732 and a user part 742 . The monitoring library 732 is called as the process (P 1 to P n ) is executed, and can track function call information allocated, accessed, and released from the heap area of memory by the process. In one embodiment, monitoring library 732 may be called by fault detection module 730 . In an embodiment, the defect detection module 730 may store, in the information tag storage unit 734, function call information allocated, accessed, and released in a heap area of memory. Here, the defect detection module 730 performs the same function as the defect detection module 116 shown in FIG. 1 except that it includes the information tag storage unit 734, and redundant descriptions are omitted. do it with

사용자 부(742)는 디바이스 드라이버(706)를 제어하는 기능을 수행할 수 있다. 일 실시예에서, 사용자 부(742)는 적어도 하나의 프로세스(P1 내지 Pn) 중 어느 하나의 프로세스에서 크래쉬(crach)가 발생하는 경우 커널부(744)의 제어에 따라 콜 스택(Call Stack) 정보를 수집할 수 있다. 이에 대해서는 도 10의 설명 부분에서 구체적으로 설명하기로 한다.The user unit 742 may perform a function of controlling the device driver 706 . In one embodiment, when a crash occurs in any one of the at least one process (P 1 to P n ), the user unit 742 calls a call stack under the control of the kernel unit 744. ) information can be collected. This will be described in detail in the description of FIG. 10 .

디바이스 드라이버(706)는 커널부(744)를 포함할 수 있다. 커널부(744)는 메모리의 글로벌 영역, 스택 영역, 및 Heap 영역을 포함하는 메모리의 전체적인 상황 및 시스템 자원 현황을 모니터링할 수 있다. 커널부(744)는 커널(kernel)에서 크래쉬가 발생되는 경우 커널 크래쉬 정보를 수집하고, 수집된 커널 크래쉬 정보를 로그 형태로 저장할 수 있다. The device driver 706 may include a kernel portion 744 . The kernel unit 744 may monitor the overall status of the memory including the global area, the stack area, and the heap area of the memory and the status of system resources. The kernel unit 744 may collect kernel crash information when a crash occurs in the kernel and store the collected kernel crash information in a log form.

일 실시예에서, 사용자 부(742) 및 커널부(744)는 크래쉬 모니터링 모듈(740)에 의해 동작될 수 있다. 크래쉬 모니터링 모듈(740)은 도 1에 도시된 크래쉬 모니터링 모듈(118)과 동일한 기능을 수행하는바, 중복되는 설명은 생략하기로 한다. In one embodiment, user part 742 and kernel part 744 may be operated by crash monitoring module 740 . The crash monitoring module 740 performs the same function as the crash monitoring module 118 shown in FIG. 1, and thus, duplicate descriptions will be omitted.

운영 체제(708)는 리눅스(Linux), 유닉스(UNIX), 및 윈도우(Windows) 중 어느 하나일 수 있으나, 나열된 예시로 한정되는 것은 아니다. The operating system 708 may be any one of Linux, UNIX, and Windows, but is not limited to the listed examples.

도 8은 본 개시의 일 실시예에 따른 컴퓨터 시스템이 메모리의 글로벌 영역, 스택 영역 및 Heap 영역 중 적어도 하나의 영역에서의 메모리 결함을 검출하는 방법을 도시한 흐름도이다. 8 is a flowchart illustrating a method of detecting a memory defect in at least one of a global area, a stack area, and a heap area of a memory by a computer system according to an embodiment of the present disclosure.

단계 S810에서, 컴퓨터 시스템은 애플리케이션의 글로벌 변수 및 로컬 변수를 추출한다. 일 실시예에서, 컴퓨터 시스템은 애플리케이션이 실행되기 전에 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는 바이너리 분석기(Analyer)를 먼저 실행되도록 설정하고, 실행된 바이너리 분석기를 통해 애플리케이션의 글로벌 변수 및 로컬 변수를 추출할 수 있다. 일 실시예에서, 컴퓨터 시스템은 애플리케이션의 ELF 파일의 코드를 분석하여 애플리케이션의 글로벌 변수 및 로컬 변수 각각의 주소(address), 크기, 호출 함수 중 적어도 하나를 추출할 수 있다. In step S810, the computer system extracts global variables and local variables of the application. In one embodiment, the computer system first sets a binary analyzer that extracts global variables and local variables of the application to be executed before the application is executed, and extracts the global variables and local variables of the application through the executed binary analyzer. can do. In one embodiment, the computer system may analyze the code of the ELF file of the application to extract at least one of the address, size, and call function of each of the global variable and the local variable of the application.

일 실시예에서, 컴퓨터 시스템은 추출된 글로벌 변수 및 로컬 변수를 인포메이션 태그 저장부(information tag repository)에 저장할 수 있다.In one embodiment, the computer system may store the extracted global variables and local variables in an information tag repository.

단계 S820에서, 컴퓨터 시스템은 애플리케이션을 실행한다. 애플리케이션은 사용자의 실행 지시가 입력됨에 따라 실행될 수 있다. 하나의 애플리케이션이 실행되면 컴퓨터 시스템은 하나의 프로세스(process)로 인식할 수 있다. 즉, 프로세스는 컴퓨터 시스템 상에서 실행되는 애플리케이션의 단위를 의미할 수 있다. 예를 들어, 문서 작성 애플리케이션 프로그램의 실행 창 하나를 의미할 수 있다. At step S820, the computer system runs the application. The application may be executed according to a user's execution instruction being input. When one application is executed, the computer system can recognize it as one process. That is, a process may mean a unit of an application executed on a computer system. For example, it may mean one execution window of a document writing application program.

단계 S830에서, 컴퓨터 시스템은 메모리의 Heap 영역에서 동적으로 할당, 접근, 및 해제되는 동적 메모리 정보를 모니터링한다. 일 실시예에서, 컴퓨터 시스템은 단계 S820에서 실행된 애플리케이션에 의해 프로세스가 수행되는 즉시 라이브러리에서 MMonitoring.so를 호출하고, 호출된 MMonitoring.so를 이용하여 메모리의 Heap 영역에 할당, 접근, 및 해제되는 함수 호출 정보를 추적(trace)할 수 있다. 일 실시예에서, 컴퓨터 시스템은 DBI(Dynamic Binary Injection) 기법을 이용하여 프로세스 수행 중에 메모리의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 동적 메모리 정보를 모니터링할 수 있다. In step S830, the computer system monitors dynamic memory information that is dynamically allocated, accessed, and deallocated in the heap area of memory. In one embodiment, the computer system calls MMonitoring.so from the library as soon as the process is performed by the application executed in step S820, and allocates, accesses, and frees the heap area of memory using the called MMonitoring.so. You can trace function call information. In one embodiment, a computer system may monitor dynamic memory information that is dynamically allocated, accessed, and released from a heap area of a memory during process execution by using a dynamic binary injection (DBI) technique.

단계 S840에서, 컴퓨터 시스템은 메모리의 글로벌 영역, 스택 영역, 및 Heap 영역 중 적어도 하나의 영역에서의 메모리 결함을 검출한다. 일 실시예에서, 컴퓨터 시스템은 인포메이션 태그 저장부에 저장된 애플리케이션의 글로벌 변수 및 로컬 변수 각각의 주소, 크기, 및 호출함수 중 적어도 하나에 기초하여 글로벌 영역 및 스택 영역에서의 결함을 탐지할 수 있다. 일 실시예에서, 컴퓨터 시스템은 DBI 기법을 이용하여 메모리의 Heap 영역에서의 함수 호출을 모니터링하여 동적 메모리 영역에서의 결함을 검출할 수 있다. In step S840, the computer system detects a memory defect in at least one of the global area, the stack area, and the heap area of the memory. In one embodiment, the computer system may detect a defect in the global area and the stack area based on at least one of an address, a size, and a call function of each of a global variable and a local variable of an application stored in the information tag storage unit. In one embodiment, the computer system may detect defects in the dynamic memory area by monitoring function calls in the heap area of memory using the DBI technique.

도 9는 본 개시의 일 실시예에 따른 컴퓨터 시스템이 시그널 핸들러를 교체하여 동적 메모리 영역의 오류의 원인을 검출하고, 이를 분석하는 방법을 도시한 흐름도이다.9 is a flowchart illustrating a method of detecting and analyzing a cause of an error in a dynamic memory area by replacing a signal handler by a computer system according to an embodiment of the present disclosure.

단계 S910에서, 컴퓨터 시스템은 커널(kernel)의 시그널 핸들러(signal handler)를 애플리케이션에 의한 크래쉬 발생을 모니터링 하는 시그널 핸들러로 교체한다. 일 실시예에서, 컴퓨터 시스템은 사용자 모드(user mode)에서 애플리케이션이 실행되기 전에 시그널 핸드러를 미리 교체할 것을 커널에 요청할 수 있다. 이 경우, 커널은 기설정된 시그널 핸들러를 애플리케이션에 크래쉬가 발생된 시점의 메모리 정보 및 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체할 수 있다. In step S910, the computer system replaces a signal handler of a kernel with a signal handler that monitors the occurrence of a crash by an application. In one embodiment, the computer system may request the kernel to replace the signal handler in advance before the application is executed in user mode. In this case, the kernel can replace the preset signal handler with a signal handler that monitors memory information at the time when the application crashes and memory defect information until before the crash occurs.

단계 S920에서, 컴퓨터 시스템은 교체된 시그널 핸들러를 호출한다. 컴퓨터 시스템 상에서 실행되는 애플리케이션에 의한 프로세스 동작 도중 메모리 커럽션(memory corruption) 등으로 인한 크래쉬(crash)가 발생되면 커널에서 단계 S910에서 교체된 시그널 핸들러가 대신 호출된다. 즉, 커널은 프로세스에 크래쉬가 발생했다는 신호(signal)에 응답하여 교체된 시그널 핸들러를 호출할 수 있다. In step S920, the computer system calls the replaced signal handler. When a crash occurs due to memory corruption or the like during a process operation by an application running on the computer system, the signal handler replaced in step S910 is called in the kernel instead. That is, the kernel can call the replaced signal handler in response to a signal that a process has crashed.

단계 S930에서, 컴퓨터 시스템은 콜 스택(Call Stack) 정보를 수집한다. 일 실시예에서, 컴퓨터 시스템은 커널에서 호출된 시그널 핸들러를 이용하여 프로세스에서 발생된 크래쉬와 관련된 정보를 분석할 수 있는 콜 스택 정보를 수집할 수 있다. 콜 스택 정보는 프로세스에 의해 메모리에 변수를 할당하거나, 접근, 해제하는 함수 호출에 관한 이력 정보(history)를 의미할 수 있다. In step S930, the computer system collects call stack information. In one embodiment, the computer system may use a signal handler called from the kernel to collect call stack information capable of analyzing information related to a crash occurring in a process. The call stack information may refer to history of function calls for allocating, accessing, or releasing variables in memory by a process.

단계 S940에서, 컴퓨터 시스템은 수집된 콜 스택 정보에 기초하여 메모리 오류의 원인을 분석한다. 일 실시예에서, 컴퓨터 시스템은 수집된 콜 스택 정보에 기초하여 동적 메모리 영역의 오류 발생 위치, 메모리 세팅(setting), 버퍼 오류, 참조 번지 오류 등을 포함하는 메모리 오류의 원인을 분석할 수 있다. In step S940, the computer system analyzes the cause of the memory error based on the collected call stack information. In one embodiment, the computer system may analyze the cause of the memory error, including an error occurrence location in a dynamic memory area, a memory setting, a buffer error, a reference address error, and the like, based on the collected call stack information.

일 실시예에서, 컴퓨터 시스템은 콜 스택 정보를 통해 획득한 메모리 오류 원인 정보를 애플리케이션 크래쉬 로그(application crash log)로 저장할 수 있다.In one embodiment, the computer system may store memory error cause information acquired through call stack information as an application crash log.

도 10은 본 개시의 일 실시예에 따른 컴퓨터 시스템이 애플리케이션으로 인한 메모리 오류를 검출하는 방법을 도시한 흐름도이다. 도 10을 참조하면, 컴퓨터 시스템의 오류 검출 모드는, 애플리케이션을 실행하고, 실행된 애플리케이션에 의한 메모리 오류를 검출하는 사용자 모드(1001) 및 애플리케이션에서 구현되는 동작 또는 기능을 실행하는데 사용되는 시스템 리소스를 제어/관리하는 커널 모드(1002)를 포함할 수 있다. 커널 모드는 리눅스(Linux) 또는 유닉스(UNIX)와 같은 운영 체제에서 동작되는 모드일 수 있다. 그러나, 커널 모드가 동작되는 운영 체제가 리닉스 또는 유닉스로 한정되는 것은 아니다. 10 is a flowchart illustrating a method for a computer system to detect a memory error due to an application according to an embodiment of the present disclosure. Referring to FIG. 10 , an error detection mode of a computer system includes a user mode 1001 that executes an application and detects a memory error by the executed application, and system resources used to execute an operation or function implemented in the application. A kernel mode 1002 for controlling/managing may be included. The kernel mode may be a mode operated in an operating system such as Linux or UNIX. However, the operating system in which the kernel mode operates is not limited to Linux or Unix.

단계 S1011에서, 컴퓨터 시스템은 애플리케이션의 글로벌 변수 및 로컬 변수를 추출한다. 일 실시예에서, 컴퓨터 시스템은 애플리케이션이 실행되기 전에 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는 바이너리 분석기를 먼저 실행하고, 실행된 바이너리 분석기를 통해 애플리케이션의 글로벌 변수 및 로컬 변수를 추출할 수 있다. 일 실시예에서, 컴퓨터 시스템은 애플리케이션의 ELF 파일의 코드를 분석하여 애플리케이션의 글로벌 변수와 로컬 변수 각각의 주소(address), 크기, 호출 함수 중 적어도 하나를 분석할 수 있다. In step S1011, the computer system extracts global variables and local variables of the application. In one embodiment, the computer system may first execute a binary analyzer that extracts global variables and local variables of the application before the application is executed, and extracts the global variables and local variables of the application through the executed binary analyzer. In one embodiment, the computer system may analyze the code of the ELF file of the application to analyze at least one of the address, size, and call function of each of the global variable and the local variable of the application.

단계 S1012에서, 컴퓨터 시스템은 추출된 애플리케이션의 글로벌 변수 및 로컬 변수를 인포메이션 태그 저장부(information tag repository)(1050)에 저장한다. 인포메이션 태그 저장부(1050)는 글로벌 변수 및 로컬 변수 각각의 주소 및 크기에 관한 정보를 저장할 수 있다. 단계 S1011 및 단계 S1012는 바이너리 분석 모듈(1010)에 의해 수행될 수 있다. 바이너리 분석 모듈(1010)은 도 1에 도시된 바이너리 분석 모듈(112)과 동일한 기능을 수행하는바, 중복되는 설명은 생략하기로 한다.In step S1012, the computer system stores the global and local variables of the extracted application in the information tag repository 1050. The information tag storage unit 1050 may store information about addresses and sizes of global variables and local variables, respectively. Steps S1011 and S1012 may be performed by the binary analysis module 1010. The binary analysis module 1010 performs the same function as the binary analysis module 112 shown in FIG. 1, and duplicate descriptions will be omitted.

단계 S1013에서, 컴퓨터 시스템은 크래쉬 모니터링 모듈(crash monitoring module)을 커널에 삽입(injection)한다. In step S1013, the computer system injects a crash monitoring module into a kernel.

단계 S1014에서, 컴퓨터 시스템은 시그널 핸들러(signal handler)를 교체할 것을 커널에 요청하고, 단계 S1041에서 커널은 시그널 핸들러를 교체한다. 일 실시예에서, 사용자 모드(1001)에서는 커널의 시그널 핸들러를 애플리케이션에 의한 크래쉬 발생을 모니터링하는 시그널 핸들러로 교체할 것을 커널에 요청할 수 있다. 사용자 모드(1001)의 시그널 핸들러 교체 요청은 애플리케이션이 실행되는 단계(S1015) 이전에 수행될 수 있다. 즉, 컴퓨터 시스템은 사용자 모드(1001)에서 애플리케이션이 실행되기 전에 시그널 핸드러를 미리 교체할 것을 커널에 요청할 수 있다. In step S1014, the computer system requests the kernel to replace the signal handler, and in step S1041, the kernel replaces the signal handler. In one embodiment, the user mode 1001 may request the kernel to replace a signal handler of the kernel with a signal handler that monitors the occurrence of a crash by an application. The signal handler replacement request in the user mode 1001 may be performed before the application execution step (S1015). That is, the computer system may request the kernel to replace the signal handler in advance before the application is executed in the user mode 1001 .

이 경우, 커널은 기설정된 시그널 핸들러를 애플리케이션에 크래쉬가 발생된 시점의 메모리 정보 및 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체할 수 있다(단계 S1041).In this case, the kernel may replace the preset signal handler with a signal handler that monitors memory information at the time the application crashes and memory defect information until before the crash occurs (step S1041).

단계 S1015에서, 컴퓨터 시스템은 애플리케이션을 실행한다. 애플리케이션은 사용자 모드(1001)에서 사용자의 실행 지시가 입력됨에 따라 실행될 수 있다. 하나의 애플리케이션이 실행되면 컴퓨터 시스템은 하나의 프로세스(process)로 인식할 수 있다. 즉, 프로세스는 컴퓨터 시스템 상에서 실행되는 애플리케이션의 단위를 의미할 수 있다. In step S1015, the computer system runs the application. The application may be executed according to a user's execution instruction input in the user mode 1001 . When one application is executed, the computer system can recognize it as one process. That is, a process may mean a unit of an application executed on a computer system.

단계 S1031에서, 컴퓨터 시스템은 DBI(Dynamic Binary Injection) 방법을 통해 동적 메모리 영역의 할당, 해제, 접근 함수의 호출 정보를 수집한다. 일 실시예에서, 컴퓨터 시스템은 사용자 모드(1001)에서 애플리케이션이 실행되는 즉시 라이버러리에서 MMonitoring.so를 호출하고, 호출된 MMonitoring.so를 이용하여 메모리의 Heap 영역에 할당, 접근, 및 해제되는 함수 호출 정보를 추적(trace)할 수 있다. 일 실시예에서, 컴퓨터 시스템은 함수 호출 정보를 인포메이션 태그 저장부(1050)에 저장할 수 있다. 이 경우, 인포메이션 태그 저장부(1050)는 글로벌 변수 및 로컬 변수를 포함하는 정적 메모리 정보 뿐만 아니라, 동적으로 할당, 접근, 해제되는 Heap 영역의 정보(예를 들어, 주소, 크기, 할당 함수 콜 스택, 해제 함수 콜 스택, 할당 함수 유형)를 저장할 수 있다. In step S1031, the computer system collects call information of allocation, release, and access functions of a dynamic memory area through a dynamic binary injection (DBI) method. In one embodiment, the computer system calls MMonitoring.so from the library as soon as the application is executed in the user mode 1001, and calls functions that allocate, access, and deallocate the heap area of memory using the called MMonitoring.so. information can be traced. In one embodiment, the computer system may store function call information in the information tag storage 1050 . In this case, the information tag storage unit 1050 stores not only static memory information including global and local variables, but also dynamically allocated, accessed, and released heap area information (eg, address, size, and allocation function call stack). , free function call stack, allocation function type).

단계 S1032에서, 컴퓨터 시스템은 글로벌 영역, 스택 영역, 및 Heap 영역의 메모리 결함을 검출한다. 일 실시예에서, 컴퓨터 시스템은 DBI 방법을 이용하여 애플리케이션의 실행에 의해 메모리의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 동적 메모리 정보를 모니터링하고, Heap 영역에서의 메모리 결함을 탐지할 수 있다. In step S1032, the computer system detects memory defects in the global area, the stack area, and the Heap area. In one embodiment, the computer system may use the DBI method to monitor dynamic memory information that is dynamically allocated, accessed, and deallocated in a heap area of memory by execution of an application, and detect a memory defect in the heap area.

일 실시예에서, 컴퓨터 시스템은 인포메이션 태그 저장부(1050)에 저장된 애플리케이션의 글로벌 변수 및 로컬 변수 각각의 주소, 크기, 및 호출함수 중 적어도 하나에 기초하여 글로벌 영역 및 스택 영역에서의 결함을 탐지할 수 있다. In one embodiment, the computer system detects defects in the global area and the stack area based on at least one of the address, size, and call function of each of the global variable and the local variable of the application stored in the information tag storage unit 1050. can

컴퓨터 시스템은 메모리의 할당, 접근, 및 해제 관련 함수가 실행되는 경우, 인포메이션 태그 저장부(1050)에 저장된 메모리 주소 정보 또는 크기 정보를 이용하여 메모리의 결함을 검출할 수 있다. 예를 들어, 컴퓨터 시스템은 메모리 할당 함수의 파라미터 중 할당 크기에 해당하는 파라미터의 값이 ‘0’인 경우(zero-size 메모리 할당), 메모리 할당 함수의 실행 결과가 NULL인 경우(메모리 할당 실패), 및 애플리케이션이 종료된 이후 해제되지 않은 동적 메모리 할당이 있는 경우(메모리 누수) 중 적어도 하나의 경우 메모리 할당과 관련된 결함이 있는 것으로 판단할 수 있다. When functions related to memory allocation, access, and release are executed, the computer system may detect defects in the memory using memory address information or size information stored in the information tag storage unit 1050 . For example, in a computer system, when the value of the parameter corresponding to the allocation size among the parameters of the memory allocation function is '0' (zero-size memory allocation), when the execution result of the memory allocation function is NULL (memory allocation failure) It may be determined that there is a defect related to memory allocation in the case of at least one of , and a case in which there is dynamic memory allocation that is not freed after the application is terminated (memory leak).

또한, 컴퓨터 시스템은 메모리 접근 함수의 주소 파라미터 값이 NULL인 경우(NULL 포인터 접근), 접근하고자 하는 포인터에 대한 인포메이션 태그의 해제 flag 값이 설정되어 있는 경우(해제된 포인터 접근), 접근하고자 하는 포인터에 대한 인포메이션 태그가 존재하지 않고, 스택 주소 공간에 해당되지 않는 경우(할당되지 않은 포인터 접근), 접근하고자 하는 포인터에 대한 인포메이션 태그의 할당 크기의 범위를 벗어나는 경우(할당 범위를 벗어난 접근), 및 문자열 함수의 소스(source)에 해당되는 문자열에 '\0' 처리가 되어 있지 않은 경우(다른 변수의 메모리 공간과 충돌) 중 적어도 하나의 경우에 메모리 접근과 관련된 결함이 있는 것으로 판단할 수 있다. In addition, the computer system sets the pointer to be accessed when the address parameter value of the memory access function is NULL (NULL pointer access), when the release flag value of the information tag for the pointer to be accessed is set (released pointer access) If the information tag for does not exist and does not correspond to the stack address space (unallocated pointer access), if the information tag for the pointer to be accessed is out of the range of the allocation size (out of allocation range access), and It can be determined that there is a defect related to memory access in at least one case among cases where '\0' is not processed in the string corresponding to the source of the string function (collision with memory space of other variables).

또한, 컴퓨터 시스템은 메모리 해제 함수의 파라미터 값이 NULL인 경우(NULL 포인터 해제), 인포메이션 태그 저장부(1050) 내에 인포메이션 태그가 존재하지 않거나, 할당 flag의 값이 정적 할당에 해당하는 경우(할당되지 않은 포인터 해제), 인포메이션 태그의 할당 함수 유형 flag 값이 해제 함수의 유형과 불일치하는 경우(할당/해제 불일치), 및 인포메이션 태그에 해제 flag가 설정되어 있는 경우(해제된 메모리 재해제) 중 적어도 하나의 경우에 메모리 해제와 관련된 결함이 있는 것으로 판단할 수 있다. In addition, the computer system is configured when the parameter value of the memory release function is NULL (NULL pointer release), when the information tag does not exist in the information tag storage unit 1050, or when the value of the allocation flag corresponds to static allocation (not allocated). pointer free), when the allocation function type flag value of the information tag does not match the type of the free function (allocation/freeing mismatch), and when the freeing flag is set in the information tag (freed memory freeing). In the case of , it can be determined that there is a defect related to memory release.

단계 S1033에서, 컴퓨터 시스템은 검출된 메모리 결함 정보를 트레이스 로그(1060)에 저장하고, 애플리케이션을 종료한다. 트레이스 로그(trace log)(1060)에는 메모리의 글로벌 영역 및 스택 영역은 물론이고, Heap 영역에서의 메모리 결함 정보를 저장하고 있을 수 있다. In step S1033, the computer system stores the detected memory defect information in the trace log 1060 and terminates the application. The trace log 1060 may store memory defect information in the global and stack areas of the memory as well as in the heap area.

단계 S1031 내지 단계 S1033은 결함 탐지 모듈(1030)에 의해 수행될 수 있다. 결함 탐지 모듈(1030)은 도 1에 도시된 결함 탐지 모듈(116)과 동일한 기능을 수행하는바, 중복되는 설명은 생략하기로 한다. Steps S1031 to S1033 may be performed by the defect detection module 1030 . The defect detection module 1030 performs the same function as the defect detection module 116 shown in FIG. 1, and duplicate descriptions thereof will be omitted.

단계 S1042에서, 컴퓨터 시스템은 커널 모드(1002)에서 교체된 시그널 핸들러를 호출한다. 커널 모드(1002)는 사용자 모드(1001)에서 실행된 애플리케이션에서 메모리 커럽션(memory corruption) 등으로 인하여 애플리케이션에 크래쉬가 발생하였다는 시그널(signal)에 따라 단계 S1041에서 교체된 시그널 핸들러를 호출할 수 있다. In step S1042, the computer system calls the signal handler replaced in kernel mode 1002. The kernel mode 1002 may call the signal handler replaced in step S1041 according to a signal that a crash has occurred in the application due to memory corruption or the like in the application executed in the user mode 1001. there is.

단계 S1043에서, 컴퓨터 시스템은 콜 스택(Call Stack) 정보를 수집한다. 일 실시예에서, 컴퓨터 시스템은 커널 모드(1002)에서 호출된 시그널 핸들러를 이용하여 애플리케이션에서 발생된 크래쉬와 관련된 정보를 분석할 수 있는 콜 스택 정보를 수집할 수 있다. 콜 스택 정보는 애플리케이션에 의해 메모리 상에 변수를 할당하거나, 접근, 해제하는 함수 호출에 관한 이력 정보(history)를 의미할 수 있다. In step S1043, the computer system collects call stack information. In one embodiment, a computer system may use a signal handler called in kernel mode 1002 to collect call stack information that can analyze information related to a crash that has occurred in an application. The call stack information may refer to history of function calls for allocating, accessing, or releasing variables in memory by an application.

단계 S1044에서, 컴퓨터 시스템은 수집된 콜 스택 정보를 애플리케이션 크래쉬 로그(application crash log)(1071)에 저장한다. 애플리케이션 크래쉬 로그(1071)는 사용자 모드(1001)에서 실행된 애플리케이션에 의해 발생된 크래쉬와 관련된 콜 스택 정보를 저장할 수 있다. In step S1044, the computer system stores the collected call stack information in an application crash log 1071. The application crash log 1071 may store call stack information related to a crash caused by an application executed in the user mode 1001 .

단계 S1045에서, 커널은 커널 내에서 자체적으로 발생된 크래쉬와 관련된 분석 데이터를 수집한다. 커널 자체에서 발생되는 크래쉬는, 애플리케이션이 커널에 메모리 자원을 요청할 때 요청을 커널에서 수행될 수 없는 경우 발생될 수 있다. 예를 들어, 애플리케이션이 시스템 메모리에 접근하려고 하거나, 변수의 크기를 초과하여 변수를 할당하려고 하는 경우 등에서 커널 상에 크래쉬가 발생될 수 있다. 커널 모드(1002)에서는 크래쉬와 관련된 커널의 상태 정보, 예를 들어 글로벌 영역, 스택 영역, 및 Heap 영역을 포함하는 전체 메모리의 현재 상태 정보 또는 시스템의 자원 상황에 관련된 정보를 수집할 수 있다. In step S1045, the kernel collects analysis data related to crashes that have occurred within the kernel itself. A crash that occurs in the kernel itself can occur when an application requests memory resources from the kernel and the request cannot be performed by the kernel. For example, a crash may occur in the kernel when an application tries to access system memory or allocates a variable exceeding the size of the variable. In the kernel mode 1002, kernel state information related to a crash, eg, current state information of the entire memory including the global area, stack area, and heap area, or information related to the resource status of the system may be collected.

단계 S1046에서, 컴퓨터 시스템은 커널 크래쉬 로그(kernel crash log)(1072)에 크래쉬 분석 데이터를 저장하고, 종료된다. 커널 크래쉬 로그(1072)는 커널과 관련된 크래쉬 정보, 즉 수집된 시점에서의 전체 메모리의 상태 정보 또는 시스템의 자원 상황에 관련된 정보를 저장할 수 있다. 단계 S1046에서 종료되는 것은 커널 자체로써, 애플리케이션이 종료되는 단계 S1033 및 S1044와는 다르다. In step S1046, the computer system stores the crash analysis data in a kernel crash log 1072 and ends. The kernel crash log 1072 may store crash information related to the kernel, that is, state information of the entire memory at the time of collection or information related to the resource status of the system. What ends in step S1046 is the kernel itself, which is different from steps S1033 and S1044 in which applications end.

단계 S1041 내지 단계 S1046은 크래쉬 모니터링 모듈(1040)에 의해 수행될 수 있다. 크래쉬 모니터링 모듈(1040)은 도 1에 도시된 크래쉬 모니터링 모듈(118)과 동일한 기능을 수행하는바, 중복되는 설명은 생략하기로 한다. Steps S1041 to S1046 may be performed by the crash monitoring module 1040. The crash monitoring module 1040 performs the same function as that of the crash monitoring module 118 shown in FIG. 1, and duplicate descriptions will be omitted.

단계 S1021에서, 컴퓨터 시스템은 트레이스 로그(1060) 및 애플리케이션 크래쉬 로그(1071)에 저장된 정보에 기초하여 메모리 오류의 원인을 분석한다. 일 실시예에서, 컴퓨터 시스템은 트레이스 로그(1060)에 저장되어 있는 메모리의 글로벌 영역, 스택 영역, 및 Heap 영역에서의 메모리 결함 정보와 애플리케이션 크래쉬 로그(1071)에 저장되어 있는 콜 스택 정보를 통해 정적 및 동적 메모리의 오류 원인을 분석할 수 있다. 일 실시예에서, 컴퓨터 시스템은 메모리의 오류 발생 위치, 메모리 세팅(setting), 버퍼 오류, 참조 번지 오류 등의 메모리 오류 원인을 분석할 수 있다. In step S1021, the computer system analyzes the cause of the memory error based on the information stored in the trace log 1060 and the application crash log 1071. In one embodiment, the computer system provides static static information through memory defect information in the global, stack, and heap areas of memory stored in the trace log 1060 and call stack information stored in the application crash log 1071. And the cause of error in dynamic memory can be analyzed. In one embodiment, the computer system may analyze the cause of the memory error, such as a memory error occurrence location, memory setting, buffer error, reference address error, and the like.

단계 S1022에서, 컴퓨터 시스템은 메모리 오류의 분석 결과를 출력한다. In step S1022, the computer system outputs the analysis result of the memory error.

도 11a는 할당되지 않은 포인터의 해제 결함으로 인한 메모리 오류를 분석하기 위한 프로그램 코드의 일 례를 도시한 도면이고, 도 11b는 인포메이션 태그 저장부에 저장된 메모리 정보를 도식화한 도면이다.11A is a diagram showing an example of a program code for analyzing a memory error due to a release defect of an unallocated pointer, and FIG. 11B is a diagram illustrating memory information stored in an information tag storage unit.

도 11a는 테스트 코드(1110)로서, 할당 함수인 malloc으로 동적 할당받아 사용하던 포인터 bufp를 종료 전에 해제하여야 하는데, 글로벌 변수 buf가 해제 함수에 잘못 들어간 예를 도시한 도면이다. 일 실시예에서, 컴퓨터 시스템은 바이너리 분석을 통해 테스트 코드(1110) 분석을 하게 되며, 이를 통해 인포메이션 태그 저장부에 buf에 대한 정보(주소 0x00010070, 크기 0x64)를 저장할 수 있다. 테스트 코드(1110)의 분석을 통해 buf에 관한 정보를 추출하고, 추출된 정보를 인포메이션 태그 저장부에 저장하는 동작들은 바이너리 분석 모듈(112, 도 1 참조)에 의해 수행될 수 있다.FIG. 11A is a test code 1110, which shows an example in which the pointer bufp, which was dynamically allocated and used by the allocation function malloc, must be freed before termination, but the global variable buf is incorrectly entered into the free function. In one embodiment, the computer system analyzes the test code 1110 through binary analysis, and through this, information on buf (address 0x00010070, size 0x64) can be stored in the information tag storage unit. Operations of extracting information about buf through analysis of the test code 1110 and storing the extracted information in the information tag storage unit may be performed by the binary analysis module 112 (see FIG. 1 ).

컴퓨터 시스템은 인포메이션 태깅(Information Tagging)을 이용하여 메모리 영역에서의 결함을 탐지한다. 컴퓨터 시스템은 tc_free_main 함수에서 메모리 관련 함수가 실행될 때마다 에이전트에서 정보를 수집할 수 있다. 일 실시예에서, 결함 탐지 모듈(116, 도 1 참조)은 테스트 코드(1110)의 4번째 줄에 기재된 'int* bufp = (int*)malloc(sizeof(int))' 구문(1112)의 malloc 함수가 호출될 때 에이전트의 malloc 함수를 먼저 호출할 수 있다. 상기 구문(1112)의 경우 할당 파라미터 값에는 문제가 없으므로, 결함 탐지 모듈(116)은 원래의 malloc 함수를 호출하고, 그 결과가 NULL 값이 아닌 경우 인포메이션 태그 저장부에 저장할 수 있다. A computer system uses information tagging to detect defects in a memory area. The computer system can collect information from the agent whenever a memory-related function is executed in the tc_free_main function. In one embodiment, the defect detection module 116 (see FIG. 1) is a malloc of 'int* bufp = (int*)malloc(sizeof(int))' statement 1112 described in line 4 of the test code 1110. When the function is called, the agent's malloc function can be called first. In the case of the syntax 1112, since there is no problem with the assigned parameter value, the defect detection module 116 calls the original malloc function, and if the result is not a NULL value, it can be stored in the information tag storage unit.

바이너리 분석 모듈(112) 및 결함 탐지 모듈(116)에 의해 인포메이션 태그 저장부(1120)에 저장된 정보는 도 11b와 같다. Information stored in the information tag storage unit 1120 by the binary analysis module 112 and the defect detection module 116 is shown in FIG. 11B.

컴퓨터 시스템은 테스트 코드(1110)의 6번째 줄의 free 구문(1114) 호출 시 에이전트의 free 함수를 호출할 수 있다. 이 경우, 해제하고자 하는 메모리 주소가 buf의 주소인 0x10070으로 넘어오게 되고, 에이전트에서는 인포메이션 태그 저장부를 탐색하여 해당 값의 존재 여부를 확인할 수 있다. buf가 인포메이션 태그 저장부에 존재하는 값이므로, 결함 탐지 모듈(116, 도 1 참조)은 인포메이션 태그 저장부의 할당 flag를 먼저 확인하고, 0x10070의 할당 flag 값은 정적 할당을 의미하는 0x1이므로 '할당되지 않은 포인터 해제' 결함으로 판정할 수 있다. 결함 탐지 모듈(116)은 할당되지 않은 포인터 해제에 관련된 로그를 트레이스 로그(trace log)로 저장하고, 코드를 종료할 수 있다. The computer system may call the free function of the agent when the free statement 1114 of the sixth line of the test code 1110 is called. In this case, the memory address to be released is transferred to 0x10070, which is the address of buf, and the agent can search the information tag storage unit to check whether the corresponding value exists. Since buf is a value that exists in the information tag storage unit, the defect detection module (116, see FIG. 1) checks the allocation flag of the information tag storage unit first, and since the allocation flag value of 0x10070 is 0x1, which means static allocation, 'not allocated' It can be determined as a 'pointer free' fault. The fault detection module 116 may store a log related to unallocated pointer release as a trace log and terminate the code.

컴퓨터 시스템은 결함 탐지 모듈(118, 도 1 참조)에서 트레이스 로그를 분석하여 '할당되지 않은 포인터 해제' 결함이 발생한 소스 코드의 위치와 결함 로그를 분석할 수 있다. 또한, 컴퓨터 시스템은 인포메이션 태그 저장부에 bufp에 대한 인포메이션 태그가 해제되지 않은 채로 남아 있는 경우 메모리 누수로 판정할 수 있다. 상기 결함 로그 분석 및 메모리 누수 판정 동작들은 결함 분석 모듈(114, 도 1 참조)에서 수행될 수 있다.The computer system analyzes the trace log in the fault detection module 118 (see FIG. 1) to analyze the location of the source code where the 'unallocated pointer release' fault occurred and the fault log. In addition, the computer system may determine a memory leak if the information tag for bufp remains unreleased in the information tag storage. The fault log analysis and memory leak determination operations may be performed in the fault analysis module 114 (see FIG. 1).

결함 분석 모듈(114)은 분석된 결함 또는 메모리 오류 원인을 텍스트 형태로 출력할 수 있다. The defect analysis module 114 may output the cause of the analyzed defect or memory error in text form.

본 명세서에서 설명된 컴퓨터 시스템 및 컴퓨터 시스템에서 수행하는 메모리 오류 검출 방법은 하드웨어 구성요소, 소프트웨어 구성요소, 및/또는 하드웨어 구성요소 및 소프트웨어 구성요소의 조합으로 구현될 수 있다. The computer system and the memory error detection method performed by the computer system described in this specification may be implemented as a hardware component, a software component, and/or a combination of hardware components and software components.

소프트웨어는 컴퓨터 프로그램(computer program), 코드(code), 명령(instruction), 또는 이들 중 하나 이상의 조합을 포함할 수 있으며, 원하는 대로 동작하도록 처리 장치를 구성하거나 독립적으로 또는 결합적으로(collectively) 처리 장치를 명령할 수 있다. Software may include a computer program, code, instructions, or a combination of one or more of the foregoing, which configures a processing device to operate as desired or processes independently or collectively. The device can be commanded.

소프트웨어는, 컴퓨터로 읽을 수 있는 저장 매체(computer-readable storage media)에 저장된 명령어를 포함하는 컴퓨터 프로그램으로 구현될 수 있다. 컴퓨터가 읽을 수 있는 기록 매체로는, 예를 들어 마그네틱 저장 매체(예컨대, ROM(read-only memory), RAM(random-access memory), 플로피 디스크, 하드 디스크 등) 및 광학적 판독 매체(예컨대, 시디롬(CD-ROM), 디브이디(DVD: Digital Versatile Disc)) 등이 있다. 컴퓨터가 읽을 수 있는 기록 매체는 네트워크로 연결된 컴퓨터 시스템들에 분산되어, 분산 방식으로 컴퓨터가 판독 가능한 코드가 저장되고 실행될 수 있다. 매체는 컴퓨터에 의해 판독가능하며, 메모리에 저장되고, 프로세서에서 실행될 수 있다. Software may be implemented as a computer program including instructions stored in computer-readable storage media. Computer-readable recording media include, for example, magnetic storage media (e.g., read-only memory (ROM), random-access memory (RAM), floppy disk, hard disk, etc.) and optical reading media (e.g., CD-ROM) (CD-ROM) and DVD (Digital Versatile Disc). A computer-readable recording medium may be distributed among computer systems connected through a network, and computer-readable codes may be stored and executed in a distributed manner. The medium may be readable by a computer, stored in a memory, and executed by a processor.

컴퓨터로 읽을 수 있는 저장매체는, 비일시적(non-transitory) 저장매체의 형태로 제공될 수 있다. 여기서, '비일시적'은 저장매체가 신호(signal)를 포함하지 않으며 실재(tangible)한다는 것을 의미할 뿐 데이터가 저장매체에 반영구적 또는 임시적으로 저장됨을 구분하지 않는다. A computer-readable storage medium may be provided in the form of a non-transitory storage medium. Here, 'non-temporary' only means that the storage medium does not contain a signal and is tangible, but does not distinguish whether data is stored semi-permanently or temporarily in the storage medium.

또한, 본 명세서에 개시된 실시예들에 따른 컴퓨터 시스템 및 컴퓨터 시스템에서 메모리 오류를 검출하는 방법은 컴퓨터 프로그램 제품(computer program product)에 포함되어 제공될 수 있다. 컴퓨터 프로그램 제품은 상품으로서 판매자 및 구매자 간에 거래될 수 있다.In addition, a computer system and a method for detecting a memory error in a computer system according to embodiments disclosed herein may be included in a computer program product and provided. Computer program products may be traded between sellers and buyers as commodities.

컴퓨터 프로그램 제품은 소프트웨어 프로그램, 소프트웨어 프로그램이 저장된 컴퓨터로 읽을 수 있는 저장 매체를 포함할 수 있다. 예를 들어, 컴퓨터 프로그램 제품은 전자 장치의 제조사 또는 전자 마켓(예를 들어, 구글 플레이 스토어, 앱 스토어)을 통해 전자적으로 배포되는 소프트웨어 프로그램 형태의 상품(예를 들어, 다운로드 가능한 애플리케이션(downloadable application))을 포함할 수 있다. 전자적 배포를 위하여, 소프트웨어 프로그램의 적어도 일부는 저장 매체에 저장되거나, 임시적으로 생성될 수 있다. 이 경우, 저장 매체는 제조사의 서버, 전자 마켓의 서버, 또는 소프트웨어 프로그램을 임시적으로 저장하는 중계 서버의 저장매체가 될 수 있다.A computer program product may include a software program and a computer-readable storage medium in which the software program is stored. For example, a computer program product is a product in the form of a software program (eg, a downloadable application) that is distributed electronically through a manufacturer of an electronic device or an electronic market (eg, Google Play Store, App Store). ) may be included. For electronic distribution, at least a portion of the software program may be stored on a storage medium or temporarily created. In this case, the storage medium may be a storage medium of a manufacturer's server, an electronic market server, or a relay server temporarily storing a software program.

컴퓨터 프로그램 제품은, 서버 및 단말(예로, 초음파 진단 장치)로 구성되는 시스템에서, 서버의 저장매체 또는 단말의 저장매체를 포함할 수 있다. 또는, 서버 또는 단말과 통신 연결되는 제3 장치(예, 스마트폰)가 존재하는 경우, 컴퓨터 프로그램 제품은 제3 장치의 저장매체를 포함할 수 있다. 또는, 컴퓨터 프로그램 제품은 서버로부터 단말 또는 제3 장치로 전송되거나, 제3 장치로부터 단말로 전송되는 소프트웨어 프로그램 자체를 포함할 수 있다.A computer program product may include a storage medium of a server or a storage medium of a terminal in a system including a server and a terminal (eg, an ultrasound diagnosis apparatus). Alternatively, if there is a third device (eg, a smart phone) that is communicatively connected to the server or terminal, the computer program product may include a storage medium of the third device. Alternatively, the computer program product may include a software program itself transmitted from the server to the terminal or the third device or from the third device to the terminal.

이 경우, 서버, 단말 및 제3 장치 중 하나가 컴퓨터 프로그램 제품을 실행하여 개시된 실시예들에 따른 방법을 수행할 수 있다. 또는, 서버, 단말 및 제3 장치 중 둘 이상이 컴퓨터 프로그램 제품을 실행하여 개시된 실시예들에 따른 방법을 분산하여 실시할 수 있다.In this case, one of the server, the terminal and the third device may execute the computer program product to perform the method according to the disclosed embodiments. Alternatively, two or more of the server, the terminal, and the third device may execute the computer program product to implement the method according to the disclosed embodiments in a distributed manner.

예를 들면, 서버(예로, 클라우드 서버 또는 인공 지능 서버 등)가 서버에 저장된 컴퓨터 프로그램 제품을 실행하여, 서버와 통신 연결된 단말이 개시된 실시예들에 따른 방법을 수행하도록 제어할 수 있다. For example, a server (eg, a cloud server or an artificial intelligence server) may execute a computer program product stored in the server and control a terminal connected to the server to perform a method according to the disclosed embodiments.

또 다른 예로, 제3 장치가 컴퓨터 프로그램 제품을 실행하여, 제3 장치와 통신 연결된 단말이 개시된 실시예에 따른 방법을 수행하도록 제어할 수 있다. As another example, the third device may execute a computer program product to control a terminal communicatively connected to the third device to perform the method according to the disclosed embodiment.

제3 장치가 컴퓨터 프로그램 제품을 실행하는 경우, 제3 장치는 서버로부터 컴퓨터 프로그램 제품을 다운로드하고, 다운로드된 컴퓨터 프로그램 제품을 실행할 수 있다. 또는, 제3 장치는 프리로드된 상태로 제공된 컴퓨터 프로그램 제품을 실행하여 개시된 실시예들에 따른 방법을 수행할 수도 있다.When the third device executes the computer program product, the third device may download the computer program product from the server and execute the downloaded computer program product. Alternatively, the third device may perform the method according to the disclosed embodiments by executing a computer program product provided in a preloaded state.

이상과 같이 실시예들이 비록 한정된 실시예와 도면에 의해 설명되었으나, 해당 기술분야에서 통상의 지식을 가진 자라면 상기의 기재로부터 다양한 수정 및 변형이 가능하다. 예를 들어, 설명된 기술들이 설명된 방법과 다른 순서로 수행되거나, 및/또는 설명된 컴퓨터 시스템 또는 모듈 등의 구성요소들이 설명된 방법과 다른 형태로 결합 또는 조합되거나, 다른 구성요소 또는 균등물에 의하여 대치되거나 치환되더라도 적절한 결과가 달성될 수 있다. As described above, although the embodiments have been described with limited examples and drawings, those skilled in the art can make various modifications and variations from the above description. For example, the described techniques may be performed in an order different from the methods described, and/or components such as the described computer systems or modules may be combined or combined in a manner different from the methods described, or other components or equivalents. Appropriate results can be achieved even if substituted or substituted by

Claims (20)

컴퓨터 시스템에서 발생되는 메모리 오류를 검출하는 방법에 있어서,
애플리케이션의 실행 이전에 상기 애플리케이션의 글로벌 변수(Global variable) 및 로컬 변수(local variable) 정보를 추출하는 단계;
추출된 상기 글로벌 변수 및 상기 로컬 변수 정보를 인포메이션 태그 저장부(information tag repository)에 저장하는 단계; 및
상기 인포메이션 태그 저장부에 저장된 상기 글로벌 변수 및 상기 로컬 변수 정보와 상기 애플리케이션이 실행 중에 수집된 동적 메모리(dynamic memory) 정보에 기초하여 메모리 오류를 검출하는 단계;
를 포함하는, 방법.
A method for detecting a memory error occurring in a computer system,
extracting global variable and local variable information of the application prior to execution of the application;
storing the extracted global variable and local variable information in an information tag repository; and
detecting a memory error based on the global variable and the local variable information stored in the information tag storage unit and dynamic memory information collected while the application is running;
Including, method.
◈청구항 2은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 2 was abandoned when the registration fee was paid.◈ 제1 항에 있어서,
상기 글로벌 변수 및 로컬 변수 정보를 추출하는 단계는, 사용자 입력에 따라 상기 애플리케이션이 실행되기 전에 상기 애플리케이션의 정적 메모리 정보를 추출하는 바이너리 분석기를 실행하도록 설정하고, 상기 바이너리 분석기를 통해 상기 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는, 방법.
According to claim 1,
In the step of extracting global variable and local variable information, a binary analyzer for extracting static memory information of the application is set to be executed before the application is executed according to a user input, and the global variable of the application is set through the binary analyzer. and extracting local variables.
◈청구항 3은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 3 was abandoned when the registration fee was paid.◈ 제1 항에 있어서,
상기 글로벌 변수 및 로컬 변수 정보를 추출하는 단계는,
추출된 상기 글로벌 변수 및 상기 로컬 변수 각각의 주소(address), 크기, 호출함수 중 적어도 하나를 분석하는 단계를 포함하는, 방법.
According to claim 1,
The step of extracting the global variable and local variable information,
And analyzing at least one of an address, a size, and a call function of each of the extracted global variable and the local variable.
◈청구항 4은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 4 was abandoned when the registration fee was paid.◈ 제1 항에 있어서,
상기 메모리 오류를 검출하는 단계는, DBI(Dynamic Binary Injection) 기법을 통해 상기 실행 중인 애플리케이션에 의해 메모리의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 상기 동적 메모리 정보를 모니터링하는 단계를 포함하는, 방법.
According to claim 1,
The detecting of the memory error includes monitoring the dynamic memory information that is dynamically allocated, accessed, and released from a heap area of memory by the running application through a dynamic binary injection (DBI) technique. .
제1 항에 있어서,
상기 메모리 오류를 검출하는 단계는, 메모리의 글로벌 영역, 스택 영역(Stack) 및 Heap 영역 중 적어도 하나의 영역에서의 메모리 결함을 검출하는, 방법.
According to claim 1,
The detecting of the memory error may include detecting a memory defect in at least one of a global area, a stack area, and a heap area of the memory.
제1 항에 있어서,
상기 애플리케이션에 크래쉬(crash)가 발생되어 상기 애플리케이션이 종료되는 신호에 따라, 커널(kernel)의 시그널 핸들러(signal handler)를 상기 크래쉬가 발생한 시점의 메모리 정보 및 상기 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체하는 단계; 를 더 포함하는, 방법.
According to claim 1,
According to the signal that a crash occurs in the application and the application is terminated, a signal handler of the kernel is directed to memory information at the time of the crash and memory defect information up to before the occurrence of the crash. replacing with a signal handler that monitors; Further comprising a method.
제6 항에 있어서,
상기 교체된 시그널 핸들러를 호출하는 단계; 및
호출된 시그널 핸들러를 이용하여 상기 크래쉬와 관련된 애플리케이션의 콜 스택(Call Stack) 정보를 수집하는 단계;
를 더 포함하는, 방법.
According to claim 6,
calling the replaced signal handler; and
Collecting call stack information of an application related to the crash using the called signal handler;
Further comprising a method.
◈청구항 8은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 8 was abandoned when the registration fee was paid.◈ 제7 항에 있어서,
상기 메모리 오류를 검출하는 단계는, 메모리의 글로벌 영역, 스택 영역, Heap 영역에서의 메모리 결함 정보 및 상기 수집된 콜 스택 정보에 기초하여 상기 메모리 오류의 원인을 분석하는, 방법.
According to claim 7,
The detecting of the memory error may include analyzing a cause of the memory error based on memory defect information in a global area, a stack area, and a heap area of memory and the collected call stack information.
◈청구항 9은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 9 was abandoned when the registration fee was paid.◈ 제8 항에 있어서,
상기 메모리 오류의 분석 결과를 출력하는 단계;
를 더 포함하는, 방법.
According to claim 8,
outputting an analysis result of the memory error;
Further comprising a method.
메모리 오류를 검출하는 컴퓨터 시스템에 있어서,
메모리; 및
상기 컴퓨터 시스템에 의해 수행되는 애플리케이션이 상기 메모리를 참조함에 따라 발생되는 메모리 오류를 검출하는 프로세서;
를 포함하고,
상기 프로세서는,
상기 애플리케이션의 실행 이전에 상기 애플리케이션의 글로벌 변수(Global variable) 및 로컬 변수(local variable) 정보를 추출하는 바이너리 분석 모듈;
추출된 상기 글로벌 변수 및 상기 로컬 변수 정보에 기초하여 상기 메모리의 결함을 탐지하는 결함 탐지 모듈; 및
상기 탐지된 메모리 결함에 기초하여 상기 메모리 오류를 검출하고, 검출된 오류를 분석하는 결함 분석 모듈; 을 포함하는, 컴퓨터 시스템.
A computer system for detecting memory errors,
Memory; and
a processor that detects a memory error generated when an application executed by the computer system refers to the memory;
including,
the processor,
a binary analysis module for extracting global variable and local variable information of the application prior to execution of the application;
a defect detection module configured to detect a defect of the memory based on the extracted global variable and local variable information; and
a defect analysis module that detects the memory error based on the detected memory defect and analyzes the detected error; Including, a computer system.
◈청구항 11은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 11 was abandoned when the registration fee was paid.◈ 제10 항에 있어서,
상기 바이너리 분석 모듈은 사용자 입력에 따라 상기 애플리케이션이 실행되기 전에 상기 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는 바이너리 분석기가 실행되도록 설정하고, 상기 바이너리 분석기를 통해 상기 애플리케이션의 글로벌 변수 및 로컬 변수를 추출하는, 컴퓨터 시스템.
According to claim 10,
The binary analysis module sets a binary analyzer for extracting global variables and local variables of the application to be executed before the application is executed according to a user input, and extracts the global variables and local variables of the application through the binary analyzer , computer system.
◈청구항 12은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 12 was abandoned when the registration fee was paid.◈ 제10 항에 있어서,
상기 추출된 정적 메모리 정보를 저장하는 저장부;
를 더 포함하고,
상기 결함 탐지 모듈은 상기 저장부에 저장된 상기 글로벌 변수 및 상기 로컬 변수 정보에 기초하여 상기 메모리의 결함을 탐지하는, 컴퓨터 시스템.
According to claim 10,
a storage unit for storing the extracted static memory information;
Including more,
Wherein the defect detection module detects a defect in the memory based on the global variable and the local variable information stored in the storage unit.
◈청구항 13은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 13 was abandoned when the registration fee was paid.◈ 제10 항에 있어서,
상기 결함 탐지 모듈은 추출된 상기 글로벌 변수 및 상기 로컬 변수 각각의 주소(address), 크기, 호출함수 중 적어도 하나를 분석하고, 분석 결과에 기초하여 상기 메모리 결함에 관한 정보를 획득하는, 컴퓨터 시스템.
According to claim 10,
Wherein the defect detection module analyzes at least one of an address, a size, and a call function of each of the extracted global variable and the local variable, and obtains information about the memory defect based on an analysis result.
◈청구항 14은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 14 was abandoned when the registration fee was paid.◈ 제10 항에 있어서,
상기 결함 탐지 모듈은 DBI(Dynamic Binary Injection) 기법을 사용하여 상기 애플리케이션이 실행 중에 상기 메모리의 Heap 영역에서 동적으로 할당, 접근 및 해제되는 동적 메모리 정보를 모니터링하는, 컴퓨터 시스템.
According to claim 10,
Wherein the defect detection module monitors dynamic memory information that is dynamically allocated, accessed, and released from a heap area of the memory while the application is running using a Dynamic Binary Injection (DBI) technique.
제14 항에 있어서,
상기 결함 탐지 모듈은 상기 메모리의 글로벌 영역, 스택 영역(Stack) 및 상기 Heap 영역 중 적어도 하나의 영역에서의 메모리 결함을 검출하는, 컴퓨터 시스템.
According to claim 14,
The computer system of claim 1 , wherein the defect detection module detects a memory defect in at least one of a global area, a stack area, and the heap area of the memory.
제10 항에 있어서,
상기 프로세서는, 상기 애플리케이션이 실행 중에 발생되는 크래쉬(crash)를 분석하여 상기 크래쉬 관련 데이터를 수집하는 크래쉬 모니터링 모듈; 을 더 포함하는, 컴퓨터 시스템.
According to claim 10,
The processor may include: a crash monitoring module that analyzes a crash that occurs while the application is running and collects data related to the crash; Further comprising a computer system.
제16 항에 있어서,
상기 크래쉬 모니터링 모듈은 상기 애플리케이션에 크래쉬가 발생되어 상기 애플리케이션이 종료되는 신호에 따라, 커널(kernel)의 시그널 핸들러(signal handler)를 상기 크래쉬가 발생한 시점의 메모리 정보 및 상기 크래쉬의 발생 이전까지의 메모리 결함 정보를 모니터링하는 시그널 핸들러로 교체하는, 컴퓨터 시스템.
According to claim 16,
The crash monitoring module sends a signal handler of a kernel according to a signal that a crash occurs in the application and the application is terminated, memory information at the time when the crash occurs and memory information until before the occurrence of the crash A computer system that replaces signal handlers that monitor fault information.
제17 항에 있어서,
상기 크래쉬 모니터링 모듈은 상기 교체된 시그널 핸들러를 호출하고, 상기 호출된 시그널 핸들러를 이용하여 상기 크래쉬와 관련된 애플리케이션의 콜 스택(Call Stack) 정보를 수집하는, 컴퓨터 시스템.
According to claim 17,
The computer system of claim 1 , wherein the crash monitoring module calls the replaced signal handler and collects call stack information of an application related to the crash using the called signal handler.
◈청구항 19은(는) 설정등록료 납부시 포기되었습니다.◈◈Claim 19 was abandoned when the registration fee was paid.◈ 제18 항에 있어서,
상기 결함 분석 모듈은 상기 결함 탐지 모듈에서 탐지한 상기 메모리의 글로벌 영역, 스택 영역, Heap 영역에서의 메모리 결함 정보 및 상기 크래쉬 모니터링 모듈에서 수집한 상기 콜 스택 정보에 기초하여 상기 메모리 오류의 원인을 분석하는, 컴퓨터 시스템.
According to claim 18,
The defect analysis module analyzes the cause of the memory error based on memory defect information in the global area, stack area, and heap area of the memory detected by the defect detection module and the call stack information collected by the crash monitoring module. , computer system.
제1 항의 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록 매체.A computer-readable recording medium on which a program for executing the method of claim 1 is recorded on a computer.
KR1020180060689A 2018-05-28 2018-05-28 Method and system for detecting memory errors KR102545765B1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
KR1020180060689A KR102545765B1 (en) 2018-05-28 2018-05-28 Method and system for detecting memory errors
PCT/KR2019/006330 WO2019231194A1 (en) 2018-05-28 2019-05-27 Method and system for detecting memory error

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020180060689A KR102545765B1 (en) 2018-05-28 2018-05-28 Method and system for detecting memory errors

Publications (2)

Publication Number Publication Date
KR20190135337A KR20190135337A (en) 2019-12-06
KR102545765B1 true KR102545765B1 (en) 2023-06-21

Family

ID=68698837

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020180060689A KR102545765B1 (en) 2018-05-28 2018-05-28 Method and system for detecting memory errors

Country Status (2)

Country Link
KR (1) KR102545765B1 (en)
WO (1) WO2019231194A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111274060B (en) * 2020-02-10 2023-07-28 广州虎牙科技有限公司 Method, device, equipment and storage medium for determining memory exception
CN111382077B (en) * 2020-03-13 2023-09-01 北京奇艺世纪科技有限公司 Application program crash reason positioning method and device, electronic equipment and storage medium
KR102254159B1 (en) * 2020-12-09 2021-05-18 연세대학교 산학협력단 Method for detecting real-time error in operating system kernel memory
CN113672237B (en) * 2021-09-03 2022-03-11 支付宝(杭州)信息技术有限公司 Program compiling method and device for preventing memory boundary crossing

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090249289A1 (en) 2008-03-28 2009-10-01 Microsoft Corporation Detecting memory errors using write integrity testing
US20150261596A1 (en) 2014-03-17 2015-09-17 Microsoft Corporation Framework for user-mode crash reporting

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100890546B1 (en) * 2007-04-30 2009-03-27 슈어소프트테크주식회사 The method of detecting memory error
RU2011101098A (en) * 2011-01-14 2012-07-20 Корпорация "САМСУНГ ЭЛЕКТРОНИКС Ко., Лтд." (KR) METHOD FOR DETERMINING MEMORY ACCESS ERRORS IN COMPUTER SYSTEM
KR101394225B1 (en) * 2012-06-22 2014-05-14 인텔렉추얼디스커버리 주식회사 Profiling system for application developed by multi-language and profiling method using the same

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090249289A1 (en) 2008-03-28 2009-10-01 Microsoft Corporation Detecting memory errors using write integrity testing
US20150261596A1 (en) 2014-03-17 2015-09-17 Microsoft Corporation Framework for user-mode crash reporting

Also Published As

Publication number Publication date
KR20190135337A (en) 2019-12-06
WO2019231194A1 (en) 2019-12-05

Similar Documents

Publication Publication Date Title
KR102545765B1 (en) Method and system for detecting memory errors
US10042744B2 (en) Adopting an existing automation script to a new framework
US8769504B2 (en) Method and apparatus for dynamically instrumenting a program
WO2019161619A1 (en) Automatic interface test method and apparatus, and device and computer-readable storage medium
US9262283B2 (en) Method for reading kernel log upon kernel panic in operating system
CN104254840A (en) Memory dump and analysis in a computer system
US8752027B2 (en) Injecting faults into program for testing software
US10546144B2 (en) Dynamically excluding sensitive information from system snapshot
US8806446B2 (en) Methods and apparatus for debugging programs in shared memory
US9454539B1 (en) System and method for protecting operating system zones
US11182479B2 (en) Call stack acquisition device, call stack acquisition method, and call stack acquisition program
CN107632929B (en) Method and device for detecting memory leakage
WO2019134223A1 (en) Log generation method and apparatus, computer device and storage medium
CN112214388A (en) Memory monitoring method, device, equipment and computer readable storage medium
CA2811617C (en) Commit sensitive tests
US20150186059A1 (en) Memory management program, memory management method, and memory management device
US9122791B2 (en) Identifying a storage location for a storage address requested during debugging
US7188279B2 (en) Method, program, and storage medium for acquiring logs
EP2869189A1 (en) Boot up of a multiprocessor computer
CN109542341B (en) Read-write IO monitoring method, device, terminal and computer readable storage medium
CN111274130A (en) Automatic testing method, device, equipment and storage medium
CN111352631B (en) Interface compatibility detection method and device
CN110333993B (en) Memory snapshot generation method and device, electronic equipment and storage medium
US8291389B2 (en) Automatically detecting non-modifying transforms when profiling source code
CN115757099A (en) Automatic test method and device for platform firmware protection recovery function

Legal Events

Date Code Title Description
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right