Adaptation of the ThreadSanitizer Algorithm for Data Race Detection in a RTOS Kernel
https://doi.org/10.15514/ISPRAS-2025-37(6)-38
Abstract
Correct design and implementation of concurrent algorithms is a crucial part of modern real-time operating system development. One of the main steps along this way is a verification of such algorithms within the programming language memory model. The article describes an integration of the ThreadSanitizer – broadly used LLVM tool for data race detection – into the RTOS kernel environment and discusses its advantages and disadvantages over other tools for data race detection. Among other things, the semantics of context switches and interrupt management within the happens-before synchronization model is considered. In conclusion the results of a ThreadSanitizer tool integration are provided compared to current approaches of concurrency bugs detection in RTOS kernel.
About the Author
Egor Sergeevich ELCHINOVRussian Federation
Senior Lab Assistant of the Department of Programming Technologies of the Institute for System Programming of the RAS. Research interests: methods for software dynamic analysis, concurrency algorithms, operating systems.
References
1. J. Alglave, L. Maranget, P. E. McKenney, A. Parri, and A. Stern, Frightening small children and dis-concerting grown-ups: Concurrency in the linux kernel, SIGPLAN Not., vol. 53, pp. 405–418, Mar. 2018.
2. M. Elver, Concurrency bugs should fear the big bad data-race detector. https://lwn.net/Articles/816850/ , 2020. [Online; accessed 21-May-2025].
3. K. Serebryany and T. Iskhodzhanov, Threadsanitizer – data race detection in practice, pp. 62–71, 12 2009.
4. ISO Central Secretary, Information technology – Programming Languages – C, Standard ISO/IEC 9899:2024, International Organization for Standardization, Geneva, CH, 2024.
5. D. Vyukov, Llvm thread sanitizer. https://github.com/google/sanitizers/wiki/threadsanitizercppmanual, 2020. [Online; accessed 22-May-2025].
6. N. Komarov, On the implementation of data-breakpoints based race detection for linux kernel mod-ules, 2013.
7. S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson, Eraser: a dynamic data race de-tector for multithreaded programs, ACM Trans. Comput. Syst., vol. 15, p. 391–411, Nov. 1997.
8. F. Mattern, Virtual time and global states of distributed systems, 01 2004.
9. L. Lamport, Time, clocks, and the ordering of events in a distributed system, Commun. ACM, vol. 21, p. 558–565, July 1978.
10. A. Konovalov, Kernel thread sanitizer. https://github.com/google/kernel-sanitizers/blob/master/KTSAN.md , 2015. [Online; accessed 24-April-2025].
Supplementary files
Review
For citations:
ELCHINOV E.S. Adaptation of the ThreadSanitizer Algorithm for Data Race Detection in a RTOS Kernel. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2025;37(6):91-108. (In Russ.) https://doi.org/10.15514/ISPRAS-2025-37(6)-38






