Repository navigation
Link Research Linux packages against glibc 2.39 and verify the floor - #1454
Conversation
|
Maple Auth development preview: https://695f0cf2.maple-auth-dev.pages.dev Commit: Uses development services. Cloudflare Access applies. Provider OAuth is not configured for PR URLs; use the stable Auth Dev host for OAuth rehearsal. |
|
Maple development preview: https://c6beff7b.maple-ca8.pages.dev Commit: Uses development API, billing, flags and PCR configuration. Cloudflare Access applies. |
Review: tested on real Ubuntu 24.04Verdict: this is the right fix for the I added
In CI, Fix before mergeLinking through
With the pinned zig 0.17.0, a small C test confirms the default, and adding Worth knowing
AppImage dataScanned from the published 3.4.7 AppImage. The problem is narrower than the whole Nix closure:
If the AppImage ships with this floor, a preflight message alone won't protect people. The updater would still replace a working install, and clients fall back from |
Review of #1454 found that linking through zig cc dropped the C hardening nixpkgs' compiler wrapper applied: zig does not read NIX_HARDENING_ENABLE, so C dependencies such as ring were built without the stack protector or _FORTIFY_SOURCE. Give C and C++ dependencies the wrapper's flags explicitly (LINUX_C_HARDENING_FLAGS) through CFLAGS, CXXFLAGS and their CMake equivalents, the variables the reproducible-build path remaps already use. In the rebuilt `maple` the stack canary checks go from 22 back to 761 (567 in the 3.4.5 release) and the fortified glibc imports return. zig's compiler-rt supplies __stack_chk_fail and several __*_chk functions statically, so the stack protector leaves no import to assert. The ELF check therefore gains --require-fortify: a packaged `maple` must import at least one fortified glibc function, which is the evidence that the flags reached the C dependencies. The package verifiers and the pre-bundle check use it, and it rejects the build this PR first produced. Also stop the check crashing on GLIBC_ABI_* loader markers. They are not numbered releases and distributions backport them, so each known marker names the first release whose every build defines it and any other counts as above the floor. Ubuntu 24.04's glibc defines only GLIBC_ABI_DT_RELR, so a file needing GLIBC_ABI_GNU2_TLS is reported by name. Verified with the research-desktop-linux lane locally and by launching the resulting .deb on Ubuntu 24.04. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Thanks for testing on a real VM. Pushed 5bb2008 for the review points. Hardening (the fix-before-merge item). Confirmed: zig does not read
The mem/str Guard. Because the stack-protector symbol is not observable,
Verification on 5bb2008. Still open, unchanged by this push.
🤖 Generated with Claude Code |
The 3.4.7 Linux .deb, .rpm and AppImage fail to start on Ubuntu 24.04 and Mint 22 with "version `GLIBC_2.43' not found" (#1453). The Linux release links `maple` against the Nix shell's glibc and then patches in the system ELF interpreter, so whatever glibc nixpkgs carries becomes the floor the package needs. The nixpkgs bump in #1431 moved that glibc from 2.40 to 2.44, and libm now binds acosf/atan2f to GLIBC_2.43. 3.4.5 and 3.4.6 only worked because glibc 2.40 added no symbol the app used. Link against an explicit floor instead, the way the Agent app already does: cargo-zigbuild's zig cc wrapper with `-target x86_64-linux-gnu.2.39` (Ubuntu 24.04, the oldest supported distribution). The linker and C compiler are set through Cargo's target.<host> environment so tauri-cli's own cargo builds honour them without changing the target/release layout. Executables link with the Nix loader while they build and run under the build's Nix LD_LIBRARY_PATH; the existing sanitize step gives the packaged executable the system loader back. The wrapper runs on the Nix bash and pins zig and rustc so cargo-zigbuild never probes PATH, python or `$RUSTC_WRAPPER rustc` from inside sccache's server. Add scripts/ci/elf_glibc_floor.py, which parses the ELF version needs and fails when a file needs a GLIBC_x.y above the floor, naming the symbols. The build runs it on target/release/maple before bundling and the .deb, .rpm, AppImage and Research Dev RPM verifiers run it on every packaged copy, so a nixpkgs bump cannot raise the requirement silently. Verified with the research-desktop-linux lane locally: the packaged `maple` needs at most GLIBC_2.39 (pidfd_spawnp from std) with the system interpreter, where the 3.4.7 release needs GLIBC_2.43. Not covered: the AppImage's bundled Nix WebKitGTK libraries need GLIBC_2.44 themselves, so the AppImage still needs a separate decision (bundle glibc, or pin the Linux runtime closure). Fixes #1453 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Review of #1454 found that linking through zig cc dropped the C hardening nixpkgs' compiler wrapper applied: zig does not read NIX_HARDENING_ENABLE, so C dependencies such as ring were built without the stack protector or _FORTIFY_SOURCE. Give C and C++ dependencies the wrapper's flags explicitly (LINUX_C_HARDENING_FLAGS) through CFLAGS, CXXFLAGS and their CMake equivalents, the variables the reproducible-build path remaps already use. In the rebuilt `maple` the stack canary checks go from 22 back to 761 (567 in the 3.4.5 release) and the fortified glibc imports return. zig's compiler-rt supplies __stack_chk_fail and several __*_chk functions statically, so the stack protector leaves no import to assert. The ELF check therefore gains --require-fortify: a packaged `maple` must import at least one fortified glibc function, which is the evidence that the flags reached the C dependencies. The package verifiers and the pre-bundle check use it, and it rejects the build this PR first produced. Also stop the check crashing on GLIBC_ABI_* loader markers. They are not numbered releases and distributions backport them, so each known marker names the first release whose every build defines it and any other counts as above the floor. Ubuntu 24.04's glibc defines only GLIBC_ABI_DT_RELR, so a file needing GLIBC_ABI_GNU2_TLS is reported by name. Verified with the research-desktop-linux lane locally and by launching the resulting .deb on Ubuntu 24.04. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The glibc 2.39 floor fixes `maple`, which is all the .deb and .rpm carry. The AppImage also bundles Nix-built WebKitGTK, GTK and GStreamer while taking libc from the host. Of its 628 ELF files, 44 need more than glibc 2.39 and ten need 2.44, WebKitGTK and JavaScriptCore among them. Those cannot be relinked, so the AppImage cannot run on Ubuntu 24.04 whatever `maple` itself needs, and until now failed there in the dynamic loader with a missing symbol version. Make that floor explicit instead of accidental: - LINUX_APPIMAGE_GLIBC_FLOOR (2.44) declares the newest glibc any bundled file needs. - AppRun sources a new maple-glibc-floor.sh hook before any bundled runtime hook. On a host below the floor it explains the requirement, points to the .deb and .rpm (glibc 2.39 and newer) and exits, with a best-effort desktop dialog for launches without a terminal. A host that reports no glibc version is not refused, and MAPLE_APPIMAGE_SKIP_GLIBC_CHECK=1 overrides the check. - AppImage verification scans every bundled ELF file and fails when the bundle needs more than the declared floor, when nothing needs it, or when AppRun announces another floor. A nixpkgs bump that moves the requirement therefore has to change the constant in the same change. elf_glibc_floor.py gains --summary and --exact for that scan, and learns the two loader markers glibc 2.43 introduced (GLIBC_ABI_GNU2_TLS, GLIBC_ABI_DT_X86_64_PLT). Verified with the research-desktop-linux lane locally: the built AppImage prints the message and exits 1 on Ubuntu 24.04, Ubuntu 26.04, Debian 13 and Fedora 43, and starts on Ubuntu 26.10. This does not stop the updater from replacing a working AppImage on a host below the floor; that needs a separate change to the update metadata. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
da646b2 to
b7101c5
Compare
|
@AnthonyRonning an update on the AppImage, since your review raised it and the PR now does something about it. The earlier reply covers the hardening fix; this is about the approach we took for the AppImage and why. Decision: declare the AppImage's floor instead of trying to lower it. We looked at the alternatives and landed here for this PR:
What the PR does (commit b7101c5):
Tested: the built AppImage prints the message and exits 1 on Ubuntu 24.04, Ubuntu 26.04, Debian 13 and Fedora 43, and starts and completes its update check on Ubuntu 26.10 and Fedora 45 (headless, Xvfb). In distro terms it now runs on 26.10, Fedora 45, Arch and Tumbleweed. Your updater point still stands and is not fixed here. A clear message does not stop the updater from replacing a working AppImage on a host below the floor, and the Status: rebased on master (picks up #1468), 🤖 Generated with Claude Code |
|
A correction to my previous comment. I wrote that the AppImage "starts and completes its update check on Ubuntu 26.10 and Fedora 45". That overstated what I had tested. What I had actually checked: that the What a closer look shows. On Ubuntu 26.10 in the minimal container I used, With the host's own This is not from this PR. The published 3.4.7 AppImage has the same embedded path in Nothing in this PR's code changes as a result. I have updated the description's verification notes to say what was tested at the process level and to describe this caveat. 🤖 Generated with Claude Code |
AnthonyRonning
left a comment
There was a problem hiding this comment.
Approved after testing the final build (b7101c5) on real Ubuntu 24.04 and Fedora 45 desktops.
Fixes #1453.
Problem
The 3.4.7 Linux
.deb,.rpmand AppImage fail to start on Ubuntu 24.04 and Mint 22:The Linux release links
mapleagainst the Nix shell's glibc and then patches in the system ELF interpreter, so whatever glibc nixpkgs carries becomes the floor the package needs. #1431 moved nixpkgs' glibc from 2.40 to 2.44, and libm now bindsacosf/atan2ftoGLIBC_2.43. 3.4.5 and 3.4.6 only worked because glibc 2.40 added no symbol the app used; the margin was already zero against Ubuntu 24.04's 2.39. The nixpkgs bump itself was wanted (libsoup CVE fixes), so reverting it is not the fix.mapleneedsacosf,atan2f)Fix:
.deband.rpm(glibc 2.39 floor)Link against an explicit floor, the way the Agent app already does: cargo-zigbuild's
zig ccwrapper with-target x86_64-linux-gnu.2.39(Ubuntu 24.04, the oldest supported distribution per maple.ai/downloads).LINUX_GLIBC_FLOORinscripts/ci/_common.shis the one place the floor lives.configure_linux_glibc_floor_linkersets Cargo'starget.<host>linker and theCC/CXXfor C dependencies through the environment, so tauri-cli's own cargo builds honour it and thetarget/releaselayout is unchanged. Called fromdesktop-release.sh,desktop-pr.shandresearch-dev-desktop.sh.LD_LIBRARY_PATH(build scripts included); the existing sanitize step gives the packaged executable the system loader back.$RUSTC_WRAPPER rustcfrom inside sccache's server (cc-rs routes C compiles through sccache too).NIX_HARDENING_ENABLE, soLINUX_C_HARDENING_FLAGSgives C and C++ dependencies the hardening the Nix compiler wrapper applied (stack protector,_FORTIFY_SOURCE=3, stack clash protection, and the rest of that set).cargo-zigbuildandzigjoin thedesktop-linuxshell; the shell exportsMAPLE_NIX_ELF_INTERPRETER.AppImage: a declared glibc 2.44 floor
The AppImage cannot get the 2.39 floor this way. It bundles Nix-built WebKitGTK, GTK and GStreamer while taking libc from the host, and those libraries cannot be relinked. Of its 628 ELF files, 571 need glibc 2.39 or older, 3 need 2.42, 31 need 2.43 and 10 need 2.44, WebKitGTK and JavaScriptCore among them. Until now it failed below that in the dynamic loader with a missing symbol version.
This PR makes that floor explicit instead of accidental:
LINUX_APPIMAGE_GLIBC_FLOOR(2.44) declares the newest glibc any bundled file needs.AppRunchecks the host's glibc before any bundled runtime hook. Below the floor it explains the requirement, points to the.deband.rpm(glibc 2.39 and newer) and exits, with a best-effort desktop dialog for launches without a terminal. A host that reports no glibc version is not refused, andMAPLE_APPIMAGE_SKIP_GLIBC_CHECK=1overrides the check.AppRunannounces another floor. A nixpkgs bump that moves the requirement has to change the constant in the same change.In practice the AppImage now runs on Ubuntu 26.10, Fedora 45, Arch and openSUSE Tumbleweed, and tells users of Ubuntu 24.04/26.04, Debian 13 and Fedora 43/44 to install the
.debor.rpm.Guard
scripts/ci/elf_glibc_floor.pyparses ELF version needs and fails when a file needs aGLIBC_x.y, or aGLIBC_ABI_*loader marker, above the floor, naming the symbols.--require-fortifyalso requires a fortified glibc import, as evidence the hardening flags reached the C dependencies (zig's compiler-rt supplies__stack_chk_failstatically, so that import cannot be asserted). The build runs it ontarget/release/maplebefore bundling, the.deb,.rpm, AppImage and Research Dev RPM verifiers run it on every packagedmaple, and the AppImage verifier runs it across the whole bundle.Verification
Head is b7101c5, rebased onto master at f633b70. CI is green on that head: 36 jobs pass and
ci-okpasses, withci:packageselecting the desktop packaging lanes. The launch tests below were run locally on the same three commits before the rebase, which had no conflicts.research-desktop-linuxlane (desktop-pr.shwith fake updater signing): exit 0. Every packagedmaplereportsGLIBC_2.39 floor=2.39 fortify=2; the AppImage reportsGLIBC_2.44 floor=2.44 files=628. CI's run of this lane on b7101c5 reports the same lines..deblaunched on Ubuntu 24.04 (glibc 2.39), where the published 3.4.7 fails with theGLIBC_2.43error..rpmlaunched on Fedora 42 (glibc 2.41), where the published 3.4.7 fails the same way, and on Fedora 45 (glibc 2.44).libGLESv2.so.2installed, as a desktop has,maple,WebKitNetworkProcessandWebKitWebProcessare all alive after 25 s.mapleare 761 (567 in the 3.4.5 release, 22 before the flags were added).nix flake check(therepolane): 562 CI script tests pass, includingtest_linux_glibc_floor.py(synthetic ELF fixtures, the linker setup through fake tools, theAppRuncheck against a fakegetconf, and the bundle verification failing in each direction).All of these launches were headless containers under Xvfb, up to the update check. Separately, the
.debfrom an earlier commit of this PR was installed on a real Ubuntu 24.04 VM during review and reached the login screen. Nobody has signed in on a fixed build.Not covered
linux-x86_64-appimagetolinux-x86_64. That needs a separate change to the update metadata and the scripts that require those keys.desktop-release.shhas not run with these changes; it calls the same functions asdesktop-pr.sh.__stack_chk_guardglobal, which zig's compiler-rt defines as a fixed constant. Releases are x86_64 only, where the canary comes from glibc's TLS slot.libGLESv2.so.2by an absolute/nix/storepath. On a host without its ownlibGLESv2.so.2(a minimal container), the AppImage logsCouldn't open libGLESv2.so.2andWebKitWebProcessdoes not survive whilemaplekeeps running. With the host library present the renderer runs. That is being fixed separately.🤖 Generated with Claude Code