Skip to content

Publish Linux gap wheels (manylinux_2_28 x86_64, musllinux_1_2 aarch64) - #3

Merged
patrickballard merged 4 commits into
mainfrom
linux-publish
Nov 17, 2026
Merged

patrickballard merged 4 commits into
mainfrom
linux-publish

Conversation

@patrickballard

Copy link
Copy Markdown
Contributor

Stage, install-test and publish now handle the three Linux lab targets. Until now this was Windows only. Nothing goes public from this PR on its own: every publish run still waits for a maintainer to approve the publish environment.

What gets published

Each target gets exactly one tag: the one auditwheel repairs to in the target's pinned build image. linux_* tags, compressed tag sets and any other manylinux version are refused.

Target Tag
3.14t linux-x86_64 cp314-cp314t-manylinux_2_28_x86_64
3.14 musl-aarch64 cp314-cp314-musllinux_1_2_aarch64
3.15 linux-x86_64 cp315-cp315-manylinux_2_28_x86_64

Stage checks (trusted job, parses bytes and never runs them)

  • elf_needs is a bounds-checked reader for untrusted ELF files. It reads them the way the dynamic loader does (program headers, PT_DYNAMIC, DT_NEEDED, DT_VERNEED) and returns the needed libraries and the version needs (.gnu.version_r). It returns None (and the wheel is refused) for: a 32-bit or big-endian file, the wrong e_machine, truncated tables, offsets outside a loaded segment, a missing DT_NULL, version chains that don't end, or non-ASCII names.
  • missing_libs runs elf_needs on every .so/.so.N in the wheel, and on any other member that starts with the ELF magic.
    • Each needed library must be either on the policy allowlist or a file somewhere in the wheel. auditwheel puts bundled libraries in <dist>.libs/ and sets RUNPATH there.
    • The allowlists and symbol-version sets are copied from auditwheel 6.8.2, the version REPAIR_TOOLS pins: src/auditwheel/policy/manylinux-policy.json (manylinux_2_28, x86_64) and musllinux-policy.json (musllinux_1_2, where libc.so maps to libc.musl-aarch64.so.1 as auditwheel does).
    • For glibc it checks GLIBC, GLIBCXX, CXXABI, GCC, LIBATOMIC and ZLIB needs against the policy, the way auditwheel does. For example, GLIBC_2.34, GLIBC_PRIVATE and GLIBCXX_3.4.30 are refused. Versions from ld-linux* are skipped, as in auditwheel.
    • Musl has no symbol versions, so only the library check applies there.
  • take_wheel picks the check from the target: PE for Windows, ELF for Linux (by plat).

Install test in minimal containers

Linux targets run docker run on a runner of their architecture, not on GitHub's runner image. The checkout and staged wheels are mounted read-only, and no token or secret is passed in. The job keeps its existing properties: read-only token, no caches, persist-credentials: false. Windows targets are unchanged and still use setup-python.

All image digests are multi-arch indexes, read from the Docker Hub registry API on 2026-11-17:

  • 3.14 musl-aarch64: python:3.14-alpine@sha256:5862d971… (CPython 3.14.10). It's the same digest the build uses. Runner: ubuntu-24.04-arm.
  • 3.15 linux-x86_64: python:3.15-slim-trixie@sha256:65a65fc7… (CPython 3.15.2, glibc 2.41). Runner: ubuntu-latest.
  • 3.14t linux-x86_64: there's no official free-threaded image, so it uses debian:trixie-slim@sha256:a72b4433… plus python-build-standalone 20261110 3.14.10 freethreaded install_only. That archive is pinned by URL and by the sha256 from the release's SHA256SUMS. The runner downloads it, checks it with sha256sum -c, unpacks it and mounts it read-only at /opt/python, so no curl or CA store is added to the image (pip uses its bundled certifi). Runner: ubuntu-latest.

install_and_import already handles bin/ vs Scripts/. The tests matrix now carries image, interpreter, python_url and python_sha256, set to empty strings for Windows.

Also

  • build_gap_index.covers: our Linux wheel now drops out of the index once PyPI ships the same Python and ABI for an older or equal manylinux or musllinux version of the same architecture (including the legacy manylinux2014/2010/1 aliases). Without this, pip would prefer our manylinux_2_28 wheel over PyPI's manylinux_2_17 one.
  • README, the index page and the module docstrings now list the published targets and the Linux checks. They say plainly that no Linux wheel is published until a maintainer approves a run that includes one.

