[thread-safety][experimental] switch access path may-alias condition to syntactic equality

Reviewed By: peterogithub

Differential Revision: D5858783

fbshipit-source-id: e74a64b
master
Sam Blackshear 7 years ago committed by Facebook Github Bot
parent 71cf1760c5
commit afb04cf459

@ -52,7 +52,6 @@ let compare_modulo_this x y =
else if String.equal "this" (Mangled.to_string x.pv_name) then 0
else compare_pvar_kind x.pv_kind y.pv_kind
let equal = [%compare.equal : t]
let pp_translation_unit fmt = function

@ -1549,10 +1549,8 @@ module MayAliasQuotientedAccessListMap : QuotientedAccessListMap = struct
match (List.last_exn (snd p1), List.last_exn (snd p2)) with
| FieldAccess _, ArrayAccess _ | ArrayAccess _, FieldAccess _ ->
false
(* fields in Java contain the class name /declaring/ them
thus two fields can be aliases *iff* they are equal *)
| FieldAccess f1, FieldAccess f2 ->
Typ.Fieldname.equal f1 f2
| FieldAccess _, FieldAccess _ ->
syntactic_equal_access_path tenv p1 p2
(* if arrays of objects that have an inheritance rel then they can alias *)
| ( ArrayAccess ({desc= Tptr ({desc= Tstruct tn1}, _)}, _)
, ArrayAccess ({desc= Tptr ({desc= Tstruct tn2}, _)}, _) ) ->

@ -1,5 +1,3 @@
codetoanalyze/java/racerd/Alias.java, void Alias.bar(A,A), 5, THREAD_SAFETY_VIOLATION, [<Read trace>,access to `&b.A.f`,<Write trace>,access to `&this.Alias.a.A.f`]
codetoanalyze/java/racerd/Alias.java, void Alias.foo(), 6, THREAD_SAFETY_VIOLATION, [<Read trace>,access to `&this.Alias.b.A.f`,<Write trace>,access to `&this.Alias.a.A.f`]
codetoanalyze/java/racerd/AndroidModels.java, void AndroidModels.someResourceMethodsNotFunctionalBad(), 2, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.AndroidModels.mField`]
codetoanalyze/java/racerd/Annotations.java, boolean Annotations.FP_functionalAcrossUnboxingOk(), 2, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.Annotations.mBool2`]
codetoanalyze/java/racerd/Annotations.java, double Annotations.functionalDoubleBad(), 2, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.Annotations.mDouble`]
@ -11,13 +9,13 @@ codetoanalyze/java/racerd/Annotations.java, void Annotations.functionalAndNonfun
codetoanalyze/java/racerd/Annotations.java, void Annotations.mutateOffUiThreadBad(), 1, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.Annotations.f`]
codetoanalyze/java/racerd/Annotations.java, void Annotations.mutateSubfieldOfConfinedBad(), 1, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.Annotations.encapsulatedField.codetoanalyze.java.checkers.Obj.f`]
codetoanalyze/java/racerd/Annotations.java, void Annotations.read_from_non_confined_method_Bad(), 2, THREAD_SAFETY_VIOLATION, [<Read trace>,access to `&this.codetoanalyze.java.checkers.Annotations.zz`,<Write trace>,access to `&this.codetoanalyze.java.checkers.Annotations.zz`]
codetoanalyze/java/racerd/Annotations.java, void Annotations.read_off_UI_thread_Bad(), 1, THREAD_SAFETY_VIOLATION, [<Read trace>,access to `&this.codetoanalyze.java.checkers.Annotations.f`,<Write trace>,call to void Annotations.setF(Object),access to `&this.codetoanalyze.java.checkers.Annotations.f`]
codetoanalyze/java/racerd/Annotations.java, void Annotations.read_off_UI_thread_Bad(), 1, THREAD_SAFETY_VIOLATION, [<Read trace>,access to `&this.codetoanalyze.java.checkers.Annotations.f`,<Write trace>,access to `&this.codetoanalyze.java.checkers.Annotations.f`]
codetoanalyze/java/racerd/Annotations.java, void ThreadSafeAlias.threadSafeAliasBad1(), 1, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.ThreadSafeAlias.field`]
codetoanalyze/java/racerd/Annotations.java, void ThreadSafeAlias.threadSafeAliasBad2(), 1, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.ThreadSafeAlias.field`]
codetoanalyze/java/racerd/Arrays.java, String Arrays.readWriteRaceBad(String), 4, THREAD_SAFETY_VIOLATION, [<Read trace>,access to `&this.Arrays.strArr1.[_]`,<Write trace>,access to `&this.Arrays.strArr1.[_]`]
codetoanalyze/java/racerd/Arrays.java, void Arrays.arrayParameterWriteBad(int[]), 1, THREAD_SAFETY_VIOLATION, [access to `&name1.[_]`]
codetoanalyze/java/racerd/Arrays.java, void Arrays.writeWriteRaceBad(String), 1, THREAD_SAFETY_VIOLATION, [access to `&this.Arrays.strArr1.[_]`]
codetoanalyze/java/racerd/Builders.java, Builders$Obj Builders.buildThenMutateBad(Builders$Obj), 2, THREAD_SAFETY_VIOLATION, [<Read trace>,call to Builders$Obj$Builder Builders$Obj$Builder.setFromObj(Builders$Obj),access to `&input.codetoanalyze.java.checkers.Builders$Obj.g`,<Write trace>,access to `&o.codetoanalyze.java.checkers.Builders$Obj.g`]
codetoanalyze/java/racerd/Builders.java, Builders$Obj Builders.buildThenMutateBad(Builders$Obj), 2, THREAD_SAFETY_VIOLATION, [<Read trace>,call to Builders$Obj$Builder Builders$Obj$Builder.setFromObj(Builders$Obj),access to `&input.codetoanalyze.java.checkers.Builders$Obj.g`,<Write trace>,access to `&input.codetoanalyze.java.checkers.Builders$Obj.g`]
codetoanalyze/java/racerd/Builders.java, Builders$Obj Builders.buildThenMutateBad(Builders$Obj), 3, THREAD_SAFETY_VIOLATION, [access to `&input.codetoanalyze.java.checkers.Builders$Obj.g`]
codetoanalyze/java/racerd/Builders.java, Builders$Obj Builders.mutateBad(Builders$Obj), 1, THREAD_SAFETY_VIOLATION, [access to `&o.codetoanalyze.java.checkers.Builders$Obj.g`]
codetoanalyze/java/racerd/Builders.java, void TopLevelBuilder.setG(String), 1, THREAD_SAFETY_VIOLATION, [access to `&this.codetoanalyze.java.checkers.TopLevelBuilder.g`]

Loading…
Cancel
Save