Skip to content

[bp/1.39] CI/CVE/deps/wasmtime/flake stack - #49205

Merged
phlax merged 105 commits into
envoyproxy:release/v1.39from
phlax:bp-1.39-ci-checks
Nov 17, 2026
Merged

phlax merged 105 commits into
envoyproxy:release/v1.39from
phlax:bp-1.39-ci-checks

Conversation

@phlax

@phlax phlax commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Brings release/v1.39 up to the CI and the release pipeline that main and release/v1.40 run, with the dependency and CVE updates and the wasmtime re-enable it needs to pass. Supersedes #49061, whose commits are all here.

The compile_time_options target on this branch exited after the wamr run, so the jemalloc, admin-disabled, release-assert and logging-disabled runs have never executed here. They now do, and the fixes they need come first:

CI layout. These are ports rather than cherry-picks, as this branch's ci/do_ci.sh and config differ too much from main:

CVE scanning and dependencies:

Coverage:

Rust and wasmtime, so that the wasmtime tests build and run here:

  • Rust -> 1.93.1 -> 1.96.1, with the crate_universe repins, the rules_rust sysroot fixes and the clippy fixes they need
  • wasmtime -> 49.0.5, with fixes to its build on this branch (the c-api build script, the symbol-prefix genrule, host function signatures) and to the proxy-wasm Rust SDK's import module
  • dynamic_modules: Allow function pointer comparisons in the Rust SDK bindings

Tests:

Differences from main:

@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #49205 was opened by phlax.

see: more, trace.

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.

🟡 Changes recommended

WORKSPACE-only changes bypass all CTO/GCC checks, and consumedBytes() introduces allocations on tcmalloc/gperftools builds that escape the allocation-free callback assertion.

2 open issues
What changed in this PR

Backports independent compile-time-option and GCC checks to release/v1.39, alongside fixes needed by configurations that previously did not run.

Changes:

  • Splits compile-time options and GCC build/test checks into path-selected jobs, leaving Wasmtime disabled.
  • Fixes jemalloc accounting and adapts tests for disabled memory measurement and admin functionality.
  • Routes fatal-signal diagnostics directly to stderr, increases alternate-stack capacity, and documents the behavior change.
File Description
tools/​spelling/​spelling_dictionary.txt Adds vocabulary used by signal-stack documentation.
test/​server/​backtrace_test.cc Tests stderr output and log-sink bypass.
test/​server/​admin/​server_info_handler_test.cc Adds expectations for jemalloc statistics.
test/​integration/​base_integration_test.cc Handles listener diagnostics without admin functionality.
test/​extensions/​filters/​http/​bandwidth_share/​filter_integration_test.cc Skips an admin-dependent runtime-update test when admin is disabled.
test/​extensions/​dynamic_modules/​bootstrap/​integration_test.cc Skips the admin-handler test when admin is disabled.
test/​extensions/​access_loggers/​stats/​stats_test.cc Allows negative allocation deltas in the cleanup assertion.
test/​common/​signal/​signals_test.cc Tests fatal-signal descriptions.
test/​common/​memory/​memory_test_utility.h Returns zero when memory measurement is disabled.
test/​common/​memory/​heap_shrinker_test.cc Checks reserved-memory ordering and jemalloc shrinking.
source/​server/​backtrace.h Adds decoder-compatible stderr diagnostics.
source/​common/​signal/​signal_action.h Sizes the alternate stack with runtime-aware headroom.
source/​common/​signal/​signal_action.cc Uses allocation-free signal descriptions and bypasses logging.
source/​common/​memory/​stats.cc Includes jemalloc retained pages in reserved memory.
ci/​README.md Documents the split CTO and GCC targets.
ci/​do_ci.sh Implements independent CTO subtasks and GCC build/test targets.
changelogs/​current/​minor_behavior_changes/​logging__fatal-signal-backtraces-stderr.rst Documents the need to capture stderr for fatal backtraces.
changelogs/​current/​bug_fixes/​memory__jemalloc-reserved-accounting.rst Records the jemalloc accounting fix.
changelogs/​current/​bug_fixes/​logging__fatal-signal-backtraces.rst Records fatal-reporting and alternate-stack fixes.
changelogs/​changelogs.yaml Registers the memory changelog area.
.github/​config.yml Enables path-selected CTO and GCC job flags.

