Skip to content
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

Fixes in tuple handling + output format improvements #78

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

victornicolet
Copy link
Contributor

This PR improves tuple handling in the dataflow analysis:

  • encoding of "non-tuples" explicit instead of through negative integers.
  • tuple-manipulating instructions that are not at the boundary of function calls (returns, calls) now ignore tuple indices.
  • analysis panics explicitly if indices don't match.
  • some changes in the output format of the taint analysis to display type of nodes and make position more visually obvious.

samarth-aws
samarth-aws previously approved these changes Jul 9, 2024
type IndexKind int

const (
// ReturnedTupleIndex is index on a tuple returned by a functoin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typos

for outPath := range outPaths {
if inPath != "" || outPath != "" {
if !prefixed {
prefix += "@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need to be addressed in this PR but I'm wondering if we should come up with a more efficient representation for paths? Strings are relatively expensive to update because they are immutable. Maybe it would be more efficient to use [][]byte or []string instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, the limitation is that we need to match the pointer analysis' representation. Currently there is a 1-1 mapping between the two, they are both strings and have the same "syntax". Now that we have the pointer analysis internally, we can change that representation. We could also add some parsing step to translate between representations.

// ReturnedTupleIndex is index on a tuple returned by a functoin
ReturnedTupleIndex IndexKind = iota
// NonIndex is a non-index
NonIndex
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't NonIndex be the default value (0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I use the default value, but that's a good point, it should be.

@@ -76,6 +87,22 @@ func (m MarkType) String() string {
}
}

// MarkIndex wraps an index kind and the index value together
type MarkIndex struct {
// Kind is the kind of index (currently, either a real index or not)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan to have other kinds of indices?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was that some point we might want to track indices resulting from next and select instructions as a special case.

@victornicolet victornicolet merged commit 6b9c304 into mainline Jul 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants