Skip to content

Commit

Permalink
[analyzer][docs] Update the release notes for llvm-18 (#76446)
Browse files Browse the repository at this point in the history
This PR prepares the release notes of the Clang Static Analyzer for the
llvm-18 release branch, due in about a week.
See the regular [release schedule](https://llvm.org/docs/HowToReleaseLLVM.html#annual-release-schedule).

This patch was written after examining the relevant Static Analyzer
commits since the last release.
Have a look at the commits, and provide feedback if I missed anything
interesting.
Note that the release notes is not meant to be an exhaustive list of the
changes, but rather a curated list of the relevant changes that might
interest our stakeholders, such as tool vendors based on top of CSA or
users with custom checkers.

See the relevant commits by using this command:
```
git log --oneline llvmorg-18-init..llvm/main   clang/{lib/StaticAnalyzer,include/clang/StaticAnalyzer} | grep -v NFC | grep -v -i revert
```
  • Loading branch information
steakhal authored Dec 28, 2023
1 parent c239914 commit d488adb
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 13 deletions.
135 changes: 123 additions & 12 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1052,18 +1052,113 @@ libclang
Static Analyzer
---------------

New features
^^^^^^^^^^^^

- Implemented the ``[[clang::suppress]]`` attribute for suppressing diagnostics
of static analysis tools, such as the Clang Static Analyzer.
`Documentation <https://clang.llvm.org/docs/AttributeReference.html#suppress>`__.

- Added support for the ``cleanup`` attribute.
`Documentation <https://clang.llvm.org/docs/AttributeReference.html#cleanup>`__.

- Support "Deducing this" (P0847R7). (Worked out of the box)
(`af4751738db8 <https://github.com/llvm/llvm-project/commit/af4751738db89a142a8880c782d12d4201b222a8>`__)

- Added a new checker ``core.BitwiseShift`` which reports situations where
bitwise shift operators produce undefined behavior (because some operand is
negative or too large).
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#core-bitwiseshift-c-c>`__.

- Move checker ``alpha.unix.Errno`` out of the ``alpha`` package
to ``unix.Errno``.
- Added a new experimental checker ``alpha.core.StdVariant`` to detect variant
accesses via wrong alternatives.
(`#66481 <https://github.com/llvm/llvm-project/pull/66481>`_)

- Move checker ``alpha.unix.StdCLibraryFunctions`` out of the ``alpha`` package
to ``unix.StdCLibraryFunctions``.
- Added a new experimental checker ``alpha.cplusplus.ArrayDelete`` to detect
destructions of arrays of polymorphic objects that are destructed as their
base class (`CERT EXP51-CPP <https://wiki.sei.cmu.edu/confluence/display/cplusplus/EXP51-CPP.+Do+not+delete+an+array+through+a+pointer+of+the+incorrect+type>`_).
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#alpha-cplusplus-arraydelete-c>`__.
(`0e246bb67573 <https://github.com/llvm/llvm-project/commit/0e246bb67573799409d0085b89902a330998ddcc>`_)

- Added a new checker configuration option ``InvalidatingGetEnv=[true,false]`` to
``security.cert.env.InvalidPtr``. It's not set by default.
If set, ``getenv`` calls won't invalidate previously returned pointers.
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#security-cert-env-invalidptr>`__.
(`#67663 <https://github.com/llvm/llvm-project/pull/67663>`_)

Crash and bug fixes
^^^^^^^^^^^^^^^^^^^

- Fixed a crash caused by ``builtin_bit_cast``.
(`#69922 <https://github.com/llvm/llvm-project/issues/69922>`_)

- Fixed a ``core.StackAddressEscape`` crash on temporary object fields.
(`#66221 <https://github.com/llvm/llvm-project/issues/66221>`_)

- A few crashes have been found and fixed using randomized testing related
to the use of ``_BitInt()`` in tidy checks and in clang analysis.
(`#67212 <https://github.com/llvm/llvm-project/pull/67212>`_,
`#66782 <https://github.com/llvm/llvm-project/pull/66782>`_,
`#65889 <https://github.com/llvm/llvm-project/pull/65889>`_,
`#65888 <https://github.com/llvm/llvm-project/pull/65888>`_,
`#65887 <https://github.com/llvm/llvm-project/pull/65887>`_)

- Fixed note links of the HTML output.
(`#64054 <https://github.com/llvm/llvm-project/issues/64054>`_)

- Allow widening rage-based for loops.
(`#70190 <https://github.com/llvm/llvm-project/pull/70190>`_)

- Fixed uninitialized base class with initializer list when ctor is not
declared in the base class.
(`#70464 <https://github.com/llvm/llvm-project/issues/70464>`_,
`#59493 <https://github.com/llvm/llvm-project/issues/59493>`_,
`#54533 <https://github.com/llvm/llvm-project/issues/54533>`_)

- Fix false positive in mutation check when using pointer to member function.
(`#66204: <https://github.com/llvm/llvm-project/issues/66204>`_).
(`#66204 <https://github.com/llvm/llvm-project/issues/66204>`_)

Improvements
^^^^^^^^^^^^

- Improved the ``unix.StdCLibraryFunctions`` checker by modeling more
functions like ``send``, ``recv``, ``readlink`` and ``errno`` behavior.
(`52ac71f92d38 <https://github.com/llvm/llvm-project/commit/52ac71f92d38f75df5cb88e9c090ac5fd5a71548>`_,
`#71373 <https://github.com/llvm/llvm-project/pull/71373>`_,
`#71392 <https://github.com/llvm/llvm-project/pull/71392>`_)

- Fixed a false negative for when accessing a nonnull property (ObjC).
(`1dceba3a3684 <https://github.com/llvm/llvm-project/commit/1dceba3a3684d12394731e09a6cf3efcebf07a3a>`_)

- ``security.insecureAPI.DeprecatedOrUnsafeBufferHandling`` now considers
``fprintf`` calls unsafe.
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#security-insecureapi-deprecatedorunsafebufferhandling-c>`__.

- Improved the diagnostics of the ``optin.core.EnumCastOutOfRange`` checker.
It will display the name and the declaration of the enumeration along with
the concrete value being cast to the enum.
(`#74503 <https://github.com/llvm/llvm-project/pull/74503>`_)

- Improved the ``alpha.security.ArrayBoundV2`` checker for detecting buffer
accesses prior the buffer; and also reworked the diagnostic messages.
(`3e014038b373 <https://github.com/llvm/llvm-project/commit/3e014038b373e5a4a96d89d46cea17e4d2456a04>`_,
`#70056 <https://github.com/llvm/llvm-project/pull/70056>`_,
`#72107 <https://github.com/llvm/llvm-project/pull/72107>`_)

- Improved the ``alpha.unix.cstring.OutOfBounds`` checking both ends of the
buffers in more cases.
(`c3a87ddad62a <https://github.com/llvm/llvm-project/commit/c3a87ddad62a6cc01acaccc76592bc6730c8ac3c>`_,
`0954dc3fb921 <https://github.com/llvm/llvm-project/commit/0954dc3fb9214b994623f5306473de075f8e3593>`_)

- Improved the ``alpha.unix.Stream`` checker by modeling more functions like,
``fflush``, ``fputs``, ``fgetc``, ``fputc``, ``fopen``, ``fopen``, ``fgets``.
(`#74296 <https://github.com/llvm/llvm-project/pull/74296>`_,
`#73335 <https://github.com/llvm/llvm-project/pull/73335>`_,
`#72627 <https://github.com/llvm/llvm-project/pull/72627>`_,
`#71518 <https://github.com/llvm/llvm-project/pull/71518>`_,
`#72016 <https://github.com/llvm/llvm-project/pull/72016>`_,
`#70540 <https://github.com/llvm/llvm-project/pull/70540>`_,
`#73638 <https://github.com/llvm/llvm-project/pull/73638>`_)

- The ``alpha.security.taint.TaintPropagation`` checker no longer propagates
taint on ``strlen`` and ``strnlen`` calls, unless these are marked
Expand All @@ -1072,16 +1167,32 @@ Static Analyzer
Read the PR for the details.
(`#66086 <https://github.com/llvm/llvm-project/pull/66086>`_)

- A few crashes have been found and fixed using randomized testing related
to the use of ``_BitInt()`` in tidy checks and in clang analysis. See
`#67212 <https://github.com/llvm/llvm-project/pull/67212>`_,
`#66782 <https://github.com/llvm/llvm-project/pull/66782>`_,
`#65889 <https://github.com/llvm/llvm-project/pull/65889>`_,
`#65888 <https://github.com/llvm/llvm-project/pull/65888>`_, and
`#65887 <https://github.com/llvm/llvm-project/pull/65887>`_
- Other taint-related improvements.
(`#66358 <https://github.com/llvm/llvm-project/pull/66358>`_,
`#66074 <https://github.com/llvm/llvm-project/pull/66074>`_,
`#66358 <https://github.com/llvm/llvm-project/pull/66358>`_)

- Checkers can query constraint bounds to improve diagnostic messages.
(`#74141 <https://github.com/llvm/llvm-project/pull/74141>`_)

Moved checkers
^^^^^^^^^^^^^^

- Move checker ``alpha.unix.Errno`` out of the ``alpha`` package
to ``unix.Errno``.
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-errno-c>`__.

- Move checker ``alpha.unix.StdCLibraryFunctions`` out of the ``alpha`` package
to ``unix.StdCLibraryFunctions``.
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-stdclibraryfunctions-c>`__.

- Move checker ``alpha.security.cert.env.InvalidPtr`` out of the ``alpha``
package to ``security.cert.env.InvalidPtr``.
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#security-cert-env-invalidptr>`__.

- Move checker ``alpha.cplusplus.EnumCastOutOfRange`` out of the ``alpha``
package to ``optin.core.EnumCastOutOfRange``.
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#optin-core-enumcastoutofrange-c-c>`__.

.. _release-notes-sanitizers:

Expand Down
2 changes: 1 addition & 1 deletion clang/docs/analyzer/checkers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ security.insecureAPI.vfork (C)
security.insecureAPI.DeprecatedOrUnsafeBufferHandling (C)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Warn on occurrences of unsafe or deprecated buffer handling functions, which now have a secure variant: ``sprintf, vsprintf, scanf, wscanf, fscanf, fwscanf, vscanf, vwscanf, vfscanf, vfwscanf, sscanf, swscanf, vsscanf, vswscanf, swprintf, snprintf, vswprintf, vsnprintf, memcpy, memmove, strncpy, strncat, memset``
Warn on occurrences of unsafe or deprecated buffer handling functions, which now have a secure variant: ``sprintf, fprintf, vsprintf, scanf, wscanf, fscanf, fwscanf, vscanf, vwscanf, vfscanf, vfwscanf, sscanf, swscanf, vsscanf, vswscanf, swprintf, snprintf, vswprintf, vsnprintf, memcpy, memmove, strncpy, strncat, memset``
.. code-block:: c
Expand Down

0 comments on commit d488adb

Please sign in to comment.