Review effort: Balanced

Comment thread .github/config.yml Resolved

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.

🟡 Changes recommended

The fatal-signal handler uses async-signal-unsafe iostream output, which can deadlock or fault again before the backtrace and fatal actions run.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread source/server/backtrace.h Resolved

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.

🔵 Needs a closer look

Platform-sensitive crash-path changes require human review of nested-signal and allocator-failure validation, along with the release risk of deferring the signal-safe writer follow-up.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

🔵 Needs a closer look

Production fatal-signal and alternate-stack changes require supported-platform death tests unavailable in this environment and human confirmation of platform and nested-signal behavior.

No open issues 🎉

Review effort: Balanced

@phlax

phlax commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

/retest

@phlax

phlax commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

will pick #49207 here or after dep on when it lands

phlax and others added 7 commits November 17, 2026 15:36
…ps (envoyproxy#48479)

this is yet another attempt to fix endemic dfp flakiness - which is
apparently a code rather than test problem

Signed-off-by: Ryan Northey <[email protected]>
Backport note (release/v1.39): the new tests use `EXPECT_TRUE(....ok())` rather than
`EXPECT_OK`, as the rest of this branch's `cluster_test.cc` does (it does not include
`status_utility.h`).

(cherry picked from commit c04db74)
Signed-off-by: Ryan Northey <[email protected]>
The CI logs of this branch are mostly the warnings of a few external
dependencies, each repeated with its context for every file, and again as
annotations:

- V8, which this branch builds from source, redefines the ASAN
  interface's macros in every file that includes its heap: ~1400
  `-Wmacro-redefined` warnings with their include chains, which is ~30k
  of the ASAN job's ~36k lines;
- proto-processing ignores `nodiscard` results (~60 `-Wunused-result`
  warnings in every job that compiles it);
- a handful each from grpc, protobuf (also when built for the host),
  simdutf, c-ares, libprotobuf-mutator and sql-parser.

`main` and `release/v1.40` do not have these: the dependencies are fixed
or patched as modules there, and V8 is prebuilt (envoyproxy#48631 and envoyproxy#48838 are
their equivalents for what is left). Here they are suppressed for the
files of those repositories only, with this branch's (WORKSPACE)
repository names.

Signed-off-by: Ryan Northey <[email protected]>
0.4.13.post4 has, backported to the WORKSPACE line
(envoyproxy/toolshed#5616):

- `oci_base_edit`, `compressed_tar` and a hermetic pigz, to build the
  release container images with rules_oci, and to gzip with all the
  cores;
- `setup_libcxx_libs(llvm_version = ...)`, to cross-compile with the
  libc++ of this branch's LLVM.

It is also on toolshed's bins v0.2.34.

Signed-off-by: Ryan Northey <[email protected]>
The libc++ bundles to cross-compile with (`cxx_cross_lib`) came from
toolshed's default, which is for its LLVM (22.1.8), while this branch
compiles with LLVM 18.1.8: a cross-compile (eg arm64 from x64, as
`ci/do_ci.sh release.multiarch` does) then has LLVM 18's libc++ headers
with LLVM 22's `__config_site`, and fails.

This selects the 18.1.8 bundles, from the last bins release that
published them (0.1.59), with `setup_libcxx_libs(llvm_version = ...)`.

Signed-off-by: Ryan Northey <[email protected]>
The debs' data (`data.tar`, which every dpkg reads) is gzipped with the
toolshed's hermetic pigz (`compressor = "@envoy_toolshed//pigz"`, `-n`
for reproducibility), so `data.tar.gz`: the debs are a fraction of the
size, and quicker to package (`pkg_deb` copies the data, and hashes the
deb for the `.changes`), bundle, checksum, sign and upload.

