Skip to content

Fix Clang 21 analyzer findings - #13593

Merged
bneradt merged 1 commit into
apache:masterfrom
bneradt:clang-analyzer-21-cleanup
Aug 27, 2026
Merged

bneradt merged 1 commit into
apache:masterfrom
bneradt:clang-analyzer-21-cleanup

Conversation

@bneradt

@bneradt bneradt commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Newer Clang releases expose latent ownership and error-handling issues,
while the analyzer preset currently produces a GCC compilation database
that Clang cannot reliably consume.

This patch selects Clang explicitly for the analyzer preset, fixes the
reported leaks, unchecked stream calls, and directory scanning under a
mutex, and reshapes the remaining flagged code so the analyzer can
follow it. That gives ATS a clean diagnostic baseline before the job
moves to Ubuntu 26.04.

Copilot AI lite review requested due to automatic review settings August 27, 2026 01:49
@bneradt bneradt added this to the 11.0.0 milestone Aug 27, 2026
@bneradt bneradt self-assigned this Aug 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

bneradt pushed a commit to bneradt/trafficserver-ci that referenced this pull request Aug 27, 2026
The analyzer job is pinned to Ubuntu 22.04 and versioned Clang 14
tools, which prevents it from benefiting from newer diagnostics and
uses a checker that newer Clang releases no longer provide.

Use the Ubuntu 26.04 image and its unversioned Clang tool entry points.
Keep the supported checker set and exclude the vendored Highway subtree
so third-party findings do not prevent an ATS-owned clean baseline.

Merge this after apache/trafficserver#13593 and publish the Ubuntu
26.04 image first so the existing analyzer job stays green during the
transition.
@bneradt
bneradt force-pushed the clang-analyzer-21-cleanup branch from 39bfa37 to 7b2ccc0 Compare August 27, 2026 02:56
Copilot AI review requested due to automatic review settings August 27, 2026 02:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 27, 2026 19:44
@bneradt
bneradt force-pushed the clang-analyzer-21-cleanup branch from 7b2ccc0 to a381ade Compare August 27, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread src/proxy/http3/Http3Frame.cc Outdated
@bneradt
bneradt force-pushed the clang-analyzer-21-cleanup branch from a381ade to 9c97100 Compare August 27, 2026 21:39
Copilot AI review requested due to automatic review settings August 27, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Newer Clang releases expose latent ownership and error-handling issues,
while the analyzer preset currently produces a GCC compilation database
that Clang cannot reliably consume.

This patch selects Clang explicitly for the analyzer preset, fixes the
reported leaks, unchecked stream calls, and directory scanning under a
mutex, and reshapes the remaining flagged code so the analyzer can
follow it. That gives ATS a clean diagnostic baseline before the job
moves to Ubuntu 26.04.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@bneradt
bneradt force-pushed the clang-analyzer-21-cleanup branch from 9c97100 to 8960422 Compare August 27, 2026 21:46
Copilot AI review requested due to automatic review settings August 27, 2026 21:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bneradt
bneradt merged commit c31517c into apache:master Aug 27, 2026
15 checks passed
@bneradt
bneradt deleted the clang-analyzer-21-cleanup branch August 27, 2026 22:32
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Sep 9, 2026
Newer Clang releases expose latent ownership and error-handling issues,
while the analyzer preset currently produces a GCC compilation database
that Clang cannot reliably consume.

This patch selects Clang explicitly for the analyzer preset, fixes the
reported leaks, unchecked stream calls, and directory scanning under a
mutex, and reshapes the remaining flagged code so the analyzer can
follow it. That gives ATS a clean diagnostic baseline before the job
moves to Ubuntu 26.04.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit c31517c)
@cmcfarlen cmcfarlen moved this to For v10.2.1 in ATS v10.2.x Sep 9, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.1 to Picked v10.2.1 in ATS v10.2.x Sep 9, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.1 Sep 9, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to the 10.2.x branch as 91f21fb for the 10.2.1 release.

cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Sep 15, 2026
Newer Clang releases expose latent ownership and error-handling issues,
while the analyzer preset currently produces a GCC compilation database
that Clang cannot reliably consume.

This patch selects Clang explicitly for the analyzer preset, fixes the
reported leaks, unchecked stream calls, and directory scanning under a
mutex, and reshapes the remaining flagged code so the analyzer can
follow it. That gives ATS a clean diagnostic baseline before the job
moves to Ubuntu 26.04.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Sep 15, 2026
Clang 21 still flags the unguarded insertion-sort path used for SRV
records, even after the pointer array is initialized. This keeps the
10.1.x analyzer job failing after the earlier analyzer fixes.

This branch backports apache#13593 and
apache#12226, and uses stable sorting with the existing
SRV comparator. The sort preserves priority/key ordering while avoiding
the analyzer's unguarded-sort false positive.
@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x Sep 15, 2026
ezelkow1 pushed a commit that referenced this pull request Sep 15, 2026
* Backport Clang 21 analyzer fixes to 9.2.x

Newer Clang releases expose ownership and error-handling issues in
9.2.x as well as file I/O performed while holding the body factory lock.

This patch adapts the applicable fixes from #13593 to the older source
layout and APIs. CMake and changes to code absent from 9.2.x are omitted.

(cherry picked from commit c31517c)

* Backport earlier Clang analyzer fixes to 9.2.x

The older branch still contains uninitialized error values and cache
volume indices flagged by the analyzer.

This patch adapts #12226 to initialize those values, verify the
freelist element size before division, and remove dead initializers.

(cherry picked from commit 0cf0f3e)

* Backport session reuse key-file checks

Missing or unreadable Redis authentication key files can leave invalid
file descriptors and read lengths in the session reuse plugin.

This patch backports the key-file checks from #10273 and closes the
file only when it was opened successfully. Configuration-file handling
is addressed separately for the older branch.

(cherry picked from commit 26affda)

* Backport header rewrite rule ownership fix

Incomplete header rewrite rules can leak when configuration parsing
ends without handing the rule to the configuration.

This patch adapts #11386 to keep temporary rules under unique ownership
until the configuration accepts them.

(cherry picked from commit 0887836)

* 9.2.x: latest clang-analyzer fixes

The Ubuntu 26.04 clang-analyzer job exposes unchecked I/O, a rule leak,
and configuration reads under a mutex in the older 9.2.x code.

This branch backports the applicable fixes from #13593, #12226, #10273,
and #11386. The remaining changes handle file and socket failures,
keep session reuse configuration I/O outside the reader lock, and make
the nonblocking eventfd operation explicit to the analyzer.

* Address review findings and isolate TLS autest

A full-size Redis key leaves no room for its terminator, and failed
configuration reloads can repeat file I/O on every lookup. Modern
Fedora policy also prevents the TLS autest from exercising TLS 1.0.

This patch tightens the key bound, restores timestamp-gated reloads,
clarifies configuration publication, and guards device-dependent
checks. The TLS test uses isolated OpenSSL settings and RSA key
exchange so all four protocol checks remain active.

---------

Co-authored-by: Hiroaki Nakamura <hnakamur@gmail.com>
Co-authored-by: Fei Deng <feid@yahooinc.com>
Co-authored-by: Bryan Call <bcall@apache.org>
Co-authored-by: bneradt <bneradt@yahooinc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: For v10.1.1
Status: Picked v10.2.1

Development

Successfully merging this pull request may close these issues.

4 participants