-
Notifications
You must be signed in to change notification settings - Fork 84
Improve MHP precision using ancestor locksets #1865
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: master
Are you sure you want to change the base?
Conversation
…ter-proc lock regression tests
…ion lockset analyses
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.
Some general questions:
- Is there a way to enforce configuration settings to be set to certain values in order for the analysis to work (i.e. similar to how analyses can be declared as dependencies)? This would be necessary for the settings revolving around thread ids as described in the pr summary. Checking settings using
GobConfig.get_stringat the start of transfer functions doesn't really seem ideal to me - is there an ideal amount of tests I should write or can I write as many as I feel to be necessary?
| match tid_lifted, child_tid_lifted with | ||
| | `Lifted tid, `Lifted child_tid -> | ||
| let descendants = descendants_closure child_ask child_tid in | ||
| let lockset = ask.f Queries.MustLockset in | ||
| let to_contribute = cartesian_prod (TIDs.singleton tid) lockset in | ||
| TIDs.iter (contribute_lock man to_contribute) descendants | ||
| | _ -> (* TODO deal with top or bottom? *) () |
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.
What does it mean for a thread id to be top or bottom? Not sure how to deal with this here and in some other places
|
As many as necessary to cover all the functionality and ideally the corner cases of the domains/analyses. |
…et analyses to must lock domain
that's what I needed, nice :D |
I'm going to add some more in the coming days 👍 |
|
The ci builds failed due to an incorrect semi colon. I fixed this in f1efd32, so everything should be working now |
First part of #1805.
Second case will be handled in a separate PR.
To be handled
Non-transitive version
When creating$t_1$ , $t_0$ must hold a lock $l$ . If $l$ is not released before $t_1$ is definitely joined into $t_0$ , $t_1$ is protected by $l$ .
Examples
graph TB; subgraph t1; E["..."]-->F["return;"]; end; subgraph t0; A["lock(l);"]-->B; B["create(t1);"]-->C; C["join(t1);"]-->D["unlock(l);"] end; B-.->E F-.->Cgraph TB; subgraph t1; E["..."]-->F["return;"]; end; subgraph t0; A["lock(l);"]-->B; B["create(t1);"]-->C[return;]; end; B-.->EGeneral version
Let$t_d$ be a may-descendant of $t_1$ . When creating $t_1$ , $t_0$ must hold a lock $l$ . If $l$ is not released before $t_d$ is definitely joined into $t_0$ , $t_d$ is protected by $l$ .
Example
graph TB; subgraph td; G["..."]-->H["return;"]; end; subgraph t1; E["create(td);"]-->F["return;"]; end; subgraph t0; A["lock(l);"]-->B; B["create(t1);"]-->C; C["join(td);"]-->D["unlock(l);"] end; B-.->E E-.->G H-.->CDependency Analyses
ana.thread.domainset to "history" andana.thread.include-nodeandana.thread.context.create-edgesboth enabledConditions to satisfy
create(t1)increate(t1)inunlock(l)inAnalyses
Creation Lockset
Contributions
create(t1):Tainted Creation Lockset
Contributions
unlock(l):Rules for MHP exclusion
Let$\mathcal{IL}(t):=\mathcal{CL}(t)\setminus\mathcal{TCL}(t)$ .$s_1$ with $\mathcal T_1$ , $\mathcal L_1$ and $\mathcal{IL}_1$ and $s_2$ with $\mathcal T_2$ , $\mathcal L_2$ and $\mathcal{IL}_2$ cannot happen in parallel if at least one condition holds:
Program points
Notes on non-unique thread ids
By requiring thread ids to include the full history and the creation point, we work around the problem of incorrectly marking two program points as sequential because of an ambiguous creation history. Notes on some edge cases:
Ambiguity due to multiple thread creations in one thread
graph TB; A((t1))-->B((t2)); A-->B;If$l$ is included at only some, but not all locksets at $t_1$ , the analysis would not work. However, since we include the creation node in the thread id, this case is impossible.
create(t2)statements inAmbiguity due to diamond-like thread creations
graph TB; A((t1))-->B((t2)); A-->C((t3)); B-->D((t4)); C-->D;If$t_4$ were marked as protected by $t_2$ only, this would be incorrect, since a creation via $t_3$ is also possible. Though, this cannot happen, since $t_4$ would have two different histories (each following a path of the diamond) and thus two different thread ids.
Ambiguity due to circular thread creations
graph TB; A((t1))-->B((t2)); B-->C((t3)); C-->B;Marking$t_2$ as protected by $t_3$ would be problematic, since the loop does not need to be entered at all. However, the first iteration of circular loops still receives a non-unique thread id which is not marked as a descendant of $t_3$ , so problematic program points in $t_2$ are flagged as racing nevertheless.