@@ -1356,30 +1356,62 @@ Static Analyzer
13561356New features
13571357^^^^^^^^^^^^
13581358
1359- - Now CSA models ` __builtin_*_overflow ` functions. (#GH102602)
1359+ - The `` __builtin_*_overflow `` functions are now properly modeled . (#GH102602)
13601360
1361- - MallocChecker now checks for ``ownership_returns(class, idx) `` and ``ownership_takes(class, idx) ``
1362- attributes with class names different from "malloc". Clang static analyzer now reports an error
1363- if class of allocation and deallocation function mismatches.
1361+ - `` unix.Malloc `` now checks for ``ownership_returns(class, idx) `` and ``ownership_takes(class, idx) ``
1362+ attributes with class names different from "malloc". It now reports an error
1363+ if the class of allocation and deallocation function mismatches.
13641364 `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-mismatcheddeallocator-c-c >`__.
13651365
13661366- Function effects, e.g. the ``nonblocking `` and ``nonallocating `` "performance constraint"
13671367 attributes, are now verified. For example, for functions declared with the ``nonblocking ``
1368- attribute, the compiler can generate warnings about the use of any language features, or calls to
1368+ attribute, the compiler can generate warnings about the use of any language features or calls to
13691369 other functions, which may block.
13701370
13711371- Introduced ``-warning-suppression-mappings `` flag to control diagnostic
1372- suppressions per file. See `documentation <https://clang.llvm.org/docs/WarningSuppressionMappings.html>_ ` for details.
1372+ suppressions per file. See `documentation <https://clang.llvm.org/docs/WarningSuppressionMappings.html >`__ for details.
1373+
1374+ - Started to model GCC asm statements in some basic way. (#GH103714, #GH109838)
13731375
13741376Crash and bug fixes
13751377^^^^^^^^^^^^^^^^^^^
13761378
13771379- In loops where the loop condition is opaque (i.e. the analyzer cannot
13781380 determine whether it's true or false), the analyzer will no longer assume
1379- execution paths that perform more that two iterations. These unjustified
1381+ execution paths that perform more than two iterations. These unjustified
13801382 assumptions caused false positive reports (e.g. 100+ out-of-bounds reports in
13811383 the FFMPEG codebase) in loops where the programmer intended only two or three
13821384 steps but the analyzer wasn't able to understand that the loop is limited.
1385+ Read the `RFC <https://discourse.llvm.org/t/loop-handling-improvement-plans/80417/17 >`_
1386+ for details. (#GH119388)
1387+
1388+ - In clang-19, the ``crosscheck-with-z3-timeout-threshold `` was set to 300ms,
1389+ but it is now reset back to 15000, aka. 15 seconds. This is to reduce the
1390+ number of flaky diagnostics due to Z3 query timeouts.
1391+ If you are affected, read the details at #GH118291 carefully.
1392+
1393+ - Same as the previous point, but for ``crosscheck-with-z3-rlimit-threshold ``
1394+ and ``crosscheck-with-z3-eqclass-timeout-threshold ``.
1395+ This option is now set to zero, aka. disabled by default. (#GH118291)
1396+
1397+ - Fixed a crash in the ``unix.Stream `` checker when modeling ``fread ``. (#GH108393)
1398+
1399+ - Fixed a crash in the ``core.StackAddressEscape `` checker related to ``alloca ``.
1400+ Fixes (#GH107852).
1401+
1402+ - Fixed a crash when invoking a function pointer cast from some non-function pointer. (#GH111390)
1403+
1404+ - Fixed a crash when modeling some ``ArrayInitLoopExpr ``. Fixes (#GH112813).
1405+
1406+ - Fixed a crash in loop unrolling. Fixes (#GH121201).
1407+
1408+ - The iteration orders of some internal representations of symbols were changed
1409+ to make their internal ordering more stable. This should improve determinism.
1410+ This also reduces the number of flaky reports exposed by the Z3 query timeouts.
1411+ (#GH121749)
1412+
1413+ - The ``unix.BlockInCriticalSection `` now recognizes the ``lock() `` member function
1414+ as expected, even if it's inherited from a base class. Fixes (#GH104241).
13831415
13841416Improvements
13851417^^^^^^^^^^^^
@@ -1388,6 +1420,40 @@ Improvements
13881420 error if the attribute is attached to a function that returns a non-pointer value.
13891421 Fixes (#GH99501)
13901422
1423+ - Improved the escape heuristics of member variables of non-trivial std types. (#GH100405)
1424+ Also when invoking an opaque member function. (#GH111138)
1425+
1426+ - Improved the ``nullability.NullReturnedFromNonnull `` checker by reporting
1427+ more violations of the ``returns_nonnull `` attribute.
1428+ `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#nullability-nullreturnedfromnonnull-c-c-objc >`_.
1429+ (#GH106048)
1430+
1431+ - The ``unix.Stream `` checker now notes the last ``fclose `` call in the diagnostics. (#GH109112)
1432+
1433+ - The ``core.StackAddressEscape `` checker now detects more leak issues through output
1434+ parameters and global variables. (#GH105653, #GH105648, #GH107003) Fixes (#GH106834).
1435+
1436+ - The ``unix.Malloc `` checker was made more consistent with the
1437+ `ownership attributes <https://clang.llvm.org/docs/AttributeReference.html#analyzer-ownership-attrs >`_.
1438+ (#GH104599, #GH110115) This also fixed #GH104229.
1439+
1440+ - The number of false-positive reports of ``alpha.core.FixedAddr `` checker was slightly reduced.
1441+ (#GH108993, #GH110458)
1442+
1443+ - Improved the default (range-based) solver by reasoning about more commutative
1444+ operations, and better deducing some concrete values from their known ranges.
1445+ (#GH112583, #GH112887, #GH115579)
1446+
1447+ - A new option ``crosscheck-with-z3-max-attempts-per-query `` should help
1448+ reducing the number of flaky reports if Z3 query timeouts are used.
1449+ By default, Z3 queries are attempted at most 3 times, giving it more chances,
1450+ thus reducing number of flaky issues on timeouts. Read the details in this
1451+ `RFC <https://discourse.llvm.org/t/analyzer-rfc-retry-z3-crosscheck-queries-on-timeout/83711 >`__.
1452+ (#GH120239)
1453+
1454+ - The resulting pointer of ``fread `` is now known to never alias with the
1455+ pointers of ``stdin ``, ``stdout `` or ``stderr ``. (#GH100085)
1456+
13911457Moved checkers
13921458^^^^^^^^^^^^^^
13931459
@@ -1400,21 +1466,35 @@ Moved checkers
14001466 To detect too large arguments passed to malloc, consider using the checker
14011467 ``alpha.taint.TaintedAlloc ``.
14021468
1403- - The checkers ``alpha.nondeterministic.PointerSorting `` and
1469+ - Both ``alpha.nondeterministic.PointerSorting `` and
14041470 ``alpha.nondeterministic.PointerIteration `` were moved to a new bugprone
14051471 checker named ``bugprone-nondeterministic-pointer-iteration-order ``. The
14061472 original checkers were implemented only using AST matching and make more
14071473 sense as a single clang-tidy check.
14081474
1409- - The checker ``alpha.unix.Chroot `` was modernized, improved and moved to
1410- ``unix.Chroot ``. Testing was done on open source projects that use chroot(),
1411- and false issues addressed in the improvements based on real use cases. Open
1412- source projects used for testing include nsjail, lxroot, dive and ruri.
1475+ - The checker ``alpha.unix.Chroot `` was modernized, improved, and moved to
1476+ ``unix.Chroot ``. Testing was done on open- source projects that use chroot(),
1477+ and false issues addressed in the improvements based on real use cases.
1478+ Open- source projects used for testing include `` nsjail ``, `` lxroot ``, `` dive `` and `` ruri `` .
14131479 This checker conforms to SEI Cert C recommendation `POS05-C. Limit access to
14141480 files by creating a jail
14151481 <https://wiki.sei.cmu.edu/confluence/display/c/POS05-C.+Limit+access+to+files+by+creating+a+jail> `_.
14161482 Fixes (#GH34697).
1417- (#GH117791) [Documentation](https://clang.llvm.org/docs/analyzer/checkers.html#unix-chroot-c).
1483+ (#GH117791) `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-chroot-c >`__.
1484+
1485+ - The checker ``alpha.core.PointerSub `` was moved to ``security.PointerSub ``
1486+ after it was significantly improved in #GH96501, #GH102580, #GH111846.
1487+
1488+ - The checker ``alpha.security.MmapWriteExec `` was moved to ``security.MmapWriteExec ``.
1489+
1490+ - The checker ``alpha.unix.cstring.NotNullTerminated `` was moved to ``unix.cstring.NotNullTerminated ``.
1491+
1492+ - The division by tainted value diagnostic was split from the checker ``core.DivideZero ``
1493+ into a separate checker ``optin.taint.TaintedDiv ``. (#GH106389)
1494+
1495+ - Both ``alpha.security.taint.TaintPropagation `` and ``alpha.security.taint.GenericTaint ``
1496+ were moved to ``optin.taint.TaintPropagation `` and ``optin.taint.GenericTaint `` respectively.
1497+ (#GH67352)
14181498
14191499.. _release-notes-sanitizers :
14201500
0 commit comments