fork quiesce barrier can be bypassed

Aperta
#511 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

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, macos

Direzione di ricerca

Start with thread_quiesce_siblings and thread_fork_barrier_check, then read src/syscall/proc.c around handle_canceled and the thread_exec_de_thread comment. Trace the exit and run-loop paths for each described kick timing, plus the case where a sibling remains parked across fork windows. Done means siblings reliably park before snapshots and back-to-back forks no longer wait for the 100 ms timeout.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

fork quiesce barrier can be bypassed, so the snapshot runs beside a live sibling

thread_quiesce_siblings kicks every sibling with hv_vcpus_exit and waits up to 100 ms for each to reach thread_fork_barrier_check. That check only runs in the CANCELED exit handler (src/syscall/proc.c, handle_canceled), so a kicked sibling can return to guest code without parking:

  1. The kick lands while the sibling is in a host syscall. As the thread_exec_de_thread comment notes, such a kick is lost, and the run loop top has no fork check before hv_vcpu_run.
  2. The kick lands at EL1, and the handler returns VCPU_RESUME before the barrier.
  3. A signal is pending, and the handler delivers it and returns VCPU_RESUME before the barrier.

The forker then times out and takes the snapshot while that sibling keeps running guest code, although the barrier comment says the quiet is load-bearing.

Reproduction: one sibling loops on nanosleep(200us) while the main thread calls fork() repeatedly and times each call (macOS 15.4.1, Apple M4, median of 21):

sibling in compute loop:      fork() 13 ms
sibling in nanosleep loop:    fork() 112 ms   (every fork hits the 100 ms timeout)

A smaller issue in the same code: if a sibling is still parked from the previous fork window, it is counted again when the next one arms and never answers, so back-to-back forks each pay the 100 ms timeout.

Lingua principale
C
Stelle
287
Fork
33
Merge medio
2g 17h
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sysprog21/elfuse

Tutte le issue di sysprog21/elfuse

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.