In envoy-ci-staging, on a 2-core runner, MakeDeb and the packaging
around it were among the steps the client was CPU-starved on; pigz uses
every core.

Signed-off-by: Ryan Northey <[email protected]>
Backport note (release/v1.39): with toolshed's pigz set up for WORKSPACE
(`setup_pigz()` and `load_pigz_toolchains()`, `bazel/repositories_extra.bzl`).

(cherry picked from commit e70d9f9)
Signed-off-by: Ryan Northey <[email protected]>
It should be noop for Linux or OS/X and will not be needed with bzlmod.

Risk Level: none
Testing: build
Docs Changes: no
Release Notes: no
Platform Specific Features: windows only

Signed-off-by: Yan Avlasov <[email protected]>

Backport note (release/v1.39): for the `rules_shell` toolchain that rules_oci's `oci_image`
resolves (it is not registered otherwise with WORKSPACE). Only the `rules_shell` lines apply:
the protobuf toolchain lines around them on `main` are not on this branch.

(cherry picked from commit 68f9cc8)
Signed-off-by: Ryan Northey <[email protected]>
…yproxy#49259)

Builds all of the release container images with bazel (rules_oci)
instead of `docker buildx`: `envoy`, `envoy-debug`, `envoy-contrib`,
`envoy-contrib-debug`, `envoy-tools`, `envoy-distroless`,
`envoy-contrib-distroless`, matching the stages of `Dockerfile-envoy`.

- Distroless images: the pinned distroless base, plus the config and
binary layers.
- Ubuntu images: the pinned ubuntu base (`mirror.gcr.io`, same digest as
the Dockerfile), with `ca-certificates`, `openssl` and `tzdata` from a
pinned `snapshot.ubuntu.com` timestamp (rules_distroless). The `RUN`
steps of the `envoy-base` stage become layers:
- `oci_base_edit` (toolshed, envoyproxy/toolshed#5597): adds `envoy` to
the base's passwd/group/shadow/gshadow as `adduser --group --system
envoy` does (uid/gid 101), `/home/envoy`, and the packages to the dpkg
status;
- the package data, the CA bundle (`cacerts`), and `/etc/timezone` /
`/etc/localtime` (`Etc/UTC`);
- `/etc/envoy/{envoy.yaml,VERSION.txt}`, `/docker-entrypoint.sh`,
`su-exec`, the binary (+ `.dwp` for debug), the tools for `-tools`; same
entrypoint/cmd/env/port.
- The binaries use the same opt/strip transition as the release bundle,
so they come from the release build.
- The debug layers are gzipped at level 1: their contents' debug
sections are already compressed (envoyproxy#49294, envoyproxy#49295), which gzip barely
shrinks.
- `release.publish` strips the release binaries locally: the client
downloads them anyway (the release tarball and images are built
locally), while a remote strip waits on a worker fetching the freshly
linked binary (~30s in envoy-ci-staging).

CI targets:
- `release.server`: the release binaries and tools;
`release.server_only` (used by the Publish workflow, and so by release
branches) is the same, unchanged.
- `release.publish` (new): as `release.server`, and the distro packages,
and the images (`//distribution/docker:images`) as OCI tarballs (the
image layout, as `docker buildx -o type=oci` writes it for a single
platform) in the release binary directory.
- `docker` is unchanged (buildx): where `release-publish` is set its job
is skipped, as `release.publish` writes the images to
`build_images/<image>.<arch>.tar` itself. Local loads and multi-platform
builds still use it.

Publish switches to `release.publish` here: `.github/config.yml` sets
`release-publish: true`, so each arch's binary job builds the release
binaries, the images and the packages in one invocation and uploads them
(`release.<arch>`, `oci.<arch>`, `packages.<arch>`), and the separate
Docker OCI and Packages jobs are skipped. Branches without
`release-publish` (the release branches) keep `release.server_only` and
the separate jobs, with buildx.

