[starvation] allow propagation of order constraints to any class

Summary:
An order constraint (A,B) means we take lock A and before releasing it we perform B (whatever that is).
Previously if a method call crossed class boundaries, we removed the callee's order constraints before integrating the callee's summary to that of the caller.  The reasoning was that this may lead to reports blaming a caller for something they are very far from, plus a proliferation of reports with the same bad endpoint.

The first reason still applies, but this is a general problem.  It may be better to report and let developers deal with it.
The second reason is moot, since in differential mode most of these reports are hidden.

Reviewed By: jberdine

Differential Revision: D10173200

fbshipit-source-id: 9afbf292c
master
Nikos Gorogiannis 6 years ago committed by Facebook Github Bot
parent e3efc0e465
commit 8521d7590a

@ -48,16 +48,6 @@ let lock_of_class class_id =
AccessPath.of_id ident typ'
let is_call_to_superclass tenv ~caller ~callee =
match (caller, callee) with
| Typ.Procname.Java caller_method, Typ.Procname.Java callee_method ->
let caller_type = Typ.Procname.Java.get_class_type_name caller_method in
let callee_type = Typ.Procname.Java.get_class_type_name callee_method in
PatternMatch.is_subtype tenv caller_type callee_type
| _ ->
L.(die InternalError "Not supposed to run on non-Java code.")
module TransferFunctions (CFG : ProcCfg.S) = struct
module CFG = CFG
module Domain = StarvationDomain
@ -116,15 +106,8 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
Domain.blocking_call ~caller ~callee sev loc astate
| None ->
Payload.read pdesc callee
|> Option.value_map ~default:astate ~f:(fun summary ->
(* if not calling a method in a superclass then set order to empty
to avoid blaming a caller in one class for deadlock/starvation
happening in the callee class *)
let summary =
if is_call_to_superclass tenv ~caller ~callee then summary
else {summary with Domain.order= Domain.OrderDomain.empty}
in
Domain.integrate_summary astate callee loc summary ) ) )
|> Option.value_map ~default:astate ~f:(Domain.integrate_summary astate callee loc) )
)
| _ ->
astate

Loading…
Cancel
Save