POSIX signals are commonly used in C/C++ programs for IPC (Inter-Process Communication). One of the key advantages of using signals is that they can be handled asynchronously to the main control flow of the program. However, this advantage does not come for free. Developers of C/C++ programs must follow strict rules while implementing signal handlers. If these rules are violated, such programs do not work properly and may suffer from occasional crashes, freezes, or even data loss. Moreover, these issues are usually difficult to test and difficult to debug because they are timing-dependent.
Even modern C/C++ compilers are silent when they compile signal handlers that violate the mentioned rules. So the responsibility is currently fully on the C/C++ developers to implement signal handlers correctly.
The goal of this thesis is to create a tool that will warn C/C++ developers about possible bugs in the implementation of signal handlers at compile time. Even though such diagnostic cannot be 100% precise, the tool will be tweaked to provide good signal-to-noise ratio based on its evaluation on a big enough sample of open-source C/C++ code (approximately 1 million lines of code).
Step by step task description
- Learn about signals that are used for IPC (Inter-Process Communication) on Linux and POSIX operating systems, and rules for safe handling of signals.
- Get familiar with the intermediate representation of C/C++ code in the GCC compiler and GCC’s interface for plug-ins.
- Design and implement a GCC plug-in that verifies selected rules for safe handling of signals in C/C++ code.
- Experiment with the created tool on a big enough sample of open-source C/C++ code (approximately 1 million lines of code).
- Evaluate quality of the results provided by the tool and its usefulness for developers of C/C++ programs.