Exit of the last `clone(CLONE_VM)` child ends the parent process
I maintainer di solito rispondono entro 3 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, linux
- Ambito
- operating-systems
Direzione di ricerca
Start in src/runtime/forkipc.c at vm_clone_thread_run around line 1446 and read the proc_request_exit_group call and its comment. Compare the clone child’s exit handling with the Linux behavior described in the issue, including how the parent is woken and how waitpid receives the child status. Done means the parent remains alive to wait for the child and return its own exit code.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When the last clone(CLONE_VM) child (without CLONE_THREAD) of an elfuse process exits, vm_clone_thread_run (src/runtime/forkipc.c:1446, at 173b23b) calls proc_request_exit_group with the child's exit code. The parent ends with it, even when the parent is still running and has more work to do.
On Linux the child is a separate process. Its exit raises SIGCHLD in the parent, waitpid returns its status, and the parent keeps running.
Reproduce (static aarch64 binary):
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
static volatile int go;
static int child(void *a) { (void) a; while (!go) usleep(1000); return 0; }
int main(void) {
char *stk = malloc(1 << 16);
pid_t c = clone(child, stk + (1 << 16), CLONE_VM | SIGCHLD, NULL);
go = 1;
int st;
pid_t w = waitpid(c, &st, 0);
dprintf(2, "waited %d st=%x\n", w, st);
return 3;
}
- Linux 6.18.57 (qemu reference VM): prints
waited <pid> st=0, exits 3. - elfuse at 173b23b: prints nothing after the clone and exits 0, the child's code.
The comment at the call says the exit_group is there so that a main thread blocked in futex_wait or its run loop wakes up. To match Linux, that main thread would need another way to wake, and the parent would need to exit only through its own exit or exit_group.
test-proc-limits works around this in #448 by running its VM-clone check in a fork child.
Checked, not affected: posix_spawn, which glibc implements with clone(CLONE_VM | CLONE_VFORK). A static glibc guest that spawns busybox true, waits for it and returns 3 prints spawn rc=0 waited <pid> st=0 and exits 3, under elfuse at 173b23b and on Linux 6.18.57 alike.
- Lingua principale
- C
- Stelle
- 275
- Fork
- 29
- Merge medio
- 2g 22h
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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 sysprog21/elfuse
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di sysprog21/elfuse
Issue simili
-
TLS: a stale OpenSSL error makes non-blocking reads fail with "Resource temporarily unavailable"Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
bigtreetech/BIGTREETECH-TouchScreenFirmware#3056 ·
I maintainer di solito rispondono entro 1 giorno
-
Allow pillow 13Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[pico][astrocade] emu/apply.sh edits src/mame/midway/astrohome.cpp, which current MAME has in bally/Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
FujiNetWIFI/fujinet-firmware#2120 ·
I maintainer di solito rispondono entro 1 giorno