Repository navigation
test: lake: cacheInsertPartial's preload replaces C library calls - #8
Merged
legion-implementer[bot] merged 3 commits intoNov 28, 2026
Conversation
cacheInsertPartial failed in the job "build / Linux release" on the tag v4.36-machcsl-r20 for a defect of the test: its preload (NoHardLink.c) replaced libuv's `uv_fs_link` and `uv_fs_stat`. A release build links libuv statically into libleanshared.so, with -Bsymbolic, so the runtime's calls of these functions bind inside that library and the preload never ran: on the tag the hard link into the cache succeeded, and the test found no "d2c4f49280adf1f1.art: not cached" line. The preload now replaces the C library's `link`, which libuv's `uv_fs_link` calls, and `syscall` for `statx`, which libuv's `uv_fs_stat` calls. A process calls the C library through the dynamic linker, so the preload takes these calls in a release as in any other build. The test's cases and expectations are unchanged. fork/v4.36-lake-remote-fallback-flat carries the same NoHardLink.c and gets the same change. Part of LINUX-1736. Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
legion-implementer Bot
added a commit
that referenced
this pull request
Nov 28, 2026
…ntegration The heads of the pull requests that make r21's CI member and its -r21 copies, merged on the first integration commit: #6 (the CI member, on the trunk), #7 (remoteExec, usageCutoffCrossTree and cacheInsertPartial in the service-mode member), #8 (cacheInsertPartial in the cache-insert member), #9 (ccIdentity), #10 and #11 (usageCutoffCrossTree in the two pack members) and #12 (the Windows declaration in the lazy-import-names member). The merge needs no resolution: its tree is the first integration commit's tree with each pull request's change, and where two of them make the same change (usageCutoffCrossTree's writable lakefile, cacheInsertPartial's preload) that change once. Refs: LINUX-1736 Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
…and holds libc stat Review of the previous commit found two defects in NoHardLink.c, the preload of cacheInsertPartial: - Its `syscall` read six `long` arguments with `va_arg` for every call, whatever the number: undefined behavior for a call with fewer arguments (libuv calls it with three for getrandom) or with other types (statx passes `int`s and pointers). - It held only libuv's `syscall(SYS_statx, ...)`. Where statx fails with ENOSYS or EPERM (an old kernel, a seccomp filter), libuv calls the C library's `stat` instead, and the barrier of the writer-race case was never reached. `syscall` is now a few instructions, for x86-64 and aarch64, that read no argument and leave the argument registers and the stack as the caller set them: for SYS_statx they jump to a C function whose parameters are the five arguments of libuv's `uv__statx` with their types (int, const char *, int, unsigned int, buffer), which holds the barrier or calls the C library's `syscall` with exactly those; for any other number they jump to the C library's `syscall`. On both processors a variadic call passes integer and pointer arguments as a prototyped call does, so the jumps are defined by the calling convention. The C library's `syscall` is looked up at the first call, with the argument registers saved, since another library's constructor can call `syscall` before this preload's would run. The barrier also holds the C library's entry points that libuv's fallback can reach, each with its own parameter types and each forwarding to the C library's definition: `stat`, `stat64`, `fstatat`, `fstatat64` and `statx` (glibc 2.28 and 2.33 on), and `__xstat`, `__xstat64`, `__fxstatat` and `__fxstatat64`, which a library built against glibc before 2.33 calls (the release builds against glibc 2.26), found by their glibc symbol version. The comment on hard links now names only the path it covers: Lean's `IO.FS.hardLink` calls libuv's synchronous `uv_fs_link`, which calls `link`. test.sh is unchanged: every case and assertion stays. Checked with gcc 15 and glibc 2.43 on x86-64: the preload builds with `-Wall -Wextra -Werror` (also at `-O2 -D_FORTIFY_SOURCE=2`). A driver holds `syscall(SYS_statx, ...)`, `stat`, `stat64`, `fstatat`, `fstatat64`, `statx` and the versioned `__xstat`, `__xstat64`, `__fxstatat` and `__fxstatat64` for the barrier's path and passes other paths through, as it does `syscall` for mmap (six arguments), getrandom and getpid, also from a constructor that runs before the preload's; `link` fails for the chosen prefix only. libuv 1.48.0, linked into a shared library with -Bsymbolic as in a release, gives ENOENT for the barrier's path on the statx route and, with statx refused by a seccomp filter, on its fallback to `stat`. Part of LINUX-1736. Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
legion-implementer Bot
added a commit
that referenced
this pull request
Nov 28, 2026
…tion The new heads of three pull requests after their review, merged on the previous integration commit: #6 (the CI member: `release_tag` is checked in the one step that reads it and later steps read a Boolean), #7 and #8 (cacheInsertPartial's preload forwards `syscall` without reading its arguments and holds the C library's stat entry points too). The merge needs no resolution: its tree is the previous integration commit's tree with the two changed files of these pull requests. Refs: LINUX-1736 Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
…jump to null Three points of the review of the previous commit, all in NoHardLink.c, the preload of cacheInsertPartial; test.sh is unchanged. - The versioned lookups of the pre-2.33 glibc names use `dlvsym`, which only glibc has, so the preload no longer compiled against musl. They now use it under `__GLIBC__` only, and `dlsym` otherwise (where those names do not exist, and the call fails with ENOSYS as for any missing definition). - The hooks of the `stat` family and the function types they call through took `void *` buffers, so those types did not match the C library's. The file now declares `struct stat`, `struct stat64` and `struct statx` without defining them, and each hook and type takes its own one; the file still includes no <sys/stat.h>. - If `dlsym(RTLD_NEXT, "syscall")` found nothing, the statx helper called address zero and the `syscall` instructions jumped to it. Both now go to `nhl_syscall_missing`, which sets errno to ENOSYS and returns -1. Checked with gcc 15 and glibc 2.43 on x86-64: the preload builds with `-Wall -Wextra -Werror` (also at `-O2 -D_FORTIFY_SOURCE=2`), and against the headers of musl 1.2.5 too; the driver of the previous commit and the libuv 1.48.0 test (statx route and, under a seccomp filter, the fallback to `stat`) give the same results. A test build whose lookup of `syscall` finds nothing makes `syscall` return -1 with ENOSYS, on the first call and later ones, and in the statx helper, while the barrier still holds its path. Part of LINUX-1736. Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
legion-implementer Bot
added a commit
that referenced
this pull request
Nov 28, 2026
…ation The new heads of #7 and #8 (cacheInsertPartial's preload: a musl build, the stat structs' own pointer types, and no jump to address zero when the C library's `syscall` cannot be found), merged on the previous integration commit. The merge needs no resolution: its tree is the previous one with the one changed file of these pull requests. Refs: LINUX-1736 Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb Legion-Role: implementer
Author
|
Review pass by a reviewer of another model family (openai/gpt-6.2-sol), read-only, against the change's rules: a test changes only to fix its own defect, never to skip, exclude or loosen it.
|
Author
|
Release rehearsal: run 46160867934 passed on integration commit |
legion-implementer
Bot
merged commit Nov 28, 2026
2e3e29c
into
fork/v4.36-lake-cache-insert-r21
24 of 26 checks passed
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.
cacheInsertPartial failed in the job "build / Linux release" on the tag
v4.36-machcsl-r20 for a defect of the test: its preload (NoHardLink.c)
replaced libuv's
uv_fs_linkanduv_fs_stat. A release build links libuvstatically into libleanshared.so, with -Bsymbolic, so the runtime's calls of
these functions bind inside that library and the preload never ran: on the tag
the hard link into the cache succeeded, and the test found no
"d2c4f49280adf1f1.art: not cached" line.
The preload now replaces the C library's
link, which libuv'suv_fs_linkcalls, and
syscallforstatx, which libuv'suv_fs_statcalls. A processcalls the C library through the dynamic linker, so the preload takes these
calls in a release as in any other build. The test's cases and expectations
are unchanged. fork/v4.36-lake-remote-fallback-flat carries the same
NoHardLink.c and gets the same change.
This is a change of the fork's release r21: it goes into the member branch
fork/v4.36-lake-cache-insert-r21, which r21 merges in place of the member it copies. It merges as a squash after its review, when r21 is cut.After its review, two more commits change the preload as in the service-mode member's copy:
syscallis an x86-64/aarch64 entry that reads no argument and sends onlystatxto a typed function; typed hooks hold the C library's stat entry points too (libuv's fallback whenstatxfails);dlvsymonly with glibc; no jump to address zero when the C library'ssyscallcannot be found.Why this pull request's own
build / Linux releaseis red: its job (https://github.com/sjawhar/lean4/actions/runs/46112017549/job/140877566857) stops atUpload Lake Cache, before any test: a pull request's run takes its workflow files from the member branch, which carries upstream's.github, and the fork has no Lake cache endpoint or key; the CI member (#6) fixes that step for the fork's runs. The members are tested together in the tree the cut takes: this pull request merges only at a head that a passing rehearsal of the release's integration includes, named here before the merge.Dispatch: LINUX-1736