static: curl cumple link=static — el binario sellado NO corría en el host

Primera de las 28 que static-audit.sh destapó. libtool ignoraba el -static del
lab (lo lee como "preferí mis .a"), así que el curl sellado salía dinámico con
NEEDED libz.so.1 + libc.so — y libc.so es el soname de la musl de zig, que en
el host son 255B de linker script. Resultado: el artefacto NO arrancaba fuera
del sandbox ("Error relocating /lib/libz.so.1: __snprintf_chk").

Fix: LDFLAGS="-all-static -no-pie" en compile Y en install (libtool relinkea
al instalar); nunca en configure, donde rompería los link-tests.

Verificado: 0 NEEDED, corre en el HOST (curl 8.20.0, OpenSSL/3.5.4, zlib/1.3.1)
y hace HTTPS real (http=200). Bit-repro: b3:19a919b28c25 ×2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 04:09:37 -04:00
co-authored by Claude Opus 4.8
parent 9395fbfc5c
commit 340f8eb5b5
+9 -2
View File
@@ -25,8 +25,15 @@ configure = '''
--disable-ldap --enable-ipv6 --enable-unix-sockets \
--with-ca-path=/etc/ssl/certs
'''
compile = 'make'
install = 'make DESTDIR=/out install'
# -all-static (patrón de jq/parted/shadow/procps-ng): curl linka CON LIBTOOL, que lee el `-static`
# del lab como "preferí mis .a", NO como flag al linker ⇒ `link = "static"` se ignoraba EN SILENCIO
# y el binario salía dinámico (`NEEDED: libz.so.1, libc.so`). `libc.so` es el soname de la musl que
# zig bundlea; en el host son 255B de linker script ⇒ el curl sellado NO CORRÍA fuera del sandbox
# ("Error relocating /lib/libz.so.1: __snprintf_chk"). Medido con scripts/static-audit.sh.
# Va SÓLO en compile e install: en configure rompería los link-tests (no pasan por libtool), y en
# install porque libtool RELINKEA el binario al instalar.
compile = 'make LDFLAGS="-all-static -no-pie" -j"$(nproc)"'
install = 'make DESTDIR=/out install LDFLAGS="-all-static -no-pie"'
[deps]
build = ["openssl", "zlib", "perl"]