Differences from the buildx images:
- No `apt-get upgrade`: base paCommit Message: distribution: Build the release container images with
rules_oci
Additional Description:ckages are those of the pinned base until
its digest (and the snapshot) is bumped.
- Only the CA bundle in `/etc/ssl/certs`, not the per-certificate hash
links.

This overrides `envoy_toolshed` with envoyproxy/toolshed#5597 (on the
v0.5.20 release) until it is released; the docs/external jobs fail with
the override ("Missing version info: envoy_toolshed").

---------

Backport note (release/v1.39): this branch builds with WORKSPACE, so:

- rules_oci is 2.2.6, which needs only the aspect_bazel_lib and
  bazel_features that this branch has (later versions need tar.bzl
  0.7 and bazel_lib 3). Its toolchains, and the base images (this
  branch's `Dockerfile-envoy` digests), are set up in
  `bazel/dependency_imports.bzl`.
- rules_distroless and tar.bzl's rules are bzlmod-only: the three
  Ubuntu packages are fetched as `.deb` archives (the same snapshot,
  versions and hashes), and `flatten`, `cacerts` and the OCI tarballs
  are small local rules over the hermetic bsdtar
  (`distribution/docker/layers.bzl`).
- no lockfiles, and no workflow changes (the workflows run from `main`).

(cherry picked from commit aa082aa)
Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax force-pushed the bp-1.39-ci-checks branch from 3ddfa24 to ab65d43 Compare November 17, 2026 15:37
@phlax

phlax commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

quite a few of the picks are not straight backports as 1.39- is non-bzlmod

phlax and others added 9 commits November 17, 2026 16:21
… job (envoyproxy#49331)

With `release-publish-multiarch`, the x64 Publish binary job builds
everything published for both arches (`release.multiarch`), and uploads
the same artifacts as the per-arch jobs did (`release.<arch>`,
`oci.<arch>`, `packages.<arch>`); there is no arm64 job.

`//distribution/publish:publish_<arch>` builds `//distribution/publish`
for the arch's target platform, from any host. Only the target platform
changes: everything runs on the build's execution platforms, so the
arm64 binaries are cross-compiled on x64 (the llvm toolchain has the
arm64 sysroot and libc++), and the exec tools (eg the Python ones, whose
pip deps only resolve for the host) stay on the host's arch.

The tools are now `bundled` too (as the container images' are), so they
are built in the same configuration as the binaries.

`release.publish` builds the host's arch, as before.

The job is named `Server (multiarch)`. It sets `--//bazel:multiarch`, so
on EngFlow the x86_64 RBE pool pins (`envoy_exec_properties`, via
`//bazel:engflow_rbe_x86_64`) apply to the arm64 half too, as it is
built on x86_64 workers. Without it (eg a native arm64 build) arm64
keeps the arm platform's pool.

With `release-publish-multiarch`, the x64 Publish binary job
(`release.multiarch`) builds only what the pipeline uses from it, and
signs the release of both arches in the same invocation:

- `//distribution/publish:publish_multiarch_<arch>`: the container
images, uploaded (`oci.<arch>`), and the `.deb`/`.changes` files and the
stripped release binaries (`release.stripped.tar.zst`), which are
signed.
- `//distribution:signed`, with `--//distribution:signing-inputs=debs`
and `--//distribution:<arch>-{debs,release}` set to those
(`publish_multiarch_<arch>_{debs,release}`): the `.changes` are signed
from the debs, and the `.deb`s and signed `.changes` bundled into
`debs.tar.gz` directly, rather than through the packages tarballs
(`signing-inputs=tarballs`, as the Sign packages job), with the key and
passphrase at `ENVOY_SIGNING_{KEY,PASSPHRASE}_PATH` (staged by
`_run.yml` `signing`, under the same conditions as the Sign packages
job, with the snakeoil key for untrusted requests). It uploads
`release.signed`, and the Sign packages job is skipped.

The signing actions are audited as by `release.signed`, in an aquery of
`//distribution:signed` without the builds of its inputs (which can only
drop tool artifacts, so fail the audit, not pass it).

Nothing downstream uses the release tarball (with the debug binaries),
the tools, the packages tarballs, or the release and packages artifacts,
which were for the per-arch Docker OCI, Packages and Sign packages jobs:
they are neither built nor uploaded.

The bundling of the release for signing (the release binaries, the
multi-arch debs, the `.changes` and `release.signed.tar.zst`) is local
(`PUBLISH_PACKAGING_TAGS`): it changes with every commit.

The dev publish (`github-dev`) runs once the release is signed in the
build, as the Sign packages job is skipped, on the publishing agent.

---------

Backport note (release/v1.39): without the workflow changes (the workflows run from
`main`). This branch still has selects with both `engflow_rbe_x86_64` and
`engflow_rbe_aarch64` (eg `bazel/foreign_cc`), which would both match the arm64 half of
a multiarch build on x86_64 workers, so `engflow_rbe_aarch64` is only for a single arch
build.
`release.signed` keeps this branch's `setup_clang_toolchain`: clang is not the default
here, and without it the build has no RBE platform.

(cherry picked from commit 44a6cec)
Signed-off-by: Ryan Northey <[email protected]>
`ci/do_ci.sh release.multiarch` builds both arches in one job, from an
x64 host. On `main` the arm64 half is cross-compiled on x86_64 workers,
but this branch still builds a number of dependencies with
`rules_foreign_cc` (ICU, LuaJIT, libevent, nghttp2, ...), whose build
systems run what they compile, and can not be cross-compiled as they are:

  configure: error: cannot run C compiled programs.

Here the arm64 binaries are built on arm64 workers instead, natively, as
the arm64 release job of this branch builds them:

- `@llvm_toolchain_arm64` is the LLVM toolchain for actions that run on
  Linux arm64 whatever the host is, registered for this build only
  (`--extra_toolchains`), so nothing else fetches it;
- `bundled`, which every release binary is built through, prefers an
  arm64 execution platform for an arm64 build
  (`//distribution/binary:arm64-exec-platform`).

Only the binaries are built there. What packages them (the images, the
packages, the tarballs) is outside `bundled`, so it runs as on `main`:
locally on the host, and out of the remote cache.

The strip is the one step that could not stay as it is: a binary's
`.stripped` is stripped by the toolchain of the platform it was built on,
and the host can not run the arm64 workers' strip. `release.multiarch`
strips with the host's toolchain instead (`host_stripped`,
`//distribution/binary:host-strip`), which strips a binary of any arch,
locally, as the strip of other release builds is.

`--//bazel:multiarch` is not set, so the arm64 binaries are built on the
arm pools.

Signed-off-by: Ryan Northey <[email protected]>
V8 generates its inspector files with a `local` genrule, which runs its
(hermetic) Python on the host, whatever the execution platform is. When
the binaries are built on other workers than the host's (the arm64 half
of `ci/do_ci.sh release.multiarch`, on arm64 workers from an x64 host),
that is the Python of the workers, which the host can not run:

  .../_code_generator.venv/bin/python3: Syntax error: "(" unexpected

The generator only reads its inputs and writes its outputs, and its
Python is hermetic since envoyproxy#41959, so it can run where the rest of the
build does.

Signed-off-by: Ryan Northey <[email protected]>
The dynamic modules SDK's bindgen loads `libclang.so`, and the built-in
modules' symbols are renamed with `objcopy`, both from the LLVM
distribution of the host (`@llvm_toolchain_llvm`). When the arm64
binaries are built on arm64 workers from an x64 host
(`ci/do_ci.sh release.multiarch`), those are x64, and do not run there:

  Unable to find libclang: "the `libclang` shared library at
  .../external/llvm_toolchain_llvm/lib/libclang.so could not be opened"

`//bazel:arm64_workers` (set by the transition that moves the build to
arm64 workers) selects the arm64 distribution
(`@llvm_toolchain_arm64_llvm`) for them.

Signed-off-by: Ryan Northey <[email protected]>
…voyproxy#49354)

The debug images (`envoy-debug`, `envoy-contrib-debug`) took the `.dwp`s
as llvm-dwp writes them: debug sections uncompressed (over 3GB for
contrib, per arch), each a single blob in the remote cache.

envoyproxy#49294 added the `.dwp`s with their debug sections compressed (zlib,
which the images' gdb 12 reads) and cached in parts
(`//distribution:envoy-dwarf-joined`,
`//distribution:envoy-contrib-dwarf-joined`), but only the release
tarball (`//distribution/binary`) used them. The images are no longer
built from that tarball (envoyproxy#49259), and `release.multiarch` does not build
it (envoyproxy#49331), so nothing published had them.

This points the images' `.dwp`s at the `-joined` targets, as the comment
on the debug layers in this file already describes.

Risk Level: low (the `.dwp` in the published debug images; the same file
the release tarball has had since envoyproxy#49294)
Testing: this PR's Publish (`release.multiarch`), against the postsubmit
of its base (499b706), from the Bazel profiles:

| | base | this PR |
| --- | --- | --- |
| `oci.x64` / `oci.arm64` artifacts | 4.10GB / 4.06GB | 3.29GB / 3.24GB
|
| Writing the `envoy-debug` layer (per arch) | 159s, 101s | 31s, 9s |
| Writing the `envoy-contrib-debug` layer (per arch) | 121s, 96s | 29s,
25s |
| OCI descriptor of the debug layers | 29-54s | 9-12s |
| Compressing the `.dwp`s (new here, remote) | - | 101-118s |
| Joining the parts (new here, local) | - | 7-20s |

The compression runs whenever a `.dwp` changes, so it is not a critical
path win by itself (bazel took 360s here, 443s on the base, where the
`.dwp`s were regenerated and here were not): the gain is the smaller
images and layers, and no multi-GB `.dwp` blob to fetch.
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 5e14399)
Signed-off-by: Ryan Northey <[email protected]>
…#49202)

envoyproxy#49099 added `waitUntilListenersReady()` before two tests connect, but
that can return immediately here: the fixture clears the static
listeners, and the server's pending listener count is only set once the
server is ready, which in these tests is after the listener finishes
warming. The client can still connect before the workers have the
listener, and the test then times out waiting for
`network_extension_config_missing`.

Also wait for `listener_manager.workers_started`, as the other tests in
this file already do after `waitUntilListenersReady()`.

Deflake runs of `BasicFailWithoutDefault` and
`ConfigUpdateDoesNotApplyToExistingConnection`, 1000 runs each:

| | default | tsan |
| --- | --- | --- |
| main | 4 failed | 30 failed |
| this change | 0 failed | 0 failed |

All of the failures were `BasicFailWithoutDefault`, timing out on
`listener.listener_stat.network_extension_config_missing`.

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 8def710)
Signed-off-by: Ryan Northey <[email protected]>
This commit removes the use of the RTLD_DEEPBIND option when the compat
layer loads the OpenSSL shared libraries. As a replacement, the compat
layer is now built with the -fvisibility=hidden option instead. This has
the same effect of preventing OpenSSL code linking against the compat
layer symbols instead of it's own. This change has been made, in
preparation for adding an ASAN build of the compat layer, because the
dlopen() wrapper that ASAN injects, does not work with the RTLD_DEEPBIND
option.

Also added a test to confirm that compat layer symbols are not
dynamically visible (preventing the subtle misresolution bugs that
RTLD_DEEPBIND was originally introduced to solve).

---------

Signed-off-by: Ted Poole <[email protected]>
(cherry picked from commit 8d2521b)
Signed-off-by: Ryan Northey <[email protected]>
…envoyproxy#48956)

Commit Message: openssl: create SSL object once per thread in
SSL_get_cipher_by_value

Additional Description:
OpenSSL can only look up a cipher through an SSL object. The compat
implementation of SSL_get_cipher_by_value created and freed a new
SSL_CTX and SSL on every call. Envoy calls it once per offered cipher
suite during TLS 1.2 certificate selection, meaning a single handshake
could create many SSL_CTX objects.

This change creates one SSL object per thread on first use, with a
`thread_local bssl::UniquePtr`, and reuses it for later lookups on that
thread. OpenSSL does not guarantee that SSL_CIPHER_find() is thread
safe, so threads do not share the object. It is freed when its thread
exits.

Fixes envoyproxy#48858

Risk Level: Low (only affects --config=openssl builds)

Testing:
```bash
bazel test --config=openssl //compat/openssl/test/...
bazel test --config=openssl //test/common/tls:ssl_socket_test //test/common/tls:context_impl_test
```
Micro-benchmark (10,000 calls to SSL_get_cipher_by_value(0xC02B),
--config=openssl):
- before: 188.77 us/call
- after: 0.34 us/call (~550x faster)

*The thread_local version benchmarks about the same.*

Docs Changes: N/A
Release Notes: N/A

AI Disclosure: Claude Code was used to help explain the codebase,
simplify the implementation, write the throwaway benchmark, and draft
this description. I have reviewed, tested, and understand all of the
code in this PR.

---------

Signed-off-by: NMJlam <[email protected]>
(cherry picked from commit 3d18e34)
Signed-off-by: Ryan Northey <[email protected]>
Signed-off-by: Jonh Wendell <[email protected]>
(cherry picked from commit a379441)
Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax force-pushed the bp-1.39-ci-checks branch from ab65d43 to 8aaacfa Compare November 17, 2026 16:21
The test built four Docker environments (host GCC, the LLVM
prerequisites, both, neither) and checked which toolchain each got. The
environments were built by installing packages into a stock Ubuntu image
from the `ubuntu-toolchain-r/test` PPA, which often returns 503s. Of the
last 60 runs of the workflow 10 failed, and every failed job sampled
(12) died in that image build; none was a toolchain test failure.

The toolchains are hermetic now, so the environment does not decide
anything: the default is the LLVM toolchain and `--config=gcc` the GCC
one, and both are what the rest of CI builds with.

Removed:

- the `Toolchain default behavior test` workflow
(`.github/workflows/toolchain-test.yml`)
- `ci/matrix`
- `//tools/toolchain:detect`, which only the test used
- the Dependabot entry for the test's Dockerfile

What only this test covered is the explicit host GCC override,
`gcc.host` (still documented in `bazel/README.md`): nothing in CI builds
with a host GCC.

Its other checks (which compiler and standard library a build gets, that
`//bazel:gcc_build` matches with `--config=gcc`, the hermetic GCC's
sysroot) are not asserted elsewhere, but the clang and gcc CI jobs build
and test everything with those toolchains and their compiler-specific
options, and would break if the wrong one was used.

Backport note (release/v1.39): the files differ on this branch, and are removed as they
are here. The GCC toolchain is not hermetic on this branch, so the test did cover the
default here; it is removed all the same, as its environments fail to build from the PPA.

(cherry picked from commit 1e33223)
Signed-off-by: Ryan Northey <[email protected]>
@phlax phlax changed the title [WIP/bp/1.39] CI/CVE/deps/wasmtime/flake stack [bp/1.39] CI/CVE/deps/wasmtime/flake stack Nov 17, 2026
@phlax
phlax marked this pull request as ready for review November 17, 2026 16:54
@repokitteh-read-only repokitteh-read-only Bot removed the deps Approval required for changes to Envoy's external dependencies label Nov 17, 2026
@phlax
phlax merged commit 8304142 into envoyproxy:release/v1.39 Nov 17, 2026
10 of 11 checks passed
@phlax

phlax commented Nov 17, 2026 •

Copy link
Copy Markdown
Member Author

Landed on release/v1.39 by pushing this branch's commits to it directly, as a fast-forward (8893f913fc..83041420dc), rather than with the merge button.

GitHub does not rebase-merge a pull request with more than 100 commits ("This branch can't be rebased"), and this one has 105. The branch was already on the tip of release/v1.39, so the push needed no rebase and no force: the commits on the branch are exactly the ones here, at the approved head (83041420dc), with the hashes unchanged.

GitHub has marked the pull request as merged as a result.

(bot assisted)

phlax added a commit that referenced this pull request Nov 17, 2026
… ones (#49321)

Stacked on #49205 (the branch carries its commits until it lands): this
is the last two commits, a port of #46986 (canonical pool names) and the
pins.

The release/v1.39 counterpart of #49078, regenerated from a measurement
of
release/v1.39 itself rather than picked: v1.39's targets and peaks
differ
from main's. Pins use the per-configuration `rbe_pool` spec of #49081,
with the `link` pools and the `cto`, `openssl` and `fuzz_coverage`
configurations of #49313 (both on this branch), on top of the canonical
pool names of #46986 (the previous commit).

Data: every CI job of release/v1.39 (with #49236's gcc-ci) run once in
envoy-ci-staging#2173 (2026-11-16), every remote action on the large
pool with the pins neutralised and every compile and link forced to
execute, peak RSS from the EngFlow traces. That covers the opt, asan,
tsan, msan, gcc, coverage, fuzz coverage, compile-time options and
OpenSSL jobs, and the API, config, format, deps and release jobs (as
`default`), including `//contrib/...`. Each pin is the smallest pool
clearing the target's peak with 5% headroom for compiles, 10% for links
and 20% for tests, for every configuration and action exactly: as #49313
has it, an action a spec does not name runs on the default pool, so a
pool is named only where an action needs more, and a configuration that
needs less than the target's `default` spec is spelled out too (with the
`default` pool where it needs no more), so that no measured action asks
for more than it measured. An action a configuration has no data for
gets what the target's `default` configuration gets. Generated with
`rbe_report.py pins`, as #49315 is for main.

The coverage links of 343 targets, the fuzz coverage links of 57, the
tsan links of 7 (the big binaries: `envoy-static`, `config_test`,
`router_check_tool`, `all_extensions_build_test`,
`extra_extensions_test`, `server_fuzz_test` and `config_fuzz_test`, at
12.5-13.7GB) and the msan test of
`//test/common/router:config_impl_test`
(12.9GB) need more than the large pool (12GiB) with headroom; they are
pinned to xlarge, each marked with its measured peak, so they no longer
rely on EngFlow killing and retrying them on a larger pool. They should
be
brought down, but until then the pin says what they need. The fuzz
coverage link of `//test/server:server_fuzz_test` (26.4GB) is over even
xlarge with headroom, and is marked so. No compile needs more than
large.

Result: 200 pins added, 1503 changed, 60 removed (on `source/`: 9
removed, 1 changed). The loop-defined codec fuzz tests in
`test/common/http` are pinned by hand from the measurement (their
`_lib`s compile at ~3.3-3.9GB, 5.3GB with gcc, their tsan links at
~3.9GB, their fuzz coverage links at ~12.6GB). The router check, schema
validator and config load check tools are pinned in `tools/`, where
#49262 (on this branch) moved them.

Tests pinned for CPU rather than memory keep their cores: the 55 tests
on release/v1.39's `2core` and `4core` pools (#36784, #36837), renamed
medium and large by the previous commit, have their test action on the
smallest pool with at least those cores (medium ~2, large ~4: the
actions a pool's RAM limit packs onto a machine) that fits their memory.
Libraries that had such a pin are sized by memory only (a compile uses
one core).

Acceptance: CI traces show every action's used pool equal to its
requested pool and no exit 137.

---------

Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.