Skip to content

Commit 1c660ca

Browse files
steakhalNagyDonat
andauthored
[analyzer][docs] CSA release notes for clang-20 (#124798)
The commits were gathered using: ```sh git log --reverse --oneline llvmorg-20-init..llvm/main \ clang/{lib/StaticAnalyzer,include/clang/StaticAnalyzer} | grep -v NFC | grep -v OpenACC | grep -v -i revert ``` After this I categorized the changes and dropped the less user-facing commits. FYI, I also ignored Webkit changes because I assue it's fairly specific for them, and they likely already know what they ship xD. I used the `LLVM_ENABLE_SPHINX=ON` and `LLVM_ENABLE_DOXYGEN=ON` cmake options to enable the `docs-clang-html` build target, which generates the html into `build/tools/clang/docs/html/ReleaseNotes.html` of which I attach the screenshots to let you judge if it looks all good or not. I also used Grammarly this time to check for blatant typos. --------- Co-authored-by: Donát Nagy <[email protected]>
1 parent c560d6f commit 1c660ca

File tree

1 file changed

+92
-13
lines changed

1 file changed

+92
-13
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 92 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,30 +1356,61 @@ Static Analyzer
13561356
New 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

13741376
Crash 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+
(#GH119388)
1386+
1387+
- In clang-19, the ``crosscheck-with-z3-timeout-threshold`` was set to 300ms,
1388+
but it is now reset back to 15000, aka. 15 seconds. This is to reduce the
1389+
number of flaky diagnostics due to Z3 query timeouts.
1390+
If you are affected, read the details at #GH118291 carefully.
1391+
1392+
- Same as the previous point, but for ``crosscheck-with-z3-rlimit-threshold``
1393+
and ``crosscheck-with-z3-eqclass-timeout-threshold``.
1394+
This option is now set to zero, aka. disabled by default. (#GH118291)
1395+
1396+
- Fixed a crash in the ``unix.Stream`` checker when modeling ``fread``. (#GH108393)
1397+
1398+
- Fixed a crash in the ``core.StackAddressEscape`` checker related to ``alloca``.
1399+
Fixes (#GH107852).
1400+
1401+
- Fixed a crash when invoking a function pointer cast from some non-function pointer. (#GH111390)
1402+
1403+
- Fixed a crash when modeling some ``ArrayInitLoopExpr``. Fixes (#GH112813).
1404+
1405+
- Fixed a crash in loop unrolling. Fixes (#GH121201).
1406+
1407+
- The iteration orders of some internal representations of symbols were changed
1408+
to make their internal ordering more stable. This should improve determinism.
1409+
This also reduces the number of flaky reports exposed by the Z3 query timeouts.
1410+
(#GH121749)
1411+
1412+
- The ``unix.BlockInCriticalSection`` now recognizes the ``lock()`` member function
1413+
as expected, even if it's inherited from a base class. Fixes (#GH104241).
13831414

13841415
Improvements
13851416
^^^^^^^^^^^^
@@ -1388,6 +1419,40 @@ Improvements
13881419
error if the attribute is attached to a function that returns a non-pointer value.
13891420
Fixes (#GH99501)
13901421

1422+
- Improved the escape heuristics of member variables of non-trivial std types. (#GH100405)
1423+
Also when invoking an opaque member function. (#GH111138)
1424+
1425+
- Improved the ``nullability.NullReturnedFromNonnull`` checker by reporting
1426+
more violations of the ``returns_nonnull`` attribute.
1427+
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#nullability-nullreturnedfromnonnull-c-c-objc>`_.
1428+
(#GH106048)
1429+
1430+
- The ``unix.Stream`` checker now notes the last ``fclose`` call in the diagnostics. (#GH109112)
1431+
1432+
- The ``core.StackAddressEscape`` checker now detects more leak issues through output
1433+
parameters and global variables. (#GH105653, #GH105648, #GH107003) Fixes (#GH106834).
1434+
1435+
- The ``unix.Malloc`` checker was made more consistent with the
1436+
`ownership attributes <https://clang.llvm.org/docs/AttributeReference.html#analyzer-ownership-attrs>`_.
1437+
(#GH104599, #GH110115) This also fixed #GH104229.
1438+
1439+
- The number of false-positive reports of ``alpha.core.FixedAddr`` checker was slightly reduced.
1440+
(#GH108993, #GH110458)
1441+
1442+
- Improved the default (range-based) solver by reasoning about more commutative
1443+
operations, and better deducing some concrete values from their known ranges.
1444+
(#GH112583, #GH112887, #GH115579)
1445+
1446+
- A new option ``crosscheck-with-z3-max-attempts-per-query`` should help
1447+
reducing the number of flaky reports if Z3 query timeouts are used.
1448+
By default, Z3 queries are attempted at most 3 times, giving it more chances,
1449+
thus reducing number of flaky issues on timeouts. Read the details in this
1450+
`RFC <https://discourse.llvm.org/t/analyzer-rfc-retry-z3-crosscheck-queries-on-timeout/83711>`__.
1451+
(#GH120239)
1452+
1453+
- The resulting pointer of ``fread`` is now known to never alias with the
1454+
pointers of ``stdin``, ``stdout`` or ``stderr``. (#GH100085)
1455+
13911456
Moved checkers
13921457
^^^^^^^^^^^^^^
13931458

@@ -1400,21 +1465,35 @@ Moved checkers
14001465
To detect too large arguments passed to malloc, consider using the checker
14011466
``alpha.taint.TaintedAlloc``.
14021467

1403-
- The checkers ``alpha.nondeterministic.PointerSorting`` and
1468+
- Both ``alpha.nondeterministic.PointerSorting`` and
14041469
``alpha.nondeterministic.PointerIteration`` were moved to a new bugprone
14051470
checker named ``bugprone-nondeterministic-pointer-iteration-order``. The
14061471
original checkers were implemented only using AST matching and make more
14071472
sense as a single clang-tidy check.
14081473

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.
1474+
- The checker ``alpha.unix.Chroot`` was modernized, improved, and moved to
1475+
``unix.Chroot``. Testing was done on open-source projects that use chroot(),
1476+
and false issues addressed in the improvements based on real use cases.
1477+
Open-source projects used for testing include ``nsjail``, ``lxroot``, ``dive`` and ``ruri``.
14131478
This checker conforms to SEI Cert C recommendation `POS05-C. Limit access to
14141479
files by creating a jail
14151480
<https://wiki.sei.cmu.edu/confluence/display/c/POS05-C.+Limit+access+to+files+by+creating+a+jail>`_.
14161481
Fixes (#GH34697).
1417-
(#GH117791) [Documentation](https://clang.llvm.org/docs/analyzer/checkers.html#unix-chroot-c).
1482+
(#GH117791) `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-chroot-c>`__.
1483+
1484+
- The checker ``alpha.core.PointerSub`` was moved to ``security.PointerSub``
1485+
after it was significantly improved in #GH96501, #GH102580, #GH111846.
1486+
1487+
- The checker ``alpha.security.MmapWriteExec`` was moved to ``security.MmapWriteExec``.
1488+
1489+
- The checker ``alpha.unix.cstring.NotNullTerminated`` was moved to ``unix.cstring.NotNullTerminated``.
1490+
1491+
- The division by tainted value diagnostic was split from the checker ``core.DivideZero``
1492+
into a separate checker ``optin.taint.TaintedDiv``. (#GH106389)
1493+
1494+
- Both ``alpha.security.taint.TaintPropagation`` and ``alpha.security.taint.GenericTaint``
1495+
were moved to ``optin.taint.TaintPropagation`` and ``optin.taint.GenericTaint`` respectively.
1496+
(#GH67352)
14181497

14191498
.. _release-notes-sanitizers:
14201499

0 commit comments

Comments
 (0)