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

Implement tracking of nested parameters #432

Merged
merged 45 commits into from
Dec 13, 2023
Merged

Implement tracking of nested parameters #432

merged 45 commits into from
Dec 13, 2023

Conversation

Enkelmann
Copy link
Contributor

@Enkelmann Enkelmann commented Dec 11, 2023

Enable the function signature analysis and the pointer inference analysis to track nested parameters. Also solve long-standing state explosion problems.

The function signature analysis and the pointer inference analysis can now track nested parameters. As a consequence, subsequent analyses can also track these memory objects, thus enabling the detection of more bugs. However, the nesting depth of such nested parameters is limited to avoid state explosion.

Furthermore, we implement a new tracking strategy for memory objects created in a function and then returned to a caller. The previous tracking strategy was tracking all such objects via their point of origin. This was leading to state explosion in some cases where many points of origin could lead to the same return value. Since tracking of nested parameters was bound to make these problems worse, we switched to a different strategy: Now, returned objects are merged to unique objects identified by the position (return register or position inside mutable parameter object) where they are returned. Thus, multiple points of origin for the same returned object are merged accordingly. Objects that do not have a unique return location (e.g. they may be returned in different return registers at the same time) are not tracked by the caller. This change will impact the soundness and precision of the analysis, in some cases in a positive way and sometimes in a negative way. But the most important aspect for us right now is that it solves the state explosion problems that the cwe_checker was experiencing.

It should be noted that this PR leads to a reduction in the detection capabilities of the CWE-119 check, since it is now only partially interprocedural. The implementation suffered from the same state explosion problem as the pointer inference. Refactoring the check to restore full interprocedurality is left for a future PR.

@Enkelmann Enkelmann merged commit f6ced95 into master Dec 13, 2023
10 checks passed
@Enkelmann Enkelmann deleted the nested_params branch December 13, 2023 11:46
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.

1 participant