fork quiesce barrier can be bypassed

Aberta
#511 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
c, macos

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
C
Estrelas
287
Forks
33
Merge médio
2d 17h
PRs com merge (30d)
18

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de sysprog21/elfuse

Todas as issues de sysprog21/elfuse

Issues semelhantes

Mais issues de C

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.