@@ -1356,30 +1356,61 @@ Static Analyzer
1356
1356
New features
1357
1357
^^^^^^^^^^^^
1358
1358
1359
- - Now CSA models ` __builtin_*_overflow ` functions. (#GH102602)
1359
+ - The `` __builtin_*_overflow `` functions are now properly modeled . (#GH102602)
1360
1360
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.
1364
1364
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-mismatcheddeallocator-c-c >`__.
1365
1365
1366
1366
- Function effects, e.g. the ``nonblocking `` and ``nonallocating `` "performance constraint"
1367
1367
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
1369
1369
other functions, which may block.
1370
1370
1371
1371
- 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)
1373
1375
1374
1376
Crash and bug fixes
1375
1377
^^^^^^^^^^^^^^^^^^^
1376
1378
1377
1379
- In loops where the loop condition is opaque (i.e. the analyzer cannot
1378
1380
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
1380
1382
assumptions caused false positive reports (e.g. 100+ out-of-bounds reports in
1381
1383
the FFMPEG codebase) in loops where the programmer intended only two or three
1382
1384
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).
1383
1414
1384
1415
Improvements
1385
1416
^^^^^^^^^^^^
@@ -1388,6 +1419,40 @@ Improvements
1388
1419
error if the attribute is attached to a function that returns a non-pointer value.
1389
1420
Fixes (#GH99501)
1390
1421
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
+
1391
1456
Moved checkers
1392
1457
^^^^^^^^^^^^^^
1393
1458
@@ -1400,21 +1465,35 @@ Moved checkers
1400
1465
To detect too large arguments passed to malloc, consider using the checker
1401
1466
``alpha.taint.TaintedAlloc ``.
1402
1467
1403
- - The checkers ``alpha.nondeterministic.PointerSorting `` and
1468
+ - Both ``alpha.nondeterministic.PointerSorting `` and
1404
1469
``alpha.nondeterministic.PointerIteration `` were moved to a new bugprone
1405
1470
checker named ``bugprone-nondeterministic-pointer-iteration-order ``. The
1406
1471
original checkers were implemented only using AST matching and make more
1407
1472
sense as a single clang-tidy check.
1408
1473
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 `` .
1413
1478
This checker conforms to SEI Cert C recommendation `POS05-C. Limit access to
1414
1479
files by creating a jail
1415
1480
<https://wiki.sei.cmu.edu/confluence/display/c/POS05-C.+Limit+access+to+files+by+creating+a+jail> `_.
1416
1481
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)
1418
1497
1419
1498
.. _release-notes-sanitizers :
1420
1499
0 commit comments