• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

Computer Engineering & Science ›› 2022, Vol. 44 ›› Issue (11): 1918-1923.

• High Performance Computing • Previous Articles     Next Articles

Stack overflow test for embedded operating systems based on behavior monitoring

YANG Xing-da1,2,CHEN Can1,2,FANG Ling1,2   

  1. (1.Institutes of Physical Science and Information Technology,Anhui University,Hefei 230000;
    2.Hefei Institutes of Physical Science,Chinese Academy of Sciences,Hefei 230000,China)
  • Received:2021-09-14 Revised:2021-10-26 Accepted:2022-11-25 Online:2022-11-25 Published:2022-11-25

Abstract: Stack test is an important part of security evaluation of embedded operating systems. Stack overflow will overwrite the data in the adjacent stack, resulting in data confusion and system crash. However, catching and locating stack overflows can be difficult. Firstly, the overflow data may invade the private stack of other tasks in the operating system, and the overflowing task itself has no abnormal behavior, so that it is difficult to determine the root cause of the stack overflow. Secondly, stack overflows may be exposed later than their occurrence due to the priority differences of the operating system tasks. In this research, a dynamic stack test method based on real-time stack allocation and recovery behavior monitoring is proposed. Firstly, instrumentation is inserted at the stack behavior test point to collect the test code of the test stack. Then, the Upper Test (UT) is set to analyze the test code and provide the test result, which can realize the real-time capture and locate the stack overflow. In the actual test based on telematics terminal, this method is used to locate three stack overflow that caused the system to crash or reset, and the safety of the operating system stack is eval-uated. In addition, according to the test results, the static allocation of the stack size is optimized, which saves up to 42% of the stack space in a single task and compresses the entire RAM of tasks to 63% of the original.

Key words: operating system, instrumentation, stack test, dynamic test