-
Notifications
You must be signed in to change notification settings - Fork 273
s2n_record_writev standalone example #7357
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
base: develop
Are you sure you want to change the base?
Conversation
c6e9542
to
a3f2acc
Compare
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.
Can we also have a README saying that this is a contract/symex torture test that currently leads to a massive blowup in memory.
@TGWDB This is a torture test that exposes a SymEx memory blowup. It is a stripped down problem from the s2n-tls (https://github.com/aws/s2n-tls), which is licensed under Apache 2.0. Can we include an Apache licensed file in CBMC -- it's not something that becomes part of the executable, it's just a regression test. |
Codecov ReportBase: 78.37% // Head: 78.38% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #7357 +/- ##
========================================
Coverage 78.37% 78.38%
========================================
Files 1647 1647
Lines 190328 190362 +34
========================================
+ Hits 149172 149213 +41
+ Misses 41156 41149 -7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
My interpretation of the Apache 2.0 licence is that this is a derivative work and thus needs to carry appropriate licence information. Practically, I think including the Apache 2.0 licence text for the s2n-tls project as comment in the source code for the regression test and clearly stating this source code is a derivative of the originating work would meet this standard. An example doing this elsewhere in the codebase can be found here: https://github.com/diffblue/cbmc/blob/48893287099cb5780302fe9dc415eb6888354fd6/jbmc/regression/jbmc/swap2/org/springframework/build/gradle/MergePlugin.groovy |
@nwetzler - can you add the Apache copyright header at the top of the s2n_record_writev.c file ... you'll find the text at the top of every C source file in s2n-tls. Also, add a NOTICE file to this directory. The Apache license expects this. You can pretty much take the NOTICE file form s2n-tls. Resolve the check-clang-format issue. Then check in with Micheal to check that this regression will be run at the correct time (which I presume is default never, but perhaps when some specific long-running tests are selected). Also, ask Michael how to mark it as expected to fail, because if run to completion he does report fails and if those are expected we don't want folks to investigate. |
Done. |
Done.
Done.
Done.
@tautschnig Do you know the what we want to do with this in regression? |
We could tag it as My take on this test is that we need to either keep this PR open for the foreseeable future or merge it as is an create an accompanying issue for someone to diagnose what is actually going on here. |
I would like to:
|
8c73988
to
97638f2
Compare
@tautschnig How do we tag this as FUTURE if the examples are self-contained with their own makefiles? |
I've added a new subfolder containing a new minimized example that Remi constructed. It completely removes function contracts from the problem and now reaches an error state much sooner. In both examples now (the original and the minimized), we're having a memory out during conversion to SAT after producing SSA. |
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.
Should this now be two separate regressions?
|
||
make veryclean && make result | ||
|
||
This creates a large problem during symbolic execution and solving. |
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.
Is this an accurate description of the minimized version? Doesn't seem right.
|
||
This creates a large problem during symbolic execution and solving. | ||
|
||
This test is currently not included in the any regression. |
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.
This one could be, right, because it's not slow, just bad?
@@ -0,0 +1,722 @@ | |||
/* |
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.
Do we still need this in the minimized version?
Does this make it possible to just add it to regular regression tests? We could then make use of the tags (KNOWNBUG or FUTURE). |
97638f2
to
5357db4
Compare
The minimized example from diffblue#7357 resulted in an invariant failure in `solvers/flattening/boolbv_add_sub.cpp`, reporting "add/sub with mixed types." This was caused by simplifying nested byte-extract operations where one used unsigned offsets and the other one signed. Since we do not required a particular type for byte-extract offsets we must cope with different offset types when folding nested byte-extract operations into a single one.
This avoids repeatedly visiting already-simplified operands. On the example from diffblue#7357 this reduces symex time from 1172 seconds to 922 seconds.
This is a performance-improving refactoring: We only need the result of a `has_subtype` call under conditions that are infrequently met. On the benchmark of diffblue#7357, this avoids 443214 calls of `has_subtype`, which previously was the most costly part of `simplify_byte_extract`.
This is a performance-improving refactoring: We only need the result of a `has_subtype` call under conditions that are infrequently met. On the benchmark of diffblue#7357, this avoids 443214 calls of `has_subtype`, which previously was the most costly part of `simplify_byte_extract`.
When `get_value_set_rec` discovers a nondet symbol it will consider the pointer pointing to any of the known objects (as of 3789670). It suffices to do this once for each run of `get_value_set`, even when multiple nondet symbols are encountered while traversing an expression. This reduces the symex time on the test of diffblue#7357 from 930 seconds to 404 seconds.
This avoids repeatedly visiting already-simplified operands. On the example from diffblue#7357 this reduces symex time from 1172 seconds to 922 seconds.
See #7378 (comment) for an analysis of the performance problems surfaced by this test. Next steps are to get #7716 and #7395 merged. |
When `get_value_set_rec` discovers a nondet symbol it will consider the pointer pointing to any of the known objects (as of 3789670). It suffices to do this once for each run of `get_value_set`, even when multiple nondet symbols are encountered while traversing an expression. This reduces the symex time on the test of diffblue#7357 from 930 seconds to 404 seconds.
When `get_value_set_rec` discovers a nondet symbol it will consider the pointer pointing to any of the known objects (as of 3789670). It suffices to do this once for each run of `get_value_set`, even when multiple nondet symbols are encountered while traversing an expression. This reduces the symex time on the test of diffblue#7357 from 930 seconds to 404 seconds.
With 6f3c16c this example now works as expected, although memory consumption likely remains too high to do these tests on a GitHub runner.
I tried to run the minimized example on revision d60295d (which is the base that this PR is built on top of), but had to abort the test after 25 minutes (during post-processing) when memory consumption exceeded 512 GB of RAM. Given the memory consumption, I am wondering whether it makes sense to add the minimized variant as a THOROUGH test, but I am concerned that we still wouldn't be able to run it on any system other GitHub's MacOS runners (which feature 14 GB of memory). |
This avoids repeatedly visiting already-simplified operands. On the example from diffblue#7357 this reduces symex time from 1172 seconds to 922 seconds.
This avoids repeatedly visiting already-simplified operands. On the example from diffblue#7357 this reduces symex time from 1172 seconds to 922 seconds.
DO NOT MERGE.
This is a standalone example of a problem encountered with function contracts during investigation of s2n-tls API-level functions. Licensing should be resolved.
We need to merge #7395 first.