Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Partially fix unsound join for
top
with empty environment inApronDomain
#1354Partially fix unsound join for
top
with empty environment inApronDomain
#1354Changes from all commits
978b5e6
554a5f0
2311795
8848276
d2ffcf0
b57fd0f
8787f59
05bd808
c008b83
5f7ce7f
b0465a2
171443b
6c4742c
db019b5
cdca6b7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 not just a workaround for the actual bug? Seems like escapes should also contribute to
mutex_inits
.BasePriv.PerMutexPrivBase
andBasePriv.PerMutexMeetTIDPriv
side-effect escapes tomutex_inits
at least.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.
Yes, in the base priv this is all not problematic, as it is non-relational. Here, this all becomes fragile, and I think for now we are wise to avoid the set of variables at global unknowns not only shrinking (due to decreasing protection) but also increasing in non-obvious matters due to escapes also being tracked associated with
mutex_inits
which is supposed to abstract the state at program start. Maybe this is also something for #1380.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 sounds like some bottom-top confusion again: if there are no globals (i.e. the environment is empty), then don't side-effect (i.e. side-effect bottom) instead of side-effecting top.
Conditionally flipping a top to bottom seems inconsistent with all other values.
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.
I still think it's conceptually the right thing to do and not just a hack.
The thing is that we abuse the presence of globals in the relation as a no-overhead way to track whether one of the threads being joined possibly was in single-threaded mode.
If none of these threads was single-threaded (
g_vars = []
), all initial values are guaranteed to have been published and no side -effect is needed.Does this make sense? If yes, I can write a comment detailing this reasoning.
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.
How so? We explicitly check the
MustBeSingleThreaded
query right before this. Prior to this, nothing is conditional ong_vars = []
.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 is the case of branched thread creation.
Q.MustBeSingleThreaded
is false, and the globals from the single-threaded side of the join need need to be published. In this case, potentially,g_vars <> []
. Ifg_vars = []
there are no globals, and not causing a side-effect is ok.g_vars = []
. EarlierThere 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.
Being multi-threaded doesn't imply
g_vars = []
, though.Special-casing
[]
to flip the lattice is not a natural extension of the behavior on all other environments. I'm afraid we're setting ourselves up for a similar issue about top-bottom confusion that we're trying to fix here.Suppose the global unknown has a non-bottom relation$R_{\{x\}}$ (on the environment $\{x\}$ ) and we're side-effecting $\top_\emptyset$ (on the empty environment). What is the join of these two relations?
It therefore follows that$R_{\{x\}}$ itself is an upper bound of $R_{\{x\}}$ and $\top_\emptyset$ . Since it's equal to one of the arguments, it's obviously also the least upper bound of the two.
So side-effecting$\top_\emptyset$ should be a no-op (and this special case is not needed) if we have the right lattice. If it isn't, then we still don't have the lattice fully right. And that is completely independent from whatever thread-modular analysis we might be doing: it's just a relational domain property.
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.
Principled fix is delayed to #1380.