emacs/fixrand.c: guard against NULL real_clock_gettime from dlsym failure - #278
Closed
edge-delta[bot] wants to merge 21 commits into
Closed
emacs/fixrand.c: guard against NULL real_clock_gettime from dlsym failure#278edge-delta[bot] wants to merge 21 commits into
edge-delta[bot] wants to merge 21 commits into
Conversation
Add package for the Haskell Language Server (HLS), the official LSP implementation for Haskell. Builds from source using GHC + Cabal with dynamic linking, copying the binary and all required shared libraries via ldd dependency resolution. - Source: GitHub tag 2.14.0.0 with automatic extraction - Build deps: base, cabal, ghc - Runtime deps: glibc - Network access enabled for cabal dependency index updates - Includes standalone version check test
…package) Info-ZIP unzip 6.0 has been frozen since 2009 and carries unfixed CVE-2014-8139/8140/8141 + CVE-2018-1000035 (4 HIGH) with no upstream to track — it was both vuln-exposed AND update-dark (pkgmgr check: no-source). bsdunzip, added to libarchive in 3.7.0, is its maintained successor. - New `packages/libarchive` (3.8.7, GithubRepo libarchive/libarchive, BSD-2): builds bsdtar/bsdcpio/bsdcat/bsdunzip + libarchive.so against zlib/bzip2/lzma (heavy optional backends disabled to keep the dep set lean). Source staged to gs://minimal-staging-archives/. - `packages/unzip` becomes a thin compat shim: a /usr/bin/unzip symlink to bsdunzip (libarchive runtime dep). Info-ZIP source + build dropped. bsdunzip is a drop-in for the flags our callers use — verified in bsdunzip.1 that -o/-q/-d/-p are all supported, so bun + chromium-bin + chromium-headless-shell-bin keep invoking `unzip` unchanged. Version-tracking now follows libarchive, so it's no longer update-dark. Locally validated: both build.ncl parse + resolve; `pkgmgr check --package unzip` now reports up_to_date (3.8.7) instead of a `no-source` skip. DRAFT — needs the buildbot to verify: libarchive compiles with the chosen configure flags, bsdunzip is produced, the symlink + OutputBin lint pass, the roundtrip test extracts via bsdunzip, and the three consumers (bun, chromium-bin, chromium-headless-shell-bin) still build against bsdunzip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The sandbox rejected the /usr/bin/unzip -> bsdunzip symlink: bsdunzip lives in the libarchive package's output, so the symlink 'points outside output directory'. Replace it with a /bin/sh wrapper that execs /usr/bin/bsdunzip (provided by the libarchive runtime dep) — a real file, no symlink escape; callers keep invoking unzip unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…zip plan) Reverses the bsdunzip migration: bun's build invokes `unzip -o -DD -d` and `-DD` (don't-restore-timestamps) is an Info-ZIP-only flag bsdunzip lacks, so swapping unzip→bsdunzip broke bun's build. Info-ZIP is the only impl with `-DD`. Instead, do what every distro does — keep frozen Info-ZIP 6.0 and apply the backported security patches. We were shipping the pristine `unzip_6.0.orig` tarball with NO patches, which is exactly why it scanned 4 HIGH. Now stage + apply Debian's full 6.0-29 series (31 patches): fixes CVE-2014-8139/8140/8141/ 9636/9913, CVE-2015-7696/7697, CVE-2016-9844, CVE-2018-1000035, CVE-2019-13232, CVE-2022-0529/0530 + build fixes. Patch 30 drops the K&R gmtime()/localtime() declarations, replacing the manual sed that lived in build.sh. Drops the new libarchive package (no remaining consumer). unzip stays update-dark, which is correct: 6.0 is EOL and the patches are its maintenance. Follow-up: VEX the patched CVE IDs so the version-based scanner (which can't see the backported fixes) clears them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… edits) The previous commit's git-add aborted on the already-removed libarchive pathspec, so the build.ncl patches Source + build.sh apply-loop never staged. This adds them: the staged-tarball Source and the series-apply loop (and removes the now-redundant gmtime sed, handled by patch 30). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mkromfs/pack_ps read SOURCE_DATE_EPOCH but then do `if (!buildtime) buildtime = time(NULL)`, treating the sandbox's SOURCE_DATE_EPOCH=0 (epoch 0 is falsy) as unset and falling back to wall-clock time. That stamped a non-deterministic gs_romfs_buildtime into usr/bin/gs. Fall back to time() only when SOURCE_DATE_EPOCH is genuinely unset (base/mkromfs.c:2614, base/pack_ps.c:344). Verified on aarch64: two from-scratch builds are byte-identical (repro-check diff, 196/196 files). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
After the existing fixrand.so shim (getrandom/urandom), the dumped .pdmp still differed in 11 bytes — two wall-clock timestamps read via clock_gettime(CLOCK_REALTIME), which the shim didn't cover: the *scratch* buffer's buffer-display-time (Fcurrent_time in make_initial_frame) and Vgc_elapsed GC timing (src/alloc.c). Extend the shim to return SOURCE_DATE_EPOCH for CLOCK_REALTIME (other clocks pass through). Verified on aarch64: two from-scratch builds are byte-identical (repro-check diff, 4282/4282 files). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mono's AOT output had three independent non-determinism sources:
1. build_date: bare `date` in mono/mini/Makefile.am.in ignores
SOURCE_DATE_EPOCH -> wall-clock in mono-sgen + AOT version strings.
Pin it from the epoch before autogen.sh.
2. AOT id: aot-compiler.c generate_aotid() emits 16 random bytes into
each AOT image. The net_4_x build doesn't thread the 'deterministic'
aot option, so zero the aotid at the source (same emitted result).
3. AOT temp name: g_file_open_tmp("mono_aot_XXXXXX") leaks a random
suffix into each *.dll.so as a local STT_FILE symbol. Strip the
runtime-unneeded locals from the AOT images post-install.
Verified on aarch64: two from-scratch builds are byte-identical
(repro-check diff, 3131/3131 files).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…hanges) Adopts the hardening idea from the Edge Delta bot's #274 (cleanly — no whole-file reindentation, executable bit preserved): verify the 'if (!buildtime)' pattern exists in both files before sed-ing, so a future ghostscript that renames it fails the build instead of silently shipping a non-reproducible binary. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CPython's configure resolves MODULE__CTYPES_LDFLAGS via PKG_CHECK_MODULES, which non-deterministically picks '-L/usr/lib/../lib64' vs '-L/usr/lib/../lib' -> leaks into _sysconfigdata*.py/.json and config-*/Makefile (6 files flip across builds). Pin LIBFFI_CFLAGS/LIBFFI_LIBS on the configure line so it uses them verbatim and skips pkg-config; result is '-lffi -ldl' every build. Verified: with this pin, the _sysconfigdata libffi flip is gone from a build-twice diff. (Full byte-reproducibility of python additionally needs a pinned toolchain — .comment records the binutils version — and is gated on the --enable-optimizations/PGO perf decision; both are out of scope here.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GHC's code output is already reproducible; the residual is metadata ordering from hash-set iteration of package/UnitId collections: 1. link-arg/DT_NEEDED/.dynstr order — backport of upstream GHC #26838 / MR !15453 (sort preload1 in compiler/GHC/Unit/State.hs); Debian ships this exact patch for 9.10.3. 2. ghc-pkg package.cache — sort the .conf list before serialize in utils/ghc-pkg/Main.hs (no upstream fix; sort already imported). Both guarded by grep so a future GHC source change fails the build loudly. Fixing the compiler propagates to all downstream Haskell (stack, HLS). DRAFT: Debian-proven + guarded, but not yet local build-twice-verified (GHC is a multi-hour build_cost_multiple=6 build). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per review on #277: patch (2) relies on 'sort' being in scope in utils/ghc-pkg/Main.hs. 9.10.3 imports it (Main.hs:78), but add a grep guard so a future GHC import reorg fails fast here rather than deep in the multi-hour Hadrian build. Output-neutral; verified result unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Edge Delta AI Teammates seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
github-actions
Bot
force-pushed
the
unstable
branch
from
June 20, 2026 01:38
77b22dd to
f7f44e1
Compare
bryan-minimal
added a commit
that referenced
this pull request
Jun 20, 2026
Defensive NULL check before deref of real_clock_gettime: if dlsym(RTLD_NEXT, "clock_gettime") ever returns NULL, fail with ENOSYS instead of segfaulting. The CLOCK_REALTIME path already returns before this point, so this only affects pass-through clocks (CLOCK_MONOTONIC, etc.) — but it makes the shim robust regardless. Folds in the one valid point from the Edge Delta bot's #278. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
Thanks — the NULL-guard point is valid (defends against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a NULL pointer guard before calling through
real_clock_gettimein theclock_gettimeLD_PRELOAD interposer. Ifdlsym(RTLD_NEXT, "clock_gettime")fails (returns NULL) and the caller requests a clock other thanCLOCK_REALTIME, the code previously dereferenced a NULL function pointer — crashing the process with SIGSEGV. Now it returns-1witherrno = ENOSYS.Triggered by push alert
monitorEventId=3FNVByLKQSe4omCvDwADCLVKbhLon commit78c875f018da565575d949eef4cfed3cdce238c2(merge of PR #273 intounstable).Related issues
Changes
packages/emacs/fixrand.c: Addedif (!real_clock_gettime) { errno = ENOSYS; return -1; }before thereturn real_clock_gettime(clk_id, tp)fallthrough, preventing a NULL pointer dereference whendlsymfails to resolve the realclock_gettimesymbol.Checklist
min checkpasses for the affected packages/harnesses.min patched-build <name>succeeds for any package I added or modified.source_provenancepoints to the canonical upstream and the source builds from source (not a prebuilt release binary) where the required toolchain is available.sha256against the upstream archive.Notes for reviewers
This is a one-line defensive guard with no happy-path behavior change.
dlsym(RTLD_NEXT, ...)can fail in unusual linker configurations (e.g., if the shim is loaded without libc in the link chain, or in static-linked contexts). The existingread()interposer at line 50 has the same latent issue but predates this push — out of scope for this fix.Complementary to PR #274 which hardens
strtollvalidation on the same function'sSOURCE_DATE_EPOCHparsing — this fix addresses a different failure path (dlsym resolution, not input validation).This pull/merge request was created by Edge Delta AI Teammates — automated NULL-safety fix from push event code review.
This pull/merge request was created by Edge Delta AI Teammates — see #code-issues for the original conversation.