Not done

  • No workflow has been run with these changes. The container install test hasn't run on real runners yet, so the first batch's install-test logs are worth a look before approving its publish.
  • auditwheel's zlib-internal-symbol blacklist isn't re-checked in stage; the repair in the build enforces it.
  • The 3.14t and 3.15 glibc tests run on glibc 2.41 (Debian 13), not on a glibc 2.28 system. The 2.28 limit is enforced by the static symbol-version check, not by the test.
  • The image, python-build-standalone and auditwheel pins all have to be bumped by hand, and the policy copy has to change together with REPAIR_TOOLS. A test asserts the auditwheel pin.

Tests

uvx --python 3.14 [email protected]: 92 passed, 1 skipped. The skip is a real-interpreter ELF test that runs only on Linux x86_64, so it runs in CI.

New tests cover:

  • tag_ok for the new tags, and refusal of linux_*, compressed sets, manylinux_2_17/2014/2_34, the wrong ABI, the wrong arch and the wrong libc.
  • A consistency test tying each Linux tag to the build's plat, its policy and a digest-pinned test image.
  • The ELF reader on synthetic files: needed libraries that are allowed, bundled or missing, needs from a bundled library itself, GLIBC_2.34 and other version needs, truncated or garbage bytes, 32-bit and big-endian files, the wrong machine, and corrupted tables.
  • stage_reason and take_wheel for Linux wheels.
  • The stage matrix entries for Linux (runner, image, interpreter and PBS fields).
  • install-test for a Linux target.
  • Index withdrawal for older manylinux and musllinux wheels.

The ELF checker was also run by hand on real PyPI wheels (lz4, zstandard and numpy for manylinux, with numpy's bundled OpenBLAS, and orjson for musllinux aarch64). All passed with nothing missing.

🤖 Generated with Claude Code

patrickballard and others added 4 commits November 17, 2026 09:21
…ch64

Stage now takes Linux wheels for the three Linux lab targets, each with
exactly auditwheel's repaired tag: 3.14t and 3.15 manylinux_2_28_x86_64,
3.14 musllinux_1_2_aarch64.

- A bounds-checked ELF reader (program headers, dynamic segment, version
  needs) checks every ELF file in the wheel: each needed library must be
  bundled in the wheel or on auditwheel 6.8.2's manylinux_2_28 or
  musllinux_1_2 list, and for glibc every symbol version must be one the
  policy allows (no GLIBC above 2.28, nor GLIBCXX/CXXABI/GCC above it).
  Anything unreadable refuses the wheel. Windows keeps the PE check.
- install-test runs Linux targets with docker run in a minimal image
  pinned by digest: python:3.14-alpine, python:3.15-slim-trixie, and
  debian:trixie-slim with a sha256-checked python-build-standalone 3.14t.
- The index withdraws our Linux wheel when PyPI ships one for an older or
  equal manylinux/musllinux of the same architecture.
- README and index page name the published targets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…NPATH

Review fixes for the Linux stage check:

- Version needs from ld-linux-* are checked like any other, so a
  _dl_find_object@GLIBC_2.35 or GLIBC_PRIVATE need is refused.
- The version-needs walk follows vn_next/vna_next to 0 by address, as
  _dl_check_map_versions does, and refuses a file whose chains don't
  match DT_VERNEEDNUM and each vn_cnt (needs hidden past a count).
- PT_LOAD segments must be in vaddr order and may not share a page with
  a different file offset, so offset() reads what the loader maps.
- A needed library counts as bundled only if it is in the needing file's
  folder or on its DT_RUNPATH (else DT_RPATH) under $ORIGIN, within the
  wheel and its install scheme; anything else must be on the allowlist.
- Library, version and search-path names are restricted to a safe
  character set, and one wheel's ELF files may be read up to 1 GB in all.
- install-test containers run with --cap-drop ALL and no-new-privileges,
  and the host copies tested.json only if it's a regular file.
- read_tested binds each answer to its artifact's slug, not the target
  its JSON names.
- README says "links against" and that dlopen'd libraries aren't checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the needing file's own folder from the places a needed library may
be found: only $ORIGIN entries of its DT_RUNPATH (or DT_RPATH when there
is no RUNPATH) count. A wheel that works only because the package
preloads a library with ctypes isn't published.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- installed() maps only the wheel's own <name>-<version>.data folder (from
  its one .dist-info folder) by install scheme, as pip does; another
  top-level *.data folder installs as is. A wheel without exactly one
  .dist-info folder is refused.
- The segment page-sharing check uses the largest page a kernel of that
  machine uses: 4 KiB on x86_64, 64 KiB on aarch64. A flat 64 KiB would
  refuse ordinary x86_64 binaries (lz4, zstandard, numpy all fail it).
- README step 4: only $ORIGIN RUNPATH/RPATH entries count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patrickballard
patrickballard merged commit 0dc4274 into main Nov 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant