EigenOS link break: the freestanding allowlist is a ONE-SIDED contract — pthread_once/pthread_self are declared HAL roots that EigenOS never implemented
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- build-system, operating-systems
Direzione di ricerca
Start with EigenOS/src/hal.c and the pthread roots in tools/freestanding_allowlist.txt, then inspect trace.c:1392/1400 and builtins.c:2299/2315 to understand the existing callers and guards. Add the two missing HAL roots, implement the reverse allowlist-versus-nm check, and correct the allowlist comment. Done means the freestanding link succeeds, the safety behavior remains enabled, and the check fails when a declared HAL root is absent.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
EigenOS fails to link the runtime: undefined pthread_once and pthread_self.
The obvious reading is "builtins.c and trace.c call pthread unconditionally, so add EIGENSCRIPT_FREESTANDING guards". Measured, that is the wrong fix — and it would trade away a loud-failure guard.
What is actually true
tools/freestanding_allowlist.txt deliberately lists both symbols as HAL roots that EigenOS is expected to provide:
# --- scheduler roots (pthread over spawn/yield/park) ---
pthread_create
pthread_join
pthread_once <-- line 44
...
# Thread IDENTITY, not scheduling: #1142's replay tape records which OS
# thread opened it (g_replay_owner_tid) so a take from any other thread
# fails loud instead of silently mixing taped and live values. EigenOS's
# cooperative scheduler already owns the pthread roots above; the identity
# pair is the same HAL story — a task handle the kernel can compare.
pthread_self <-- line 66
So make freestanding-check is green correctly. The runtime is using only declared roots. The gate is not blind.
The break is that EigenOS does not provide two of them. EigenOS/src/hal.c implements 14:
pthread_create pthread_join pthread_mutex_init/lock/unlock/destroy pthread_cond_init/wait/timedwait/signal/broadcast/destroy pthread_condattr_init/destroy/setclock
and is missing exactly pthread_once and pthread_self — which is exactly the pair that fails to link.
(Instrument calibrated before reading absence as fact: the same grep finds eigs_embed in 3 files and malloc in 9, and finds pthread_create/pthread_mutex_lock in 1 file each.)
Why guarding them out is the wrong direction
- trace.c:1392/1400 is #1142's replay-owner check: a tape take from a thread other than the one that opened it fails loud instead of silently mixing taped and live values. Compiling that out on EigenOS removes the loud failure and leaves the silent-wrong behaviour it was built to prevent — the exact trade the fail-soft→loud reform (#971) forbids.
- builtins.c:2299/2315 is one-time PRNG seeding. Note the inner function already carries
#if EIGENSCRIPT_FREESTANDINGforgetpid(), so freestanding was considered there and thepthread_oncewrapper around it was missed — the half-converted shape (outer guard left behind while the inner one was done).
Both are a few lines on a cooperative scheduler: pthread_self() returns the current task handle; pthread_once(once, fn) is a flag plus a call. That matches what the allowlist already promises, and keeps the safety guard.
The finding underneath, which is the durable one
The allowlist is a one-sided contract. The gate checks "the runtime uses only allowlisted roots" and nothing checks "EigenOS provides every allowlisted root." So a root can be ADDED to the contract without its counterparty ever being told.
That is what happened: #1142 added pthread_self and wrote, as its rationale, that "EigenOS's cooperative scheduler already owns the pthread roots above." Measured today, it owns 14 of 16 — and not those two. The sentence was reasoned, not checked.
The missing direction is cheap and mechanical: compare the allowlist against nm of EigenOS's HAL objects and fail on any allowlisted root the HAL does not define. That check would have gone red the moment #1142 landed, in the repo that made the promise, instead of surfacing as a link error in the consumer weeks later. It is the same both-directions rule the gate already applies to its own undefined-symbol set — just extended across the repo boundary.
Suggested shape
- Add
pthread_onceandpthread_selftoEigenOS/src/hal.c(restores the link, keeps #1142's guard). - Add the reverse check so the contract cannot gain an unimplemented clause again.
- Fix the allowlist comment, which currently asserts something false about the counterparty.
- Lingua principale
- C
- Stelle
- 3
- Fork
- 7
- Merge medio
- 11h 28m
- PR unite (30g)
- 262
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di InauguralSystems/EigenScript
-
area:gates area:gfx found-by:critic kind:gate-defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
InauguralSystems/EigenScript#1825 ·
I maintainer di solito rispondono entro 1 giorno
-
Amalgamation compiles with warnings at -O0 (-Wreturn-type) and -O1 (-Wmaybe-uninitialized)Forse già presa @facelessdevhack l’ha presa 4 giorni fa. Apertaarea:embed bug found-by:code-review kind:gate-defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
InauguralSystems/EigenScript#1775 ·
I maintainer di solito rispondono entro 1 giorno
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atApertaarea:runtime-vm kind:silent-wrong
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
InauguralSystems/EigenScript#1748 ·
I maintainer di solito rispondono entro 1 giorno
-
area:gfx bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
InauguralSystems/EigenScript#1684 ·
I maintainer di solito rispondono entro 1 giorno
-
area:stdlib bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
InauguralSystems/EigenScript#1679 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di InauguralSystems/EigenScript
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
VirusTotal/yara#2255 ·
-
[BUG] Filename sequence expansion (`+`) panics on numeric values exceeding `i32::MAX`Forse già presa @muntasir-396 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
CCExtractor/ccextractor#2402 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
FujiNetWIFI/fujinet-lib#204 ·
I maintainer di solito rispondono entro 1 giorno
-
os:linux
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
mpv-player/mpv#18649 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
facebookincubator/muse-gadget-sdk#249 ·
I maintainer di solito rispondono entro 1 giorno