Skip to content

Commit 12303d2

Browse files
committed
fix(plugin): attribute musl version checks to their libraries
1 parent a32fadd commit 12303d2

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎plugins/codex-security/native/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Build outputs stay under ignored `target` and `dist` directories. Linux output d
2929
node plugins/codex-security/native/check.mjs
3030
```
3131

32-
GNU Linux artifacts must import no glibc version newer than 2.28. Musl artifacts must be ELF images for the current architecture, depend on that architecture's musl library, and import no glibc symbols. Musl has no glibc-style symbol version floor, so its runtime compatibility also requires the load proofs below. macOS artifacts must declare a deployment target of 11.0 or earlier. A build from a newer GNU Linux workstation can pass the behavioral proof and still fail this distribution check.
32+
GNU Linux artifacts must import no glibc version newer than 2.28. Musl artifacts must be ELF images for the current architecture, depend on that architecture's musl library, and have no version requirements from glibc. GCC's own `GLIBC_2.0` compatibility exports are attributed to `libgcc_s.so.1`, not the C library. Musl has no glibc-style symbol version floor, so its runtime compatibility also requires the load proofs below. macOS artifacts must declare a deployment target of 11.0 or earlier. A build from a newer GNU Linux workstation can pass the behavioral proof and still fail this distribution check.
3333

3434
The `native-unix` workflow builds Linux artifacts in digest-pinned manylinux 2.28 images. It mounts the pinned Rust toolchain and fetched Cargo registry, builds offline, and blocks Python commands during compilation. macOS builds set `MACOSX_DEPLOYMENT_TARGET=11.0`. CI verifies separate x64 and arm64 artifacts on both platforms using Node 20.0.0 and 22.13.0. These artifacts are inputs to the later universal-package gate.
3535

‎plugins/codex-security/native/check.mts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,21 @@ if (
6666
const dependencies = [
6767
...dynamic.matchAll(/\(NEEDED\)[^\n]*\[([^\]]+)\]/gu),
6868
].map((match) => match[1]!);
69+
// libgcc uses GLIBC_2.0 for its own compatibility exports on aarch64.
70+
const requiresGlibc = [
71+
...versions.matchAll(/\bFile:\s+(\S+)([\s\S]*?)(?=\bFile:|$)/gu),
72+
].some(
73+
(match) =>
74+
match[1] !== "libgcc_s.so.1" && /\bName:\s+GLIBC_/u.test(match[2]!),
75+
);
6976
if (
7077
architecture === undefined ||
7178
bytes.toString("latin1", 0, 4) !== "\x7fELF" ||
7279
bytes[4] !== 2 ||
7380
bytes[5] !== 1 ||
7481
bytes.readUInt16LE(18) !== architecture.machine ||
7582
!dependencies.includes(`libc.musl-${architecture.name}.so.1`) ||
76-
/\bGLIBC_/u.test(versions)
83+
requiresGlibc
7784
) {
7885
throw new Error(
7986
"Native payload is not a musl ELF image for this architecture, or imports glibc.",

0 commit comments

Comments
 (0)