Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Tolerate missing summaries for call graphs #1191

Merged
merged 1 commit into from
Nov 21, 2022
Merged

Tolerate missing summaries for call graphs #1191

merged 1 commit into from
Nov 21, 2022

Conversation

hermanventer
Copy link
Contributor

@hermanventer hermanventer commented Nov 21, 2022

Description

The root cause of the #1190 issue is that there is no MIR for CStr::from_bytes_with_nul and no foreign contract either. That means that the analysis of main is necessarily imprecise and analyzing the rest of the function will just generate a bunch of diagnostics that are probably false positives. Providing a foreign contract for CStr::from_bytes_with_nul will make the problem go way for the specific repro case, but won't solve the problem for all code until the vast majority of functions without MIR have been provided with contracts.

That is not going to happen any time soon, so the alternative is to embrace the fact that call graphs are already so abstract that no one gets too excited when a non reachable call (false positive) shows up in the call graph. As #1190 illustrates, false negatives are much of more of a concern here. Consequently, the analysis will now carry on when even when it is incomplete and prone to false positives, if the analysis is done in order to retrieve a call graph.

Fixes #1190

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • API change with a documentation update
  • Additional test coverage
  • Code cleanup or just keeping up with the latest Rustc nightly

How Has This Been Tested?

./validate.sh
Checked that the repro in #1190 now works as expected.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 21, 2022
@codecov
Copy link

codecov bot commented Nov 21, 2022

Codecov Report

Merging #1191 (61d0d27) into main (2368aac) will increase coverage by 0%.
The diff coverage is 66%.

@@          Coverage Diff          @@
##            main   #1191   +/-   ##
=====================================
  Coverage     76%     76%           
=====================================
  Files         23      23           
  Lines      16460   16462    +2     
=====================================
+ Hits       12623   12626    +3     
+ Misses      3837    3836    -1     
Impacted Files Coverage Δ
checker/src/call_visitor.rs 81% <50%> (-1%) ⬇️
checker/src/block_visitor.rs 75% <100%> (ø)
checker/src/abstract_value.rs 78% <0%> (+<1%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hermanventer hermanventer merged commit 32b5f63 into main Nov 21, 2022
@hermanventer hermanventer deleted the call_graph branch November 21, 2022 21:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libc::sysctlbyname doesn't show up in call graph output
2 participants