C++: Add more thread creation models#20016
Merged
MathiasVP merged 7 commits intogithub:mainfrom Jul 10, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds thread creation models for pthread and std::thread APIs to track data flow when arguments are passed to thread functions. The purpose is to improve CodeQL's ability to detect security vulnerabilities and data flow issues across thread boundaries.
- Adds data flow models for
std::threadconstructor to track parameter passing - Adds data flow model for
pthread_createfunction to track argument passing to thread functions - Includes comprehensive test cases demonstrating taint flow through thread creation
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| thread.cpp | New test file demonstrating taint flow through std::thread creation |
| test.cpp | Added pthread_create test case showing taint flow to thread function |
| std.thread.model.yml | Data flow models for std::thread constructor parameter passing |
| pthread.model.yml | Data flow model for pthread_create argument passing |
| stl.h | Added std::thread class definition for testing |
| *.expected | Updated test expectations reflecting new thread models |
jketema
reviewed
Jul 10, 2025
Contributor
jketema
left a comment
There was a problem hiding this comment.
Small nit, other than this LGTM if DCA is happy.
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
jketema
previously approved these changes
Jul 10, 2025
jketema
approved these changes
Jul 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is #19955, but for
pthreads andstd::threads.Commit-by-commit review recommended.