diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index fd0dd70ac6..c0f011e74b 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -634,7 +634,6 @@ OPTIONS DATA_FLOW_TO_SINK (disabled by default), DEADLOCK (enabled by default), DEAD_STORE (enabled by default), - DISPATCH_ONCE_IN_STATIC_INIT (disabled by default), DIVIDE_BY_ZERO (disabled by default), DO_NOT_REPORT (enabled by default), EMPTY_VECTOR_ACCESS (enabled by default), @@ -747,6 +746,7 @@ OPTIONS SKIP_FUNCTION (disabled by default), STACK_VARIABLE_ADDRESS_ESCAPE (enabled by default), STARVATION (enabled by default), + STATIC_CONSTRUCTOR_STALL (disabled by default), STATIC_INITIALIZATION_ORDER_FIASCO (enabled by default), STRICT_MODE_VIOLATION (enabled by default), STRONG_SELF_NOT_CHECKED (enabled by default), diff --git a/infer/man/man1/infer-report.txt b/infer/man/man1/infer-report.txt index 9a650561f1..1676212879 100644 --- a/infer/man/man1/infer-report.txt +++ b/infer/man/man1/infer-report.txt @@ -149,7 +149,6 @@ OPTIONS DATA_FLOW_TO_SINK (disabled by default), DEADLOCK (enabled by default), DEAD_STORE (enabled by default), - DISPATCH_ONCE_IN_STATIC_INIT (disabled by default), DIVIDE_BY_ZERO (disabled by default), DO_NOT_REPORT (enabled by default), EMPTY_VECTOR_ACCESS (enabled by default), @@ -262,6 +261,7 @@ OPTIONS SKIP_FUNCTION (disabled by default), STACK_VARIABLE_ADDRESS_ESCAPE (enabled by default), STARVATION (enabled by default), + STATIC_CONSTRUCTOR_STALL (disabled by default), STATIC_INITIALIZATION_ORDER_FIASCO (enabled by default), STRICT_MODE_VIOLATION (enabled by default), STRONG_SELF_NOT_CHECKED (enabled by default), diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index 20ac7b05b1..c3f3416f9e 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -634,7 +634,6 @@ OPTIONS DATA_FLOW_TO_SINK (disabled by default), DEADLOCK (enabled by default), DEAD_STORE (enabled by default), - DISPATCH_ONCE_IN_STATIC_INIT (disabled by default), DIVIDE_BY_ZERO (disabled by default), DO_NOT_REPORT (enabled by default), EMPTY_VECTOR_ACCESS (enabled by default), @@ -747,6 +746,7 @@ OPTIONS SKIP_FUNCTION (disabled by default), STACK_VARIABLE_ADDRESS_ESCAPE (enabled by default), STARVATION (enabled by default), + STATIC_CONSTRUCTOR_STALL (disabled by default), STATIC_INITIALIZATION_ORDER_FIASCO (enabled by default), STRICT_MODE_VIOLATION (enabled by default), STRONG_SELF_NOT_CHECKED (enabled by default), diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index 2276652355..8a6e99d556 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -571,12 +571,13 @@ let deadlock = ~user_documentation:[%blob "./documentation/issues/DEADLOCK.md"] -let dispatch_once_in_static_init = - register ~category:Concurrency ~enabled:false ~id:"DISPATCH_ONCE_IN_STATIC_INIT" - ~hum:"dispatch_once in static init" Error StaticConstructorStallChecker +let static_constructor_stall = + register ~category:Concurrency ~enabled:false ~id:"STATIC_CONSTRUCTOR_STALL" Error + StaticConstructorStallChecker ~user_documentation: - "Calling dispatch_once during the static initialization of objects is risky, for example it \ - could cause deadlocks, because other objects might not have been initialized yet." + "Calling certain methods, for instance dispatch_once, during the static initialization of \ + objects is risky. It could cause deadlocks, because other objects might not have been \ + initialized yet." let divide_by_zero = diff --git a/infer/src/base/IssueType.mli b/infer/src/base/IssueType.mli index d289deb2ae..58fe83e579 100644 --- a/infer/src/base/IssueType.mli +++ b/infer/src/base/IssueType.mli @@ -184,7 +184,7 @@ val dead_store : t val deadlock : t -val dispatch_once_in_static_init : t +val static_constructor_stall : t val divide_by_zero : t diff --git a/infer/src/checkers/StaticConstructorStallChecker.ml b/infer/src/checkers/StaticConstructorStallChecker.ml index 4871faf048..20bd6a98ea 100644 --- a/infer/src/checkers/StaticConstructorStallChecker.ml +++ b/infer/src/checkers/StaticConstructorStallChecker.ml @@ -35,7 +35,7 @@ module TransferFunctions = struct type analysis_data = Summary.t InterproceduralAnalysis.t - let pp_session_name _node fmt = F.pp_print_string fmt "DispatchOnceStaticInit" + let pp_session_name _node fmt = F.pp_print_string fmt "StaticConstructorStallChecker" let exec_instr (astate : Summary.t) {InterproceduralAnalysis.analyze_dependency} _cfg_node _ (instr : Sil.instr) = @@ -88,7 +88,7 @@ let report_issue proc_desc err_log trace_elems = (kind_to_string kind) Location.pp loc in Reporting.log_issue proc_desc err_log ~ltr ~loc StaticConstructorStallChecker - IssueType.dispatch_once_in_static_init message + IssueType.static_constructor_stall message let checker ({InterproceduralAnalysis.proc_desc; err_log} as analysis_data) = diff --git a/infer/tests/codetoanalyze/objc/static-constructor-stall/issues.exp b/infer/tests/codetoanalyze/objc/static-constructor-stall/issues.exp index e65683accf..907dd1ddae 100644 --- a/infer/tests/codetoanalyze/objc/static-constructor-stall/issues.exp +++ b/infer/tests/codetoanalyze/objc/static-constructor-stall/issues.exp @@ -1,3 +1,3 @@ -codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_bad, 1, DISPATCH_ONCE_IN_STATIC_INIT, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once] -codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_intraproc_bad, 3, DISPATCH_ONCE_IN_STATIC_INIT, no_bucket, ERROR, [macro expanded here,Call to _dispatch_once] -codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_condition_bad, 3, DISPATCH_ONCE_IN_STATIC_INIT, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once] +codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_bad, 1, STATIC_CONSTRUCTOR_STALL, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once] +codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_intraproc_bad, 3, STATIC_CONSTRUCTOR_STALL, no_bucket, ERROR, [macro expanded here,Call to _dispatch_once] +codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_condition_bad, 3, STATIC_CONSTRUCTOR_STALL, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once]