In-Vivo Stack Overflow Detection and Stack Size Estimation for Low-End Multithreaded Operating Systems using Virtual Prototypes

Sören Tempel, Vladimir Herdt, Rolf Drechsler

In: Forum on Specification & Design Languages (FDL). Forum on Specification & Design Languages (FDL-2021) September 8-10 Antibes/Hybrid France 2021.


Constrained IoT devices with limited computing resources are on the rise. They utilize low-end multithreaded operating systems (e.g. RIOT) where each thread is assigned a fixed stack size during the development process. In this regard, it is important to choose an appropriate stack size which does not cause stack overflows and at the same time does not waste scarce memory resources by overestimating the required thread stack size. In this paper we propose an in-vivo technique for stack overflow detection and stack size estimation that leverages Virtual Prototypes (VPs) and is specifically tailored for low-end multithreaded IoT operating systems. We focus on SystemCbased VPs which operate on the TLM abstraction level. VPs are an industrial proven modeling standard to enable early software development and testing. We propose a non-intrusive extension for existing VPs which allows detecting stack overflows and provides a stack size estimation, which is beneficial to a VPbased development process. Our analysis works in-vivo, hence no modification of the executed software binary is required between testing and deployment. Our evaluation using the RIOT operating system revealed two previously unknown stack overflows in RIOT and identified potential stack size overestimation.


Deutsches Forschungszentrum für Künstliche Intelligenz
German Research Center for Artificial Intelligence