Google Summer of Code 2019 - Introduction
Published:
Hello!
This year again I have been selected for Google Summer of Code 2019 @ Linux Foundation under the mentorship of Lukas Bulwahn. The project is an experimental research analysis of applying Clang Thread Safety Analyser on the linux kernel to find potential concurrency related problems by suitably annotating the source code. The analysis is completely static and reports warnings at compile time.
The project falls under the umbrella of Enabling Linux In Safety Applications(ELISA), a recently announced project by Linux Foundation.
I will be working closely with ClangBuiltLinux community and you can join us too by subscribing the clang-built-linux or take a peak at the archives.
Clang Thread Safety analysis hasn’t been implemented in any opensource project where I could take references. Although, Google claims to deploy this feature on wide scale internally on over > 20,000 C++ files with more than 140,000 annotations increasing every day!
Marc-André Lureau had proposed this feature for the QEMU codebase to do some sort of “context-checking” and prevent any misuse. Kind of enforcing policies that one shouldn’t call a function from a non-privilege context. It didn’t get merged into the codebase nor was any development in that given direction though it is marked as a WIP.
Some ideas one might try to play around could be:
- Can we use this feauture to check we don’t sleep while holding a lock ?
- Ensuring
GFP_ATOMIC
is passed during an allocation in a coroutine which might sleep ? …
But currently, my main goal is to find cocurrency bugs such as race conditions, deadlocks, etc. in a multi-threaded environment.
My last GSoC’18 report can be found here
Some important resources for the current project:
- Research paper: https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/42958.pdf
- Documentation: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#no-alias-analysis
- Blog from one of the author of the above research paper: https://insights.sei.cmu.edu/sei_blog/2014/10/thread-safety-analysis-in-c-and-c.html