-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Implement models for poll, accept and select #5217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments / questions. Sorry if I've misunderstood anything about the sockets library, its a long time since I've used it.
readfds.fd_count = 1; | ||
readfds.fd_array[0] = source(); | ||
select(2, &readfds, nullptr, nullptr, &timeout); | ||
sink(&readfds); // $ ast MISSING: ir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you talk me through what's going on with taint in the poll
and select
examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. In the poll
case, we taint the file descriptor, and poll
wait for some I/O event, and then fill the revents
field with the returned event.
In the select
case, we taint a file descriptor in readfds
. It looks like this is normally done using the FD_SET
function which we haven't modeled yet. The call to select
then taints the readfds
structure, which we can then use to propagate taint to other FD_
functions.
Thinking about this taint flow again, I'm actually not sure we want taint to propagate taint to the entire object returned by these functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f908d2f removes the taint from these functions.
50dd0c9
to
f908d2f
Compare
LGTM, though I wouldn't mind a second opinion about taint through |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging.
Final part of https://github.com/github/codeql-c-analysis-team/issues/209 for this iteration.
These are slightly more awkward to model since it's most natural to model some of the flow to the file-descriptor argument, but since these are passed by value (because its value isn't actually changed) they don't have an "output" value after the